2012-06-23, 20:44:59
Hi Mikael:
Thanks for the reply. I looked at that thread and fixed the problem!
Some comments on the thread:
- I can't use USART2, as the circuit board is fixed with USART1, so I never bothered to test the second port.
- It seems difficult to believe that a small error in the bit times would cause it to not work at all. Intermittently perhaps. Trying lower baud rates would help that issue, but I never bothered.
- The errata tidbit about setting BRGH = 1 and BRG16 = 1 only applies to rev 2 chips. Since my 26K22 chips are rev 4 (as reported by pickit-3 when it connects), I never bothered with this.
- Posts by hobbytronics and ghu show extra assembly code for the user_code section. As I have not programmed pic assembly since the early 90s (I use CCS C), I had to dig into assembly a bit (pardon the pun).
IT NOW RUNS DUE TO TWO THINGS I DID:
1) GOT RID OF MPLAB-X -- this never could talk to the Pickit-3. I find it reprehensible that Microchip allowed this software out without testing it. I am apparently not the only one who ran into problems with it. Maybe there is a firmware update for pickit-3 to fix it, but now that I have my bootloader built, I won't need mplab except to program a chip, or maybe build ds30loader for another chip in the future. I loaded the MPLAB version 8.70 that came on disk with the pickit-3 and it works great.
2) ADDED A FEW ASSEMBLY LINES TO USER_CODE:
UserInit macro
; tweak: Make uart-1 pins digital:
movlb 0x0F ; MANDATORY: BSR set to SFR bank
movlw b'00000000'
movwf ANSELC ; MANDATORY: analog off on port C
movlw b'00000000'
movwf ADCON0 ; not necessary, but adc off
movlw b'10111111'
movwf TRISC ; not necessary, but tx pin RC6 as output
A big thanks to hobbytronics and ghu for finding this!
gil smith
Thanks for the reply. I looked at that thread and fixed the problem!
Some comments on the thread:
- I can't use USART2, as the circuit board is fixed with USART1, so I never bothered to test the second port.
- It seems difficult to believe that a small error in the bit times would cause it to not work at all. Intermittently perhaps. Trying lower baud rates would help that issue, but I never bothered.
- The errata tidbit about setting BRGH = 1 and BRG16 = 1 only applies to rev 2 chips. Since my 26K22 chips are rev 4 (as reported by pickit-3 when it connects), I never bothered with this.
- Posts by hobbytronics and ghu show extra assembly code for the user_code section. As I have not programmed pic assembly since the early 90s (I use CCS C), I had to dig into assembly a bit (pardon the pun).
IT NOW RUNS DUE TO TWO THINGS I DID:
1) GOT RID OF MPLAB-X -- this never could talk to the Pickit-3. I find it reprehensible that Microchip allowed this software out without testing it. I am apparently not the only one who ran into problems with it. Maybe there is a firmware update for pickit-3 to fix it, but now that I have my bootloader built, I won't need mplab except to program a chip, or maybe build ds30loader for another chip in the future. I loaded the MPLAB version 8.70 that came on disk with the pickit-3 and it works great.
2) ADDED A FEW ASSEMBLY LINES TO USER_CODE:
UserInit macro
; tweak: Make uart-1 pins digital:
movlb 0x0F ; MANDATORY: BSR set to SFR bank
movlw b'00000000'
movwf ANSELC ; MANDATORY: analog off on port C
movlw b'00000000'
movwf ADCON0 ; not necessary, but adc off
movlw b'10111111'
movwf TRISC ; not necessary, but tx pin RC6 as output
A big thanks to hobbytronics and ghu for finding this!
gil smith