CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PIC24FV32KA304 #FUSES with bootloader or without can not be

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
micro_debugger



Joined: 08 Oct 2009
Posts: 73

View user's profile Send private message

PIC24FV32KA304 #FUSES with bootloader or without can not be
PostPosted: Sun Apr 23, 2017 4:52 pm     Reply with quote

Hi,
Compiler version 5.070
I'm using the PIC24FV32KA304 with CCS bootloader. That is working very well.
Except of one point. The #fuses in the released devices can not be changed.
Explain here,
I have done one mistake on released already devices, and see that the changing of fuses is not working !!
I can not change in the already released devices the #fuses. I have defined properly:
Code:
#define ROM_WRITE_CAN_MODIFY_CONFIG_BITS

No way. It is not working.
I tried the write_configuration_memory in the core program, just to avoid the bootloader, but it is also not working.

Code:

unsigned int16 f_data;
f_data=0x0018;
write_configuration_memory(&f_data, 2);


Whatever I do, the #fuse is not changing their value.

Any idea to help about that?
Thank you in advance.
BR
Ttelmah



Joined: 11 Mar 2010
Posts: 19216

View user's profile Send private message

PostPosted: Mon Apr 24, 2017 12:31 am     Reply with quote

If the bootloader is going to work, the fuses have to remain those it uses.
If you change the fuses, then the bootloader may no longer work.
This is why you need to work out what fuses you main program needs, and use these for your bootloader.
The main code then should not set the fuses (#FUSES none).

At the end of the day, if you need to change the fuses, then you may need to reprogram the bootloader....

What fuse is involved?. For some changes that do not affect the boot of the chip, there may be a way of changing the chip settings after boot. However if the fuses already in the chip, prevent the configuration from being written, then the fuses can only be changed by a full erase (so reprogramming...).
micro_debugger



Joined: 08 Oct 2009
Posts: 73

View user's profile Send private message

PostPosted: Mon Apr 24, 2017 2:14 am     Reply with quote

HI,
Thank you for your answer. However the bootloader has a dedicated option that allows to change the #fuses (however dont). I tried to change this fuse by hand (I mean reprogram the #fuses on existing loaded bootloader) and everything is working well.

The fuse I'm looking to change it from
Code:
#fuses NOOSCIO

to
Code:
#fuses OSCIO

This change does not affect the bootloader itself, just add one pin I/O instead of CLK out.

According to bootloader documentation it should be possible by defining the
Code:
#define ROM_WRITE_CAN_MODIFY_CONFIG_BITS

what I done in the bootloader, and it is not working.

or it should be also possible by using the function
Code:
write_configuration_memory()

Which is not working as defined.
In this IC, it is possible to change the #fuses "on the fly" as far I understand.
Thank you for any support.
BR
Ttelmah



Joined: 11 Mar 2010
Posts: 19216

View user's profile Send private message

PostPosted: Mon Apr 24, 2017 9:29 am     Reply with quote

I have a suspicion this may not be possible on this chip...
Your chip has the 'Codeguard' security.
Have a look at:
<ww1.microchip.com/downloads/en/DeviceDoc/70005182a.pdf>

If the default has Codeguard enabled, the chip will defend the configuration segment against changes....

What are the fuses the bootloader has selected?.
Print out the fuses from the end of the bootloader list file.
micro_debugger



Joined: 08 Oct 2009
Posts: 73

View user's profile Send private message

PostPosted: Mon Apr 24, 2017 9:43 am     Reply with quote

Hi,
Here it is

Code:
#fuses WRTB             //Boot block write protected
#fuses SOSC             //Secondary oscillator
#fuses SOSC_LOW         //Low-power SOSC circuit is selected
#fuses SOSC_ANALOG      //SOSC pins set for Analog mode for use with a crystal
#fuses IESO             //Internal External Switch Over mode enabled
#fuses EC               //External clock with CLKOUT
#fuses NOOSCIO        //OSC2 is clock output
#fuses CKSFSM           //Clock Switching is enabled, fail Safe clock monitor is enabled
#fuses WDT_SW           //No Watch Dog Timer, enabled in Software
#fuses WDT_NOSL         //Watch Dog Timer, disabled during SLEEP

#fuses BROWNOUT         //Reset when brownout detected
#fuses BORV_MID         //Brown-out Reset set inbetween highest and lowest voltage
//#fuses BROWNOUT_SW    //Brownout controlled by configuration bit in special file register
#fuses LVR              //Low Voltage Regulator Enabled, Controlled in Software
#fuses PUT              //Power Up Timeryu
#fuses MCLR             //Master Clear pin enabled
#fuses LPRCLOW          //Low-Power FRC Low Power and Low Accuracy


The only problem is the
Code:
#fuses NOOSCIO        //OSC2 is clock output


That I need to change, as left it by mistake.

I need to have

Code:
#fuses OSCIO   


Crossed my fingers on my hands and legs ;-)
BR
micro_debugger



Joined: 08 Oct 2009
Posts: 73

View user's profile Send private message

PostPosted: Mon Apr 24, 2017 12:10 pm     Reply with quote

Hi,
I read the fuses from the IC directly, and it shows that (I think) no such lock activated, see picture below

https://drive.google.com/open?id=0BxyNAWdHZ1PobkJyOElZQkNoOG8

BR
micro_debugger



Joined: 08 Oct 2009
Posts: 73

View user's profile Send private message

PostPosted: Mon Apr 24, 2017 1:24 pm     Reply with quote

Hi,
CCS in a rapid time send me update for this bug correction.
It will be included in the next compiler update.
Just testing it.
BR
micro_debugger



Joined: 08 Oct 2009
Posts: 73

View user's profile Send private message

PostPosted: Mon Apr 24, 2017 4:06 pm     Reply with quote

Confirmed
Working perfectly
Thank you CCS and Ttelmah
BR
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group