News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

How change fuses in bootloader

Started by Frizie, Feb 15, 2024, 11:55 AM

Previous topic - Next topic

Frizie

I'm a beginner when it comes to bootloaders  :-[
Now I have obtained a bootloader for my PIC18F46K22 through Evan.
If I create a Positron program, I can load it into the PIC without a PIC programmer, but via the Tiny Multi Bootloader.

This works fine, but now I want to change a config setting (fuse setting).
But config settings made in Positron are not changed by the bootloader  :o

How can I change the config settings? ???
Can this be done in Positron or does it have to be done in another way?
Ohm sweet Ohm | www.picbasic.nl

trastikata

A well designed bootloader should not allow fuse changes because by changing the fuse settings one can render the bootloader inoperable.

Also depending on how the memory is partitioned I usually lock, when it's possible, the first memory blocks where the bootloader resides. In all cases I put some address checking in the bootloader to prevent it writing in the fuse configuration space and the bootloader space.

The purpose to all this is whatever it happens the customer can always restore the device to its original state and there is no chance bricking the device by using the wrong firmware update.

This  is to explain why you probably won't be able to change fuses when using a commercial bootloader.

Frizie

I understand that Trastikata.
It is also not my intention to change the fuses during the upload with the bootloader, but to change the fuses at the time of programming the bootloader itself.
According to Evan I can reconfigure it in IPE.

Now, I have not worked with the IPE before, I have opened it but I don't get much further than an empty field.
(I pressume that Evan means MPLAB IPE)

Can anyone give me some direction?  ???
Ohm sweet Ohm | www.picbasic.nl

trastikata

Oh I see, I misunderstood your question ... open the MPLAB X IPE, select the targeting PIC and load the HEX file. Go to: Window --> Target Memory Views --> Configuration bits.

CB.jpg

Frizie

I'm a real rookie when it comes to bootloaders AND I should open my eyes further  ::)
Your screenshot showed me that I had something wrong (I couldn't set anything).
Turns out I had to select Advanced mode in Settings first (password = "microchip").

Now I no longer have an empty field (I see now the configuration bits) and I can change these configuration bits.
You just gave me that push with your screenshot, thanks Trastikata  ;D

But now I notice something strange.
I can change the configuration bits in the hex from the bootloader and reprogram the PIC with this changed bootloader into the PIC18F46K22 with the PIC programmer.

For example, I now put on the watch dog timer and changed from INTMCLR to EXTMCLR.
The adjusted settings are accepted fine, but I cannot get the PIC into PLL mode.
Even though I turn on the PLL fuse, the PIC continues to run at 16MHz instead of 64MHz.

What am I overlooking now?
How can I run the PIC at 64MHz?  ???

Ohm sweet Ohm | www.picbasic.nl

trastikata

Are you sure the PLLEN in OSCTUNE is set.

tumbleweed

#6
If you change the CONFIG clock frequency from the way the bootloader was built (16 to 64MHz), the serial port will likely no longer be the correct baud rate setting.
You can always change the osc setting at runtime in your app.

Also, if you enable the watchdog and the bootloader wasn't built to support it you could have problems there too.


Frizie

Wow, right again Trastikata!  :)
Now it is running at 64MHz internal oscillator.
I think I can now manage on my own as far as the bootloader is concerned.
Thanks again, you are of great value to this forum, not only to me but to many.

Also thanks Tumbleweed for the tips.
Ohm sweet Ohm | www.picbasic.nl