Newbie HEX error every time
Moderators: David Barker, Jerry Messina
Newbie HEX error every time
Hi All,
I'm new to SF but experienced with PBPro. Purchased in December 2012 but haven't had a chance until now to use it. V 2.2.1.4
I am trying to compile the simplest program (Write) from the Samples area using the default 18F452 and it appears successful until I go to load it in my programmer.
As I double click or Open the hex file for loading I'm greeted with a small box stating: "Error in HEX file - FUSE." Line: 33 :03000100220E0EBE
other Samples do the same.
Using the same hardware I have no problem compiling. loading or programming the same 452 with similar PBPro code so it has to be a SF issue or something I'm missing...
What am I doing wrong? I will attach the hex file if needed.
Cheers,
Bill
I'm new to SF but experienced with PBPro. Purchased in December 2012 but haven't had a chance until now to use it. V 2.2.1.4
I am trying to compile the simplest program (Write) from the Samples area using the default 18F452 and it appears successful until I go to load it in my programmer.
As I double click or Open the hex file for loading I'm greeted with a small box stating: "Error in HEX file - FUSE." Line: 33 :03000100220E0EBE
other Samples do the same.
Using the same hardware I have no problem compiling. loading or programming the same 452 with similar PBPro code so it has to be a SF issue or something I'm missing...
What am I doing wrong? I will attach the hex file if needed.
Cheers,
Bill
-
- Swordfish Developer
- Posts: 1471
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Hi Jerry,
Thanks for the reply. I upgraded after my last post to the latest version BTW but no difference.
Yes, the Write.bas is about at basic as it gets (no pun intended) and I have not edited it in any way, it specifies device = 18F452.
I can't see any info on including attachments otherwise I'd put up the bas and hex files for everyone to see.
Any other thoughts on this?
Cheers,
Bill
Thanks for the reply. I upgraded after my last post to the latest version BTW but no difference.
Yes, the Write.bas is about at basic as it gets (no pun intended) and I have not edited it in any way, it specifies device = 18F452.
I can't see any info on including attachments otherwise I'd put up the bas and hex files for everyone to see.
Any other thoughts on this?
Cheers,
Bill
-
- Swordfish Developer
- Posts: 1471
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Here's what I get compiling that sample as is. The hex file looks ok to me (unless I'm missing something)
actual HEX file contents...
fuse data (parsed)
This is how MPLAB is decoding them them...
Not sure what it's complaining about. What programmer are you using?
actual HEX file contents...
Code: Select all
:020000040030CA
:03000100220E0EBE
:02000500018177
:060008000FC00FE00F40E5
:00000001FF
Code: Select all
Line 33 : [XLin] New high address offset : $0030 (New base start address : $00300000)
Line 34 : [Data] Address : $00300001 Data : 22,0E,0E
Line 35 : [Data] Address : $00300005 Data : 01,81
Line 36 : [Data] Address : $00300008 Data : 0F,C0,0F,E0,0F,40
Line 37 : [EndF] *** EOF Record ***
Code: Select all
Address Value Field Category Setting
300001 22 OSC Oscillator Selection bits HS oscillator
OSCS Oscillator System Clock Switch Enable bit Oscillator system clock switch option is disabled (main oscillator is source)
300002 0E PWRT Power-up Timer Enable bit PWRT enabled
BOR Brown-out Reset Enable bit Brown-out Reset enabled
BORV Brown-out Reset Voltage bits VBOR set to 2.0V
300003 0E WDT Watchdog Timer Enable bit WDT disabled (control is placed on the SWDTEN bit)
WDTPS Watchdog Timer Postscale Select bits 1:128
300005 01 CCP2MUX CCP2 Mux bit CCP2 input/output is multiplexed with RC1
300006 81 STVR Stack Full/Underflow Reset Enable bit Stack Full/Underflow will cause RESET
LVP Low Voltage ICSP Enable bit Low Voltage ICSP disabled
300008 0F CP0 Code Protection bit Block 0 (000200-001FFFh) not code protected
CP1 Code Protection bit Block 1 (002000-003FFFh) not code protected
CP2 Code Protection bit Block 2 (004000-005FFFh) not code protected
CP3 Code Protection bit Block 3 (006000-007FFFh) not code protected
300009 C0 CPB Boot Block Code Protection bit Boot Block (000000-0001FFh) not code protected
CPD Data EEPROM Code Protection bit Data EEPROM not code protected
30000A 0F WRT0 Write Protection bit Block 0 (000200-001FFFh) not write protected
WRT1 Write Protection bit Block 1 (002000-003FFFh) not write protected
WRT2 Write Protection bit Block 2 (004000-005FFFh) not write protected
WRT3 Write Protection bit Block 3 (006000-007FFFh) not write protected
30000B E0 WRTC Configuration Register Write Protection bit Configuration registers (300000-3000FFh) not write protected
WRTB Boot Block Write Protection bit Boot Block (000000-0001FFh) not write protected
WRTD Data EEPROM Write Protection bit Data EEPROM not write protected
30000C 0F EBTR0 Table Read Protection bit Block 0 (000200-001FFFh) not protected from Table Reads executed in other blocks
EBTR1 Table Read Protection bit Block 1 (002000-003FFFh) not protected from Table Reads executed in other blocks
EBTR2 Table Read Protection bit Block 2 (004000-005FFFh) not protected from Table Reads executed in other blocks
EBTR3 Table Read Protection bit Block 3 (006000-007FFFh) not protected from Table Reads executed in other blocks
30000D 40 EBTRB Boot Block Table Read Protection bit Boot Block (000000-0001FFh) not protected from Table Reads executed in other blocks
Hi again Jerry,
The only programmer I have is MicroPro, a USB kit I built a few years back which works faultlessly on everything I've done in the past with my other compiler.
As mentioned before when I write something with the other compiler for the 18F452 (or anything else) it does the job every time.
The hex code you listed shows the same code as my error on the second line so I guess the SF compiler is doing the right thing - so we can assume it is my USB programmer at fault?
Apart from getting another programmer - not quick or easy where I am - what else can I try?
Before I go is there a way to add attachments to a post rather than embed in the text?
Thanks and regards,
Bill
The only programmer I have is MicroPro, a USB kit I built a few years back which works faultlessly on everything I've done in the past with my other compiler.
As mentioned before when I write something with the other compiler for the 18F452 (or anything else) it does the job every time.
The hex code you listed shows the same code as my error on the second line so I guess the SF compiler is doing the right thing - so we can assume it is my USB programmer at fault?
Apart from getting another programmer - not quick or easy where I am - what else can I try?
Before I go is there a way to add attachments to a post rather than embed in the text?
Thanks and regards,
Bill
-
- Swordfish Developer
- Posts: 1471
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
>>...so we can assume it is my USB programmer at fault?
It might be.
I haven't used PBPro in a loooong time, but I just pulled up a hex file compiled with it and the fuse data section is a bit different... it's filling in unused config bytes with 'FF' so the hex data starts at 300000 and is contiguous.
>>Apart from getting another programmer - not quick or easy where I am - what else can I try?
Maybe you just need to manipulate the config data, which is a PITA but can be done a number of ways.
To see if that's the case, open the hex file in a text editor and replace
with this
See if the programmer likes it. If so, there's a few options.
>>Before I go is there a way to add attachments to a post rather than embed in the text?
Not in the forum. As long as things aren't too long, I just usually plop them into a "CODE" block
It might be.
I haven't used PBPro in a loooong time, but I just pulled up a hex file compiled with it and the fuse data section is a bit different... it's filling in unused config bytes with 'FF' so the hex data starts at 300000 and is contiguous.
>>Apart from getting another programmer - not quick or easy where I am - what else can I try?
Maybe you just need to manipulate the config data, which is a PITA but can be done a number of ways.
To see if that's the case, open the hex file in a text editor and replace
Code: Select all
:020000040030CA
:03000100220E0EBE
:02000500018177
:060008000FC00FE00F40E5
Code: Select all
:020000040030CA
:0E000000FF220E0EFF0181FF0FC00FE00F4028
>>Before I go is there a way to add attachments to a post rather than embed in the text?
Not in the forum. As long as things aren't too long, I just usually plop them into a "CODE" block
-
- Swordfish Developer
- Posts: 1471
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
> no doubt that end code will change for each device or fuse configuration...
Yup. You want a solution that will take this into account so you don't have to manually edit the hex files.
The easiest way to deal with this is to get a copy of the hexmate utility, which is a command-line program for manipulating hex files. Hexmate.exe is a utility written by HiTech, and it should be part of the XC8 compiler, which you can download for free from microchip.com. Install it and grab a copy of hexmate.exe. (you can also get a copy of just hexmate at http://www.schmalzhaus.com/Tools/Hexmat ... tions.html)
After you compile the program in SF, open a command prompt and run the following:
That should insert FF's into the first few unused CONFIG bytes. The -O option tells it to modify the original .hex file.
Here's the result
You may have to adjust the commandline path, etc so it can find the utility. You could make a .bat file to do this and assign it as a "programmer" in the SF IDE... that way if you do 'Compile and Program' it'll automatically fix the hex file for you. To do this, save the line below to 'hexmate.bat', create a new programmer in the SF IDE and set the Programmer Filename to 'hexmate.bat' and the parameters to '$hex-filename$'
hexmate.bat
EDIT: I just stumbled across this thread which may be another solution http://www.microchip.com/forums/m538465.aspx
Yup. You want a solution that will take this into account so you don't have to manually edit the hex files.
The easiest way to deal with this is to get a copy of the hexmate utility, which is a command-line program for manipulating hex files. Hexmate.exe is a utility written by HiTech, and it should be part of the XC8 compiler, which you can download for free from microchip.com. Install it and grab a copy of hexmate.exe. (you can also get a copy of just hexmate at http://www.schmalzhaus.com/Tools/Hexmat ... tions.html)
After you compile the program in SF, open a command prompt and run the following:
Code: Select all
C:\>hexmate.exe write.hex -Owrite.hex -fill=ff@0x300000-0x300008
Here's the result
Code: Select all
Line 33 : [XLin] New high address offset : $0030 (New base start address : $00300000)
Line 34 : [Data] Address : $00300000 Data : FF,22,0E,0E,FF,01,81,FF,0F,C0,0F,E0,0F,40
Line 35 : [EndF] *** EOF Record ***
hexmate.bat
Code: Select all
hexmate.exe %1 -O%1 -fill=ff@0x300000-0x300008
Hi Jerry,
That last link is the solution, although a little extra handling to convert the compiled hex to the correct format - but it works!
My programmer is indeed the K128 and I will continue to monitor the site for any updates. I can't thank you enough for your research and help in making this work. I'll do my best to return the compliment to the SF community.
My best regards to you,
Bill
That last link is the solution, although a little extra handling to convert the compiled hex to the correct format - but it works!
My programmer is indeed the K128 and I will continue to monitor the site for any updates. I can't thank you enough for your research and help in making this work. I'll do my best to return the compliment to the SF community.
My best regards to you,
Bill