ds30 Loader free edition forums
ds30loader ok testboard- doesn't work in device [solved] - Printable Version

+- ds30 Loader free edition forums (https://picbootloader.com/forum)
+-- Forum: Support (https://picbootloader.com/forum/forumdisplay.php?fid=3)
+--- Forum: 16-bit firmwares (https://picbootloader.com/forum/forumdisplay.php?fid=6)
+--- Thread: ds30loader ok testboard- doesn't work in device [solved] (/showthread.php?tid=80)



ds30loader ok testboard- doesn't work in device [solved] - Donheli - 2011-05-04

I have gotten ds30loader working fine on test boards with pic24hj128gp502 and pic24fj256ga110. Both chips are running pll, the 24hj running at 4*7.375MHZ and the 24FJ at 4*8MHZ.

My actual device has both a 24hj128gp502 and a 24fj256gp106. The FJ chip in my device is 64 pins, whereas the one on the test board is 100 pins- otherwise the same chips.

I cannot get the gui to connect with the bootloader on either of the chips on my actual device.

On my actual device the 24HJ is running at 30 MhZ with a 30 MHz crystal and the 24FJ is running at 32 MHz with a 32 MHz crystal. Also
on my actual device VDD has ~ 200 usec risetime, whereas on the test boards the rise time is much faster.

I have done numerous tests, but in summary the results are:

The bootloaders are running in both chips, and if I put a sendL ‘D’ near the beginning in the .s file, I see the D sent repeatedly with no discernable delay using a terminal program. When I do the same thing on my test boards, I see the ‘D’ about every 3 seconds, and the GUI connects and bootloads fine, even with the ‘D’ being sent.

On my device, putting in strategic sendl’s in the .s file to trace whatis happening, the bootloader thinks it has an input on the uart that is not valid and completely bypasses the 3 sec delay and goes immediately to exit, where it then starts over.

I added the three bclr’s shown below in an attempt to get rid of any uart events that were present as the program started, but that made no difference. Possibly I’m leaving out something here. You can also see where I placed the sendl ‘D’.

;----------------------------------------------------------------------
; TX enable, make tx enable pin output and set to 0
;----------------------------------------------------------------------
.ifdef USE_TXENABLE
bclr TRISR_TXE, #TRISB_TXE
bclr LATR_TXE, #LATB_TXE
.endif
bclr UIFS, #URXIF ;clear uart received interrupt
bclr USTA, #OERR ; clears error bit AND clears data in urxreg
bclr USTA, #URXDA ; clear bit saying we have a uart value SendL 'D' ;

;------------------------------------------------------------------------------
; Receive hello
;------------------------------------------------------------------------------

I then went back to the original .s and settings.inc files for the 24HJ chip and changed only the pin assignments for my chip. I did not change the config’s, even using the internal oscillator as configured. It did not work (the GUI did not see it). I then added the sendl ‘D’ and found it was doing the same thing. The bootloader was running and sending the ‘D’, but bypassing the 3 sec wait.

I tried 9600 baud and again had the same result. I am always able to read the character it is sending, so the baud rate is OK.

It acts as if it is continuously getting input on the uart, or worse, reseting the chip.

I used MPLAB icd2 to program my applications, and everything works fine, including the uarts. I did have to clear buffers and interrupts before it would work with my programs, though.


I am using rp13 for transmit and rp14 for receive on the 24HJ. Below is the code I inserted in .s for this assignment.

; Transmit, map uart to pin b13 uart1 is 00011
bset RPOR6, #RP13R0 ;xxx
bset RPOR6, #RP13R1 ;xxx
bclr RPOR6, #RP13R2 ;xxx
bclr RPOR6, #RP13R3 ;xxx
bclr RPOR6, #RP13R4 ;xxx

I am stumped. Any help would be appreciated.


RE: ds30loader ok testboard- doesn't work in device - Mikael Gustavsson - 2011-05-08

Do you use exactly the same configuration bits and PLL setup?
Have you read the erratas?


RE: ds30loader ok testboard- doesn't work in device - Donheli - 2011-05-10

I did not use the same PLL settings, since I am now using a 30 MHz crystal instead of a 7.375MhZ crystal.

The config statements are shown below for two different cases I tried.

I read the characters since by the pic24HJ128GP502 fine with a terminal program, so the ds30 loader is running and the baud rate is OK.


Configuration settings for running with 30MHz crystal

;------------------------------------------------------------------------------
;config __FBS, RBS_NO_RAM & BSS_NO_FLASH & BWRP_WRPROTECT_OFF
;config __FSS, RSS_NO_RAM & SSS_NO_FLASH & SWRP_WRPROTECT_OFF
;config __FGS,GSS_OFF & GCP_OFF & GWRP_OFF
config __FOSCSEL, FNOSC_PRI & IESO_OFF
config __FOSC,FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMD_HS& IOL1WAY_OFF
;config __FWDT,FWDTEN_OFF & WINDIS_OFF
;config __FPOR,FPWRT_PWR1
;config __FICD,BKBUG_ON & COE_ON & JTAGEN_OFF & ICS_PGD1

I also tried using internal oscillator. Configs are:
;------------------------------------------------------------------------------
;config __FBS, RBS_NO_RAM & BSS_NO_FLASH & BWRP_WRPROTECT_OFF
;config __FSS, RSS_NO_RAM & SSS_NO_FLASH & SWRP_WRPROTECT_OFF
;config __FGS,GSS_OFF & GCP_OFF & GWRP_OFF
config __FOSCSEL, FNOSC_FRC & IESO_OFF
config __FOSC,FCKSM_CSDCMD & OSCIOFNC_ON & POSCMD_XT
;config __FWDT,FWDTEN_OFF & WINDIS_OFF
;config __FPOR,FPWRT_PWR1
;config __FICD,BKBUG_ON & COE_ON & JTAGEN_OFF & ICS_PGD1


I left those commented out so you could see they were still commented out.

Also below is the configuration (pin selection) for the uart receiver on the 24HJ128GP502. If this were wrong, then that could explain my entire problem.

; Receive, map pin to uart1 pin b14 1110;
bclr RPINR18, #U1RXR0 ;xxx
bset RPINR18, #U1RXR1 ;xxx
bset RPINR18, #U1RXR2 ;xxx
bset RPINR18, #U1RXR3 ;xxx
bclr RPINR18, #U1RXR4 ;xxx





RE: ds30loader ok testboard- doesn't work in device - Mikael Gustavsson - 2011-05-15

I'm sorry but I don't have time to look at this at the moment.
I may have time late next week.

Mikael


RE: ds30loader ok testboard- doesn't work in device - Donheli - 2011-05-17

I FIXED IT.

I found I had to do three things to make dsloader work in my project.

1. I had to put a 100ms delay AFTER initialization of the UART. Putting this at the beginning of the code did not help.
2. Right after the 100 ms delay, I had to read the uart input continuously until it was clear.
3. On both processors the pins I was using for the RX pins were also analog pins, so I had to set the appropriate bits in AD1PCFGL on both processors to switch them to digital.

After I found item 3, I tried removing the delay and the clearing of the uart. Unless I did all three items ds30loader did not work!

Interestingly enough I had to also do items 1 & 2 in my C code to get my application programs to run when directly loaded. Otherwise they would hang up when the uart was turned on in the code. I'm sure the c compiler took care of item 3, so my c programs worked fine.

Why the delay?? I don't know. I did not try a shorter delay. I did not need the delay when using an 8 MHz crystal and PLL, but I do need it now with a 32 MHz crystal and no PLL.

Why do I have to clear the uart receive register multiple times? I don't know. Again I did not have to do that on the test board.






RE: ds30loader ok testboard- doesn't work in device - Mikael Gustavsson - 2011-05-17

Great! Thanks for sharing.

Maybe the 32MHz crystal takes longer to stabilize. Do you use the correct capacitors?
Why do you use such a high frequency crystal?