2011-04-10, 13:35:33
(This post was last modified: 2012-12-22, 14:11:31 by Mikael Gustavsson.)
Hi,
i am experimenting with dsLoader on Explorer 16 board.
With 24FJ128GA010 i tried 19200 and 115200 baud rated successfully.
Thanks! I like especially that dsLoader sits in high addresses.
With ds33FJ256GP710 i did changes:
.equ __33FJ256GP710, 1 ;xxx device
; .equ USE_UART1, 1 ;xxx uncomment to use uart1
.equ USE_UART2, 1 ;xxx uncomment to use uart2
dsLoader works fine. BUt my test application with config settings
_FOSCSEL (FNOSC_FRC & // Select Internal FRC at POR
IESO_OFF); // Two-speed Oscillator Startup disabled
_FOSC (FCKSM_CSECMD & // Only clock switching enabled
OSCIOFNC_OFF & // OSC2 is clock O/P
POSCMD_XT); // Primary Oscillator in XT mode
and :
void EnablePLL_XT (void)
{
// Configure PLL prescaler, PLL postscaler, PLL divisor
// Fcy = Fosc/2; Fosc = Fin * (M / (N1 * N2)) = 8MHz * (40 / 4) = 80MHz
PLLPRE = 0; // N1 = 2
PLLFBD = 38; // M = 40
PLLPOST = 0; // N2 = 2
__builtin_write_OSCCONH(0x03); // Initiate Clock Switch to Primary
__builtin_write_OSCCONL(0x01); // Oscillator with PLL (NOSC = 0b011)
while (COSC != 0b011) {}; // Wait for Clock switch to occur
while(LOCK != 1) {}; // Wait for PLL to lock
}
is not working. It worked when loaded directly with Explorer 16 board built-in PICkit2 programmer. Obviously osc config did not suit.
But after i changed dsLoader config bits like this:
config __FOSC, FCKSM_CSECMD & OSCIOFNC_OFF & POSCMD_XT
because i want to use XT_PLL oscillator in my application, now
there is a problem: after loading dsLoader with PICkit2, "Check for BL" found it and first loading of test application is successful (it works also now). But any attempt to reload application fails.
When "Check for BL" -> Searching for bl . .
Found PIC24HJ128GP210A fw ver. 0.13.0
Wrong pic detected(62)/selected(197), aborting
I tried to reduce communication speed to 19200 and increase initial timeout to 10000 with no success.
I think oscillator remains in XT_PLL mode and new runs of dsLoader now are at the wrong speed. I think problem could be solved if dsLoader first checked and disabled XT_PLL.
Dmitri
i am experimenting with dsLoader on Explorer 16 board.
With 24FJ128GA010 i tried 19200 and 115200 baud rated successfully.
Thanks! I like especially that dsLoader sits in high addresses.
With ds33FJ256GP710 i did changes:
.equ __33FJ256GP710, 1 ;xxx device
; .equ USE_UART1, 1 ;xxx uncomment to use uart1
.equ USE_UART2, 1 ;xxx uncomment to use uart2
dsLoader works fine. BUt my test application with config settings
_FOSCSEL (FNOSC_FRC & // Select Internal FRC at POR
IESO_OFF); // Two-speed Oscillator Startup disabled
_FOSC (FCKSM_CSECMD & // Only clock switching enabled
OSCIOFNC_OFF & // OSC2 is clock O/P
POSCMD_XT); // Primary Oscillator in XT mode
and :
void EnablePLL_XT (void)
{
// Configure PLL prescaler, PLL postscaler, PLL divisor
// Fcy = Fosc/2; Fosc = Fin * (M / (N1 * N2)) = 8MHz * (40 / 4) = 80MHz
PLLPRE = 0; // N1 = 2
PLLFBD = 38; // M = 40
PLLPOST = 0; // N2 = 2
__builtin_write_OSCCONH(0x03); // Initiate Clock Switch to Primary
__builtin_write_OSCCONL(0x01); // Oscillator with PLL (NOSC = 0b011)
while (COSC != 0b011) {}; // Wait for Clock switch to occur
while(LOCK != 1) {}; // Wait for PLL to lock
}
is not working. It worked when loaded directly with Explorer 16 board built-in PICkit2 programmer. Obviously osc config did not suit.
But after i changed dsLoader config bits like this:
config __FOSC, FCKSM_CSECMD & OSCIOFNC_OFF & POSCMD_XT
because i want to use XT_PLL oscillator in my application, now
there is a problem: after loading dsLoader with PICkit2, "Check for BL" found it and first loading of test application is successful (it works also now). But any attempt to reload application fails.
When "Check for BL" -> Searching for bl . .
Found PIC24HJ128GP210A fw ver. 0.13.0
Wrong pic detected(62)/selected(197), aborting
I tried to reduce communication speed to 19200 and increase initial timeout to 10000 with no success.
I think oscillator remains in XT_PLL mode and new runs of dsLoader now are at the wrong speed. I think problem could be solved if dsLoader first checked and disabled XT_PLL.
Dmitri