Connect with us

lpc1768 cpu dosn't work properly

Discussion in 'Microcontrollers, Programming and IoT' started by hamed tahamtan, Sep 22, 2017.

Scroll to continue with content
  1. hamed tahamtan

    hamed tahamtan

    3
    0
    Sep 22, 2017
    hi guys

    I was designed a lpc1768 board for myself but I have some bad and unusual problem with it .

    As I assembled the bored I programed it with a jlink segger programmer and it was programmed very well. But when I tried to run the program I understood that the microcontroller didn't work well. in fact the board some times works very well and some times didn't work at all.

    I tried to debug the microcontroller with a jtag debugger and keil software and I catch on some problems.

    in the file "system_LPC17xx.c" in the line 523 the cpu will stope

    the folowing codes are lines that cpu stops at then

    --------------------------------------------------------------------------------------------------------------------------------

    LPC_SC->CLKSRCSEL = CLKSRCSEL_Val; /* Select Clock Source for PLL0 */

    LPC_SC->PLL0CFG = PLL0CFG_Val; /* configure PLL0 */
    LPC_SC->PLL0FEED = 0xAA;
    LPC_SC->PLL0FEED = 0x55;

    LPC_SC->PLL0CON = 0x01; /* PLL0 Enable */
    LPC_SC->PLL0FEED = 0xAA;
    LPC_SC->PLL0FEED = 0x55;
    while (!(LPC_SC->PLL0STAT & (1<<26)));/* Wait for PLOCK0 */

    LPC_SC->PLL0CON = 0x03; /* PLL0 Enable & Connect */
    LPC_SC->PLL0FEED = 0xAA;
    LPC_SC->PLL0FEED = 0x55;
    while ((LPC_SC->PLL0STAT & ((1<<25) | (1<<24))) != ((1<<25) | (1<<24))); /* Wait for PLLC0_STAT & PLLE0_STAT */

    --------------------------------------------------------------------------------------------------------------------------------------

    and the error command is coming below



    ------------------------------------------------------------------

    **JLink Warning: CPU could not be halted
    ***JLink Error: Could not start CPU core. (ErrorCode: -1)
    **JLink Warning: CPU could not be halted
    ***JLink Error: Could not start CPU core. (ErrorCode: -1)
    **JLink Warning: CPU could not be halted
    ***JLink Error: Could not start CPU core. (ErrorCode: -1)
    ***JLink Error: CPU is not halted
    **JLink Warning: CPU could not be halted
    ***JLink Error: Can not read register 15 (R15) while CPU is running
    ***JLink Error: Can not read register 16 (XPSR) while CPU is running
    **JLink Warning: CPU could not be halted
    ***JLink Error: Could not start CPU core. (ErrorCode: -1)
    **JLink Warning: CPU could not be halted
    ***JLink Error: Could not start CPU core. (ErrorCode: -1)
    **JLink Warning: CPU could not be halted
    ***JLink Error: Could not start CPU core. (ErrorCode: -1)
    **JLink Warning: CPU could not be halted
    ***JLink Error: Could not start CPU core. (ErrorCode: -1)
    ***JLink Error: Can not read register 0 (R0) while CPU is running
    ***JLink Error: Can not read register 1 (R1) while CPU is running
    ***JLink Error: Can not read register 2 (R2) while CPU is running
    ***JLink Error: Can not read register 3 (R3) while CPU is running
    ***JLink Error: Can not read register 4 (R4) while CPU is running
    ***JLink Error: Can not read register 5 (R5) while CPU is running
    ***JLink Error: Can not read register 6 (R6) while CPU is running
    ***JLink Error: Can not read register 7 (R7) while CPU is running
    ***JLink Error: Can not read register 8 (R8) while CPU is running
    ***JLink Error: Can not read register 9 (R9) while CPU is running
    ***JLink Error: Can not read register 10 (R10) while CPU is running
    ***JLink Error: Can not read register 11 (R11) while CPU is running
    ***JLink Error: Can not read register 12 (R12) while CPU is running
    ***JLink Error: Can not read register 13 (R13) while CPU is running
    ***JLink Error: Can not read register 14 (R14) while CPU is running
    ***JLink Error: Can not read register 15 (R15) while CPU is running
    ***JLink Error: Can not read register 16 (XPSR) while CPU is running
    ***JLink Error: Can not read register 17 (MSP) while CPU is running
    ***JLink Error: Can not read register 18 (PSP) while CPU is running
    ***JLink Error: Can not read register 20 (CFBP) while CPU is running



    ---------------------------------------------------------------------------------------------------------------------





    At first I Thought that it is because of the microcontroller and I changed it , but the problem is still continued.

    Now I guess that it should be because of the crystal oscillator but I'm not sure because that some times it works .

    thank you for every help
     
  2. kellys_eye

    kellys_eye

    4,275
    1,147
    Jun 25, 2010
    Did you MAKE the board yourself?
     
  3. hamed tahamtan

    hamed tahamtan

    3
    0
    Sep 22, 2017
    yes
     
  4. hamed tahamtan

    hamed tahamtan

    3
    0
    Sep 22, 2017
    I changed the crystal oscillator and my problem solved
    thank you every one
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-