Differences between bootloader and pickit

General questions about Firewing...

Differences between bootloader and pickit

Postby Coccoliso » Thu Aug 06, 2015 10:16 am

hi,
I had never felt before loading from pickit and found inconsistencies.
First I compiled and programmed the PIC24 with the FW loader and I did an HEX dump file via pickit2 gui then I compiled and programmed with pickit2 programmer option and I redid the HEX dump via pickit2 gui.
The length in bytes is the same but the content is different (I think in the configuration part)
In second line HEX dump:
:10000000005404000100000084020000840200008B // FW loader dump
:1000000000020400000000008402000084020000DE // pickit dump

in HEX bottom :

:10000000CF000000CF00000007000000010000004A // FW loader dump
:100010004300000058000000F7000000C30000008B

:10000000CF000000CF0000000700000087000000C4 // pickit dump
:10001000E7000000DF000000F7000000E300000040

I had already noticed that the hex generated by FW is incompatible with pickit gui version because missing of configuration part but I have problems compiling and transferring it from FW via PK2CMD also.
Where am I wrong? :(
User avatar
Coccoliso
 
Posts: 177
Joined: Sat Sep 27, 2014 10:02 am

Re: Differences between bootloader and pickit

Postby Coccoliso » Thu Aug 06, 2015 10:54 am

Hi,
some other tests..
as I said in the post of the first version programmed via FW loader working while the version programmed by pickit2 not working.
I have read this post http://www.firewing.info/forum/viewtopic.php?f=12&t=216#p1215 and adding Jerry's macro on the clock frequency and now works (but the program does only a Console.Write so is very restrictive) even if the two versions differ again for the second line:
:10000000005404000100000084020000840200008B // FW loader
:1000000000020400000000008402000084020000DE // pickit2

Any idea about it?
Last edited by Coccoliso on Thu Aug 06, 2015 1:04 pm, edited 1 time in total.
User avatar
Coccoliso
 
Posts: 177
Joined: Sat Sep 27, 2014 10:02 am

Re: Differences between bootloader and pickit

Postby Coccoliso » Thu Aug 06, 2015 12:56 pm

hi,
I would like a confirmation of what I understand from the tests.
The FW loader puts a goto 0x015400 at first location then return to the base 0x000200 while charging with pickit2 the first statement is a goto 0x000200 directly.
The part in question is used for the management of the serial and USB loader and does not involve changes in the user program .. right? ( otherwise I'm fried :roll: )
User avatar
Coccoliso
 
Posts: 177
Joined: Sat Sep 27, 2014 10:02 am

Re: Differences between bootloader and pickit

Postby Jerry Messina » Fri Aug 07, 2015 11:13 am

Right. The Firewing serial loader resides in the top part of the pic24 memory ( 0x015400), so if you have the loader installed there's an initial "goto loader" at location 0. The loader assumes your program will start at 0x000200 (that's right after the IVT) and jumps there to run it.

When you don't have the loader installed you should end up with a "goto 0x000200" at location 0. You will have to setup the configuration words in your code since normally that's part of the bootloader. If you look at the bootloader source it sets up the clock, assigns PPS mapping for the serial pins, and inits the uart. You'll have to perform the same steps in your code to run without the bootloader.
Jerry Messina
 
Posts: 280
Joined: Thu Feb 14, 2013 10:16 am

Re: Differences between bootloader and pickit

Postby Coccoliso » Fri Aug 07, 2015 12:00 pm

Hi Jerry,
So I think I succeeded because clock and console work well.
Thanks Jerry
User avatar
Coccoliso
 
Posts: 177
Joined: Sat Sep 27, 2014 10:02 am

Re: Differences between bootloader and pickit

Postby Coccoliso » Fri Aug 14, 2015 3:38 pm

Hi Jerry,
I have surely an issue on the PPS initial setting.
I have a problem on setting CAN_RX pin that is made by PPS with a difference in behavior between bootloader and pickit.
Can you tell me where to look for PPS settup in the bootloader?
Thank you.
User avatar
Coccoliso
 
Posts: 177
Joined: Sat Sep 27, 2014 10:02 am

Re: Differences between bootloader and pickit

Postby Jerry Messina » Fri Aug 14, 2015 6:15 pm

I don't know the bootloader's the problem, but it's here at http://www.firewing.info/downloads/load ... der-r2.zip

The file firewingloader.s does this:
Code: Select all
   ; receive, map pin (RP6 = 00110) to uart
   bclr      RPINR18, #U1RXR0      
   bset      RPINR18, #U1RXR1      
   bset      RPINR18, #U1RXR2      
   bclr      RPINR18, #U1RXR3      
   bclr      RPINR18, #U1RXR4      
                  
    ; U1TX 00011 RPn tied to UART1 Transmit
   ; transmit, map pin (RP7 = 00011) to uart
   bset      RPOR3, #RP7R0         
   bset      RPOR3, #RP7R1         
   bclr      RPOR3, #RP7R2         
   bclr      RPOR3, #RP7R3         
   bclr      RPOR3, #RP7R4         


It doesn't do much more than that.
Jerry Messina
 
Posts: 280
Joined: Thu Feb 14, 2013 10:16 am

Re: Differences between bootloader and pickit

Postby Coccoliso » Fri Aug 14, 2015 6:36 pm

Hi,
then touches only the ports of UART and nothing else ..
it's better to look between the clock settings in the macro that you had posted if there is something that does not like at CAN.
I'll let you know if and how it will end the search.
Thanks again Jerry.
User avatar
Coccoliso
 
Posts: 177
Joined: Sat Sep 27, 2014 10:02 am

Re: Differences between bootloader and pickit

Postby Jerry Messina » Fri Aug 14, 2015 7:00 pm

Something else to look at is the clock setting itself. CAN is very timing sensitive and requires an osc of better than 0.5% accuracy.

If you're using the internal osc you might be able to get a loopback to the same device working, but it'd be difficult to get it to work between devices.
Jerry Messina
 
Posts: 280
Joined: Thu Feb 14, 2013 10:16 am

Re: Differences between bootloader and pickit

Postby Coccoliso » Fri Aug 14, 2015 10:00 pm

Hi Jerry,
I found the mistake, in your macro (http://www.firewing.info/forum/viewtopic.php?f=12&t=216#p1215) I do not remember why I had removed the comment on line

Code: Select all
    // trim osc for accurate baud (optional)
    'OSCTUN = &H03A


putting things as they were all worked properly.
Now pickit2 works as the bootloader with FW 24 :
- CAN bus 500kHz
- internal clock 80 MHz
- connected to a 18F4685 test board

Thanks for your suggestions.
User avatar
Coccoliso
 
Posts: 177
Joined: Sat Sep 27, 2014 10:02 am

Next

Return to Questions

Who is online

Users browsing this forum: No registered users and 2 guests

cron

x