View previous topic :: View next topic |
Author |
Message |
nilsener
Joined: 06 Dec 2005 Posts: 59
|
Bootloader isn't writing the ID Bytes |
Posted: Wed Aug 25, 2010 6:17 am |
|
|
v4.014
18F2685
Dear,
I use the loader.c example for a bootloader.
It works fine for the program code but it doesn't write the ID bytes at address 0x200000...0x200007. I tried it with code protection on and off.
This piece of code makes restrictions for the bootloader area and for
addresses above 0x300000 but not for the required ID location at 0x200000...0x200007, that is below 0x300000.
Code: |
#if defined(__PCM__)
} else if ((addr < LOADER_ADDR || addr > LOADER_END) && addr < 0x2000){
#elif defined(__PCH__)
} else if ((addr < LOADER_ADDR || addr > LOADER_END) && addr <
0x300000){
#endif
|
Has someone an idea what to do that the bootloader writes the ID bytes, too?
Best regards
nilsener |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Thu Aug 26, 2010 12:53 am |
|
|
Step 1. Select a PIC capable of writing the config bits.
Step 2. Modify the bootloader to write to the config space.
Step 3. Bootloader user code that writes to the config bits.
Then - in 90% plus examples where a bootloader allows the fuse setting of the applicaton to be used and where the wrong fuse settings were written to the PIC: The bootloader will no longer function, so recover the unit from the field, erase and reprogram the PIC with the bootloader.
Hint in general you should not allow a bootloader to rewrite the fuses. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
nilsener
Joined: 06 Dec 2005 Posts: 59
|
|
Posted: Thu Aug 26, 2010 1:16 am |
|
|
Hello asmallri,
Thanks for reply, but what I need is not to rewrite the fuses but the ID bytes at address 0x200000...0x200007. In my application I have the program checksum at this location. I use:
Code: |
#ID CHECKSUM_PROGRAM
|
After bootloading new software, there is another program checksum that must be written to the ID bytes. I must do it because my application is checking itself by using the program checksum. If checksum is wrong it results in an error message to the user. |
|
|
|