Bootloader and configs, EEprom
I am using Melabs bootloader for the first time. I have been able to load and run my blinkLED programs fine. While reading post on loaders I have come across several items discussing configs can not be loaded with your program but must be loaded at Bootloader installation. Well at least that’s what is sounds like. I am not sure how to set the configs during the installation of the loader Hex file. Is this done using the Melabs programmer? If I click the “C” button and set configs will that program the PIC when I install the Bootloader? Once I Read after programing I am not sure if the PIC is now set with those config settings? Also, I am not sure if the Program hex file that contains “Data” instructions to load the on board EEprom are actually loading the EEprom? I am not sure how configs and on board EEprom should be handled using the Bloader. Comments please.
Reply to the broken records
Thanks mister_e, I'll give it a shot...
OK boys, Back to the subject please!
Mister_e, after doing my homework, it looks like the MCBloader 16F876a_20 uses the config word 3F72 after opening the Bloader with Mel Labs Programmer. ( I don’t have a Pickit2) This value will turn off WDT. This is what Charles suggests but my program uses the PBP SLEEP command. I need to change the config to 3F76. If I use Word Pad to open 16F876a_20 and look for “3F72” . Word Pad seems to invert the bytes of each word so I search for “723F”. I find in the next to the last line “:02400E0072EFFF”. The last three bytes are of interest. 72EFFF. “72EFFF” is actually “EF72” followed by byte “FF” I think. If I’m right, a change here should do the trick. Please give me your valued wisdom on this change before I destroy this file and perhaps a $5 part in the process.
Thanks
Boot Loader demystified, I wish
Correct me if I’m wrong. The MCBootloader.hex is raw data. There’s no decompression or any further manipulation to be done. So how is the configs past to the programer from the compiler? I set the configs in our PBP and that tells the compiler what you want, the compiler passes this information to the programmer in the HEX file. I open the programer after compiling PBP and I open only a HEX file. So the information must be in the HEX file. Why do you need anything else to set configs? We just locate the config word within our HEX file and replace that word with the information we need and save the file. The config word %0011 1111 0111 0110 or $3F76 would just replace the current $3F72 (in the word pad form of 723F) in the hex file and save!!! Job complete! IF and only IF what appears to be the config word on the next to the last line of the loader is in fact IT. We think the Hex file has instructions for the programmer to write to 2007 (16F87x) so all we have to do is find the word it writes to 2007 and replace it. I know this sounds too easy. A test of Occam’s razor’s edge. OOPs, the checksum got me! Can't change the word in the file so easy. More brainstorming...
mister_e is right, BootLoader files configs a piece of cake
Yep! That’s the config word in the Hex file. Open a MC Boot loader Hex file (16F87x a_20) with Word Pad and check byte 8 and 7 from the end of the file. This is the config word $3F72 ( in the Word Pad it is 72 3F). It looks like all 16F MCLoader files default to $3F72. If I want to turn WDT on I will have to change" 72 3F" in the Word Pad to "76 3F" and save the file. If you open a MC boot loader Hex with MelProgrammer after making these changes in Word Pad you will see the WDT is now turned ON. And yes, to change the configs in the file all you have to do is open the config interface and change settings in the dropdown menu and save. I think this is what mister_e was talking about yesterday but he closed shop for the day before explaining the details. You can also change the config word in Word Pad but when you save you will get a checksum error. Whoever, the checksum error seems to have no effect on the function of the file as you can load the file in MelProgrammer and see that you have made changes to the config settings. Not a big deal now that I know the programmer will make the changes I need, but it’s nice to know a little more about the structure of the BootLoader Hex file. So that brings me back to Charles Linquis statement “Make certain that you have the WatchDog Timer turned off”. OK Charles, WHY?
Thanks!