Isaac, e-mail sent.
Anyone have any idea what needs to be done to modify either of the included files to run at 40 MHz instead of 4 or 20? I looked over both hex files and there are only a few lines difference between them, but I have no idea what I'm actually looking at.
David
MCS has not provided any source code (that I am aware of) for their bootloader, so I think it would be pretty hard to modify it to run at double the speed. If you don't mind it not working directly through the MCS interface, then you could modify the assembly source code given by the Tiny Pic Bootloader, located here: http://www.etc.ugal.ro/cchiculita/so...bootloader.htm
And run it beside your MCS.
.... But Maybe,
To still use MCS's bootloader hex, you could think about switching PLL settings on the fly in your code. See: http://www.picbasic.co.uk/forum/showthread.php?t=4093
Maybe you could set the low power interrupt to change it back to 20 mhz when it powers down? Kind of backwards, but might work.
Walter
I've looked into this a little, but as I have never used mplab and try to avoid assembly my first attempts have failed. If no one has any better ideas, I'll try to look into it more next week. Thanks for the help
David
Ok, this works for me. I'm using microcode stuidios 18f4550 20mhz hex bootloader file, and change the speed to 48mhz on the fly using Darrel's RTconfig.inc file.
Will post code tonight for a 18f4520
Code:DEFINE OSC 48 ' Lets work at 48 MHz with our 20mhz bootloader! define LOADER_USED 1 @ #include "RTconfig.inc" ;Darrel's write to configs while running inc tempbyte var byte redled var PORTD.1 ;----Change back to low speed for bootloader at reset @ ReadConfig?CB _CONFIG1L, _tempbyte ; Read CONFIG1L tempbyte.0=1 tempbyte.1=1 @ WriteConfig?CB _CONFIG1L, _tempbyte ; Write CONFIG1L @ ReadConfig?CB _CONFIG1H, _tempbyte ; Read CONFIG1H tempbyte.1=0 @ WriteConfig?CB _CONFIG1H, _tempbyte ; Write CONFIG1H pause 1000 ; Give bootloader time to do it's thing ;----Accelerate up to 48mhz for your code @ ReadConfig?CB _CONFIG1L, _tempbyte ; Read CONFIG1L tempbyte.0=0 tempbyte.1=0 @ WriteConfig?CB _CONFIG1L, _tempbyte ; Write CONFIG1L @ ReadConfig?CB _CONFIG1H, _tempbyte ; Read CONFIG1H tempbyte.1=1 @ WriteConfig?CB _CONFIG1H, _tempbyte main: pause 500 high redled pause 500 low redled goto main end
Last edited by ScaleRobotics; - 20th March 2010 at 18:11.
Well, the 18F4520 is a little harder, because it has a 4x pll with no pre/post scalers. Since your only external OSC options using the MCS bootloader hex files (as is) is either 4mhz, or 20mhz, that does not help.
So I wanted to try a 10mhz crystal. The closest I had was 8mhz. But I had some luck with that.
Checking the difference between the two hex files (4mhz and 20mhz) using the PicKit2, there were two addresses that differed. The first one (7D06) is where the baud speed is set. For a 4mhz crystal, this should be set to 0E0C hex, with 0E as an assembly command, and the last 0C as the SPBRG setting. To change this for a 10mhz chip (without 4xpll for now), should be 0E20.
Setting this to 0E19 was correct for my 8mhz crystal, and allowed me to use the MCS bootloader hex at 8mhz. That's promising.
Now here is where it gets a little fuzzier. The only other address that changes from 4mhz to 20mhz is 7E70. For a 4mhz, it is set to 0F, for a 20mhz it is set to 1F. It looks like it sends this to the serial port, from what I can make out of the disassembler I used. Not sure what it does with this info.....
I tried setting everything for 8mhz with 4xpll directly using the PicKit2, but the bootloader would not work. I have not tried doing it with run time configs. And I may well be missing a setting.
I have a little more playing to do. Maybe you can test it running at 10mhz as a first step. If that worked, we could try to do something like I did above with the 18f4550, and switch speeds using Darrel's run time config include file.
Walter
Last edited by ScaleRobotics; - 22nd March 2010 at 08:32.
Bookmarks