This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Cortex-M not found error, failure in erasing LPC1768

Hi every one

I'm using an LPC1768 core.
I wrote a code for UART0 operation and used PLL to change clk frequency to 96 MHz in order to generate 115200 baudrate.
the code downloaded to target successfully but i'm not able to load any program because of "Cortex-M not found ... " error.
The device is not erasable whether with KEIL or SEGGER softwares.
I tried Flash magic tool for erasing by serial bus but it makes an autobaud error.

Please help me to recover my chip :D
thanks

And could anybody help on detecting my fault in coding that leads this problem:

#include "pconf.h"

void Init_Uart0(void){
        LPC_PINCON->PINSEL0= 0x5<<4;           // Initializing P0.2 and P0.3 as TXD0 and RXD0
        LPC_PINCON->PINMODE0=0x0<<4;                          // Default Pullup or Pull down
        LPC_PINCON->PINMODE_OD0= 00<<2;                                   // Open drain mode disabled
        LPC_SC->PCLKSEL0= 01<<6;   // Peripheral clock for UART0 is equal with CPU clock=96MHz
        LPC_UART0->LCR= 0x83;                              // 8-bit data, 1 stopbit, no parity, DLAB=1 to access DLL/M
        LPC_UART0->FDR= 0xF7;                              //Divaddval=7 , Mulval=15
        LPC_UART0->DLL= 0x23;                              // BaudRate = 115200
        LPC_UART0->DLM= 0;
        LPC_UART0->LCR= 0<<7;                        // DLAB=0 in order to access RBR and THR
        }

void Send_byte(unsigned char data)
{
        LPC_UART0->THR = data;
        while((LPC_UART0->LSR & 1<<5)==0);           // Wait until THR becomes empty
}

void Send_str(unsigned char const *str)
{
        while(1)
        {
                if ( *str == '\0') break;
                Send_byte(*str++);
        }
}


int main(void)
{
        Pll_Conf();
        Init_Uart0();
        Send_str("Adib");
}

this header follows PLL sequence mentioned in 17xx manual

void Pll_Conf(void)
{
        LPC_SC->PLL0CON= 0x00;
        LPC_SC->PLL0FEED= 0xAA;
        LPC_SC->PLL0FEED= PLLFEED_2;

        LPC_SC->CLKSRCSEL= 0x01;             // Main Oscillator with frequency =12MHz selected.

        LPC_SC->PLL0CFG=  MSEL_0<<0 | NSEL_0<<16;  // Configuring multiplier and divider value
        LPC_SC->PLL0FEED= PLLFEED_1;
        LPC_SC->PLL0FEED= PLLFEED_2;

        LPC_SC->PLL0CON= 0x1;                      // Enabling PLL0
        LPC_SC->PLL0FEED= PLLFEED_1;
        LPC_SC->PLL0FEED= PLLFEED_2;

        LPC_SC->CCLKCFG = PLLCLKDIV;                // Cpu clk divider by 3; cclk = 96MHz

        while((LPC_SC->PLL0STAT & 1<<26)==0);       // Wait for PLL0 to achieve lock

        LPC_SC->PLL0CON= 0x2;                                           // Connect PLL0
        LPC_SC->PLL0FEED= PLLFEED_1;
        LPC_SC->PLL0FEED= PLLFEED_2;
}

0