Created Sat, 08 Mar 2014 18:28:19 +0000 by Jay Long
Sat, 08 Mar 2014 18:28:19 +0000
I have been trying to change the Uno32's DEVCFG registers using mpide with the "#pragma config" statements that I have seen in many examples online (See here http://www.microchip.com/forums/m404723.aspx)
But I can not seem to get them to compile using MPIDE (yet they compile fine on MPLAB X)
for example see :
#pragma config FPLLMUL = MUL_20//Error clears with this line commented out
This yields the following compiler error: sketch_mar08a.cpp:5:24: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://www.chipkit.org/forums> for instructions.
And I have notified chipkit about this as suggested.
But am I wrong in thinking that this code should work ? Other people just seem to include plib and p32xxxx and off they go so !? Where are the declarations for these config bits I see people using? I've read the relevent pic32 data sheets and I know what they are doing I just don't see where they have been declared! I cannot see them in the plib or p32xxxx header (aside from the DEVCFGbit structures.. but these are only the bit count for each of these attributes it seems ?)
All advice appreciated and thanks for your time !
Sat, 08 Mar 2014 21:43:57 +0000
You can't do what you want to do. The simple reason is that the config settings are in the bootloader, not the sketch. You will have to compile a new version of the bootloader with your own settings in it and install that into the chip with a hardware programmer (pickit3, chipKIT PGM, etc).
Sat, 08 Mar 2014 22:17:53 +0000
Firstly thanks for taking the time to answer. That makes sense, so the examples I see online of people using these "#pragma configs" would be strictly people using a chipKit3 with MPLAB for example ? Because I have seen a number of people doing this in the source file (admittedly they were using a more grown up IDE). Basically what I'm asking is, in each case I saw online of people being able to set these config bits (FPLLMUL etc . such as in the link in my original post) , this person would have had to compile a new bootloader etc. as you pointed out ? Even though they have plenty of :
#pragma config FPLLODIV=DIV_1
#pragma config FPLLMUL=MUL_20
#pragma config FPLLIDIV=DIV_1
.. etc.. going on in their main source file ?
Sorry if this is all a little basic ! , Is there any document you know of that points this sort of thing out ? I've read the data sheet (albeit obviously not well enough) but it's the putting of the knowledge into practice here I'm struggling with!
Again my thanks for your time majenko!
Sat, 08 Mar 2014 22:54:52 +0000
When working in MPLAB or MPLAB-X you typically don't have a bootloader. The "sketch", or main program, is all there is, so you must put your configuration settings into it to be able to configure the chip.
When you're working with chipKIT boards and similar, that don't require a hardware programmer to be used, you are using it with a bootloader. In that situation the config settings are already there, as they are part of the bootloader code.
Sat, 08 Mar 2014 23:51:32 +0000
Thanks so much for this that really clears things up!
Sun, 09 Mar 2014 01:02:01 +0000
If you want to take a look at the bootloader code, it's located here: [url]https://github.com/chipKIT32/PIC32-avrdude-bootloader[/url]
All the settings are in the file bootloaders/BoardConfig.h