Changing the SYSCLK Rate on the chipKit Max32

afrenett
Posts: 9
Joined: Thu Aug 04, 2016 4:38 pm

Re: Changing the SYSCLK Rate on the chipKit Max32

Post by afrenett » Mon Aug 08, 2016 6:54 pm

After messing around in the IPE a while, I have an idea (a good idea? I don't know). In the MPLAB IPE there is an option to "Fill Memory", where one can write directly to memory addresses. Could I modify the information already in the configuration registers using this function? (i.e. read the value currently in the register, figure out the value with the modified bits, and write the modified word to the same address?)

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Changing the SYSCLK Rate on the chipKit Max32

Post by majenko » Mon Aug 08, 2016 7:56 pm

No, you can't. The config bits share the same flash page as part of the bootloader. To write to them you have to first erase the page they are in, and that kills the bootloader.

I have a program that will allow you to modify the config bits on a running MAX32. It's the ConfigBits example that comes with my Flash library:

https://github.com/MajenkoLibraries/Flash

Use it very very carefully - you can easily brick your board with it and have to re-flash the bootloader (which you can download from the MAX32 page on Digilent's site).

Changing the PLL settings is not a good idea since it would render the serial port inoperable (unless you can calculate the new strange baud rate to use), but you can use it for other things like changing the watchdog time, turning clock switching on and off, etc.

It needs the ANSI library installing, which is bundled with the example sketch - copy it to be with the rest of your libraries - and it needs a real ANSI capable terminal program, not MPIDE's serial monitor.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

afrenett
Posts: 9
Joined: Thu Aug 04, 2016 4:38 pm

Re: Changing the SYSCLK Rate on the chipKit Max32

Post by afrenett » Wed Aug 10, 2016 2:48 pm

What program would you recommend I use to run the code? And will do - I won't touch the PLL bits.

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Changing the SYSCLK Rate on the chipKit Max32

Post by majenko » Wed Aug 10, 2016 3:47 pm

MPIDE, Arduino IDE + chipKIT Core or UECIDE. It won't work in anything else.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

afrenett
Posts: 9
Joined: Thu Aug 04, 2016 4:38 pm

Re: Changing the SYSCLK Rate on the chipKit Max32

Post by afrenett » Wed Aug 10, 2016 7:16 pm

You said MPIDE doesn't have a complex enough terminal, and the chipKit core for the Arduino IDE doesn't support the Max32 board. That leaves UECIDE. When I open the .ino file in UECIDE though, it cannot find the xc.h library (which I can't find either). Am I loading the program correctly, or should I be doing something else?

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Changing the SYSCLK Rate on the chipKit Max32

Post by majenko » Wed Aug 10, 2016 9:17 pm

You said MPIDE doesn't have a complex enough terminal,
That doesn't mean you can't use an external terminal program such as PuTTY, TeraTerm, etc.
and the chipKit core for the Arduino IDE doesn't support the Max32 board
It most certainly does!
When I open the .ino file in UECIDE though, it cannot find the xc.h library
They you may not have installed the right plugins. xc.h is part of the compiler.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

afrenett
Posts: 9
Joined: Thu Aug 04, 2016 4:38 pm

Re: Changing the SYSCLK Rate on the chipKit Max32

Post by afrenett » Thu Aug 11, 2016 2:41 pm

Got it - was using the wrong compiler. The ConfigBits seems to work, thanks!!

Post Reply