I was programming lpc2148 using max232, crystal 11.0592MHz at 2400 baudrate using flash magic,but when i loaded the below code the problem of "operation failed ,Can't Autobaud" comes in the picture. So, now how to erase the chip. should i change crystal to 12MHz or it doesn't matter?? else what changes i have to make??? Please help help!!!
CODE::
/****************************************************************************** * * WinARM Demo P0.16 blink * *****************************************************************************/
#include "types.h" #include "LPC214x.h" #include "config.h" #include "armVIC.h"
#define IOPINS016 16 /****************************************************************************** * * Function Name: lowInit() * * Description: * This function starts up the PLL then sets up the GPIO pins before * waiting for the PLL to lock. It finally engages the PLL and * returns * * Calling Sequence: * void * * Returns: * void * *****************************************************************************/ static void lowInit(void) { // set PLL multiplier & divisor. // values computed from config PLLCFG = PLLCFG_MSEL | PLLCFG_PSEL;
// enable PLL PLLCON = PLLCON_PLLE; PLLFEED = 0xAA; // Make it happen. These two updates PLLFEED = 0x55; // MUST occur in sequence.
// setup the parallel port pin IO0CLR = (1<<IOPINS016); // clear the ZEROs output IO0SET &= ~(1<<IOPINS016); // set the ONEs output IO0DIR =(1<<IOPINS016); // set the output bit direction
// wait for PLL lock while (!(PLLSTAT & PLLSTAT_LOCK)) continue;
// enable & connect PLL PLLCON = PLLCON_PLLE | PLLCON_PLLC; PLLFEED = 0xAA; // Make it happen. These two updates PLLFEED = 0x55; // MUST occur in sequence.
// setup & enable the MAM MAMTIM = MAMTIM_CYCLES; MAMCR = MAMCR_FULL;
// set the peripheral bus speed // value computed from config.h VPBDIV = VPBDIV_VALUE; // set the peripheral bus clock speed }
/**/ static void sysInit(void) { lowInit(); // setup clocks and processor port pins
// set the interrupt controller defaults #if defined(RAM_RUN) MEMMAP = MEMMAP_SRAM; // map interrupt vectors space into SRAM #elif defined(ROM_RUN) MEMMAP = MEMMAP_FLASH; // map interrupt vectors space into FLASH #else #error RUN_MODE not defined! #endif
VICIntEnClear = 0xFFFFFFFF; // clear all interrupts VICIntSelect = 0x00000000; // clear all FIQ selections VICDefVectAddr = (uint32_t)reset; // point unvectored IRQs to reset() }
static void _delay(uint32_t N) { for (uint32_t i=0; i<N;i++); }
int main(void) { sysInit(); for (;;) { IO0CLR = (1<<IOPINS016); // clear the ZEROs output _delay(900000); IO0SET = (1<<IOPINS016); // set the ONEs output _delay(900000); }
return 0; }
1) You post source code, but fails to notice that text directly above the input message box that tells you to place source code inside "pre" tags.
2) Your source code doesn't seem to perform any serial communication, so what does your source code have to do with any auto-bauding? So we have to assume you mean that you get autobaud errors when trying to run Flash Magic - not when trying to interface with your code. But Flash Magic is intended to be run before your code unless you have blocked Flash Magic using code protect.
3) Flash Magic have a specific input field where you can tell the exact crystal you are using. Have you entered a good value there?
4) There is a specific pin that is sampled when the processor boots, and tells it if it should start any program already downloaded into the processor, or if the factory-supplied boot loader should wait and listen for transfers on the serial port - have you activated this pin before releasing the reset signal?
5) Have you made sure that you haven't activated any code protect, which blocks the boot loader from waiting for Flash Magic to connect?
6) Have you managed any serial communication at all, or have you managed to transfer a program once, and after that you can't do any more communication?
Awesome job there following the code posing instructions.
Perhaps you could use JTAG via a U-Link and erase it that way?
sir, i have specified exact crystal frequency 11.0592MHz in flashmagic, even i have pulled P0.14 pin low to start bootloader. i have loaded above code only which i assume doesn't have any code protect activation. i was able to just transfer the program once after that i was not able to communicate with flashmagic.
"which i assume doesn't have any code protect activation."
So did you leave the code protect bytes untouched? Or what value got written to these bytes?
i left code protect bytes untounched...
i think PLL initialization has confused the lpc2148 and has got malfunctioned or should i connect 12MHz crystal..
PLL initialization inside your program doesn't matter - the Flash Magic upgrade process means you catch the program on reset, so it never enters your code.
But that is only true if you didn't manage to program any lock bits - have you still not checked what values you might have programmed into the lock bits? You are aware that the lock bits are just four bytes of data within the normal address space meaning that any program you download that doesn't reserve this space can place data or processor instructions there?
sir, i have seen hex file, the address doesn't go till 0X000001FC. So, now to see the data at lock bits