I have been trying to find boot_loader for my dsPIC33FJ32MC202.
After some search I found this nice boot-loader, with easy GUI.
The Problem Is, I need to manually set the Oscillator Configuration.
I checked dsPIC33FJ family reference and found out examples of initialization code. So, here is my initialization code, to setup HS oscillator at 20MHz and PLL to generate 80Mhz Fosc.
Code:
// Select Internal FRC at POR
_FOSCSEL(FNOSC_FRC);
// Enable Clock Switching and Configure POSC in XT mode
_FOSC(FCKSM_CSECMD & OSCIOFNC_OFF & POSCMD_XT);
main()
{
// Configure PLL prescaler, PLL postscaler, PLL divisor
PLLFBD=30; // M=32
CLKDIVbits.PLLPOST=0; // N2=2
CLKDIVbits.PLLPRE=0b00010; // N1=4
// Initiate Clock Switch to Primary Oscillator with PLL
(NOSC=0b011)
// Wait for Clock switch to occur
while (OSCCONbits.COSC != 0b011)
}
The problem is my Bootloader Firmware is in ASM, so I need to convert above code to ASM. Any help Please?
It does not. Download the C30 lite compiler from microchip and use it to compiler the C code. In the process it will generate a .asm file. You may save to set a flag on the compiler to keep it from removing the file when it is done with it.