View previous topic :: View next topic |
Author |
Message |
iw2nzm
Joined: 23 Feb 2007 Posts: 55
|
Bootloader doesn't work anymore |
Posted: Wed Oct 17, 2007 3:31 am |
|
|
Hello,
today is happened a strange thing.
I have a PIC18F4520 on a remote board and for months (literally) I programmed it through the CCS bootloader on a RS485 link.
Yesterday I formatted the lap top due to a system crash and reinstalled CCS compiler.
Now I can still program the PIC but it doesn't execute the new code. Actually, after programming the oscillator fails. The behavior leads me to guess there is a problem on #org directives. After programming the bootloader launches the actual code but if it's jump to a wrong location I suspect the clock will fail.
I'm sure 100% I haven't done any change to both bootloader and my application code.
The CCS version is the same (4.025), obviously.
What damn could be happened?
What can I do to find out the reason of the trouble?
Thanks
Marco / iw2nzm |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Oct 17, 2007 10:59 am |
|
|
Quote: |
I have a PIC18F4520 on a remote board and for months (literally)
I programmed it through the CCS bootloader on a RS485 link.
I'm sure 100% I haven't done any change to both bootloader and my
application code. |
If your application code hasn't changed, then what have you been
programming into the PIC for several months ? Your statements
above seem to contradict each other.
Quote: | What can I do to find out the reason of the trouble? |
Try to re-create the problem on your lab bench with another board.
Possibly just start over. Re-install the bootloader in the PIC.
Then test it. See if you can now download code OK. Then install
the new board in the remote location. |
|
|
Guest
|
|
Posted: Wed Oct 17, 2007 1:10 pm |
|
|
If the oscillator stops, then it is probably being disabled. It is probably being switched to another mode. The datasheet suggests that these configuration bits can be changed by the program. An accidental write to that memory location could do that. Maybe the boot loader or the application tries to set these bits according to the compiled code. If you don't specify the OSC mode in the #FUSES directive, you are going to get a default and that may not agree with your hardware. MPLAB will also choose a default if it isn't specified. MPLAB also lets you set these bits in the "configuration" window. By reinstalling you may have gone back to different settings that the ones that were set in the previous installation. |
|
|
iw2nzm
Joined: 23 Feb 2007 Posts: 55
|
|
Posted: Thu Oct 18, 2007 12:40 am |
|
|
PCM programmer wrote: |
If your application code hasn't changed, then what have you been
programming into the PIC for several months ? Your statements
above seem to contradict each other.
|
Of course my application code hasn't changed since the day before the HD formatting and the day after. In other words in the last two days. I'm sure of this because I develop code on the laptop... and it was the one I formatted!
Quote: | Try to re-create the problem on your lab bench with another board. |
I did it. I have several boars with the same chip. The bootloader answer at power-up and I can program the PIC. After that it doesn't run the code, indeed.
Quote: | Possibly just start over. Re-install the bootloader in the PIC.
Then test it. See if you can now download code OK. Then install
the new board in the remote location. |
This is the first thing I did. I re-installed the bootloader on the same PIC and tried several new PICs. So I don't think it's an hardware problem.
Thanks,
Marco / iw2nzm |
|
|
iw2nzm
Joined: 23 Feb 2007 Posts: 55
|
|
Posted: Thu Oct 18, 2007 12:45 am |
|
|
Anonymous wrote: | If you don't specify the OSC mode in the #FUSES directive, you are going to get a default and that may not agree with your hardware. MPLAB will also choose a default if it isn't specified. MPLAB also lets you set these bits in the "configuration" window. By reinstalling you may have gone back to different settings that the ones that were set in the previous installation. |
Thanks to you too.
The #fuses are all defined in the source code. The bootloader and the application code share the same fuses configuration.
I also checked the MPLAB settings (it reads them from the code however).
I can't figure out what may be the differences of this installation versus the previous one.
Bye
Marco / iw2nzm |
|
|
iw2nzm
Joined: 23 Feb 2007 Posts: 55
|
|
Posted: Thu Oct 18, 2007 3:40 am |
|
|
Quote: | I can't figure out what may be the differences of this installation versus the previous one. |
I figured out.
It's my fault. I included the "bootloader.h" CCS default header in the main bootloader code and changed it to fit the modified BL. I had to include a copy of that file in the same folder of the code. After reinstall I have the default CCS code.
So I must change again the LOADER_SIZE and LOADER_END.
I admit I don't fully understand how to select the right values.
Once compiled my own bootloader (based on CCS one, but with some changes) what are the steps I have to do to properly configure the #org directive?
Thanks
Marco / iw2nzm |
|
|
|