LPCExpresso problem with OM13077

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPCExpresso problem with OM13077

Jump to solution
2,079 Views
gossamer69
Contributor III

I am trying to debug my program in LPCExpresso, but every time debugger comes to following line:

volatile LPC_TIMER_T *timer = LPC_TIMER1;

timer->TC = 0x00;

I get error 15: Target error from Register access: Ee(FF). Redlink interface error 255.

definitions are:

#define LPC_TIMER1         ((LPC_TIMER_T           *) LPC_TIMER1_BASE)

#define LPC_TIMER1_BASE            0x400B8000UL

same code works fine in Keil...

Labels (2)
0 Kudos
1 Solution
1,008 Views
gossamer69
Contributor III

Not really the answer I was looking for .. but I did figure it out in the end. First I kinda expected there is external clock connected to mcu, then in datasheet it says that reset value for async ctrl is 1 which for some reason was 0. After that I was able to enable timer and set timer properties. Anyway, this is what needs to be configure prior to setting timer values:

  LPC_SYSCON_T *sc = LPC_SYSCON;

  sc->PDRUNCFGCLR |= (1<<22); //PLL power up

  sc->AHBCLKCTRLSET[0] |= (1<<1) | (1<<3) | (1<<13);

  sc->CLKOUTDIV = 0x01;

  sc->AHBCLKDIV = 0x01;

  sc->ASYNCAPBCTRL |= 0x01; //enable async APB

  sc->MAINCLKSELB = 0x01;

  LPC_ASYNC_SYSCON_T *ss = LPC_ASYNC_SYSCON;

  ss->ASYNCCLKDIV = 1;

  ss->ASYNCAPBCLKCTRLSET |= (1<<13); //enable timer0 clock

  ss->ASYNCPRESETCTRLCLR |= (1<<13); //timer 0 - clear reset

View solution in original post

0 Kudos
7 Replies
1,008 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Review the example in LPCOpen.The peripheral is not accessible without enabling the clock.

Thanks and regards,

LPCXpresso Support

0 Kudos
1,009 Views
gossamer69
Contributor III

Not really the answer I was looking for .. but I did figure it out in the end. First I kinda expected there is external clock connected to mcu, then in datasheet it says that reset value for async ctrl is 1 which for some reason was 0. After that I was able to enable timer and set timer properties. Anyway, this is what needs to be configure prior to setting timer values:

  LPC_SYSCON_T *sc = LPC_SYSCON;

  sc->PDRUNCFGCLR |= (1<<22); //PLL power up

  sc->AHBCLKCTRLSET[0] |= (1<<1) | (1<<3) | (1<<13);

  sc->CLKOUTDIV = 0x01;

  sc->AHBCLKDIV = 0x01;

  sc->ASYNCAPBCTRL |= 0x01; //enable async APB

  sc->MAINCLKSELB = 0x01;

  LPC_ASYNC_SYSCON_T *ss = LPC_ASYNC_SYSCON;

  ss->ASYNCCLKDIV = 1;

  ss->ASYNCAPBCLKCTRLSET |= (1<<13); //enable timer0 clock

  ss->ASYNCPRESETCTRLCLR |= (1<<13); //timer 0 - clear reset

0 Kudos
1,008 Views
lpcxpresso_supp
NXP Employee
NXP Employee

I suspect, among the other missing setup, you haven't enabled the timer peripheral clock. There's an example timer initialization in the LPCOpen chip library for the LPC5410x. You can download the LPCOpen distribution for this chip here:

http://www.nxp.com/products/software-and-tools/hardware-development-tools/lpcxpresso-boards/lpcopen-...

The new system may require you to create a login in order to download.

Thanks and regards,

LPCXpresso Support

0 Kudos
1,008 Views
gossamer69
Contributor III

Fair point, I will try later on when I get to my board. But basically what you are saying is without enabling the peripheral clock, that part of memory will be inaccessible ?

I guess I am missing this part:

LPC_ASYNC_SYSCON_T *ss = LPC_ASYNC_SYSCON;

ss->ASYNCAPBCLKCTRL |= (1<<13); //enable timer0 clock

ss->ASYNCPRESETCTRLCLR |= (1<<13); //timer 0 - clear reset

Thanks

0 Kudos
1,008 Views
lpcxpresso_supp
NXP Employee
NXP Employee

So what version of LPCXpresso IDE are you using with your LPCXpresso54102 board, and on what host OS? Can you provide your debug log please, as per: The Debug Log ?

Can you also confirm whether the IDE is softloading debug probe firmware into the board, or if your board has pre-programmed firmware in its debug probe? I believe that some of these boards were shipped with older probe firmware preprogrammed, and it is possible this might cause problems.

The simplest way to ensure that the IDE is softloading is to ensure that there is a jumper fitted to the DFULink header (next to the debug probe USB port). For more info see:

Booting LPC-Link2

LPC-Link2 Debug Probe firmware programming

Also do you see this problem using a timer example from LPCOpen, or only with your own code? If only with your own code, what else has you code done before this point in your application? It might also be helpful if you could post a simple example that shows up the problem. How to import/export projects

Regards,

LPCXpresso Support

0 Kudos
1,008 Views
gossamer69
Contributor III

I also made a simplest application which only loads the minimum set of variables, and that crashes as well.

Can anyone try it and see if it is issue with my board or application ?

Thanks

0 Kudos
1,008 Views
gossamer69
Contributor III

Running LPCXpresso v8.2.0 [build 647] on OSX 10.11.6

This is my debug log:

LPCXpresso RedlinkMulti Driver v8.2 (Jun 30 2016 17:51:27 - crt_emu_cm_redlink build 723)

Probe Firmware: LPC-LINK2 CMSIS-DAP V5.112 (NXP Semiconductors)

Serial Number:  A000000002

VID:PID:  1FC9:0090

USB Path: USB_1fc9_0090_fa130000_ff00

Vector catch on SYSRESETREQ signal

Emu(0): Connected&Reset. DpID: 2BA01477. CpuID: 410FC240. Info: <None>

Debug protocol: SWD. RTCK: Disabled. Vector catch: Enabled.

inspected v.2 On-chip Flash Memory /Applications/lpcxpresso_8.2.0_647/lpcxpresso/bin/Flash/LPC5410x_512K.cfx

image 'LPC5410x (512K Flash) Jun 21 2016 11:53:08'

NXP: LPC54102J512  Part ID: 0x00000000

Connected: was_reset=true. was_stopped=false

LPCXpresso Free License - Download limit is 256K

Opening flash driver /Applications/lpcxpresso_8.2.0_647/lpcxpresso/bin/Flash/LPC5410x_512K.cfx

Writing 69332 bytes to address 0x00000000 in Flash

Erased/Wrote page  0-2 with 69332 bytes in 941msec

Flash Write Done

Flash Program Summary: 69332 bytes in 0.94 seconds (71.95 KB/sec)

Stopped (Was Reset)  [Reset from Unknown]

Stopped: Breakpoint #2

Stopped: Breakpoint #1

Stopped: Step (Halt)

Stopped: Step (Halt)

Stopped: Step (Halt)

Stopped: Step (Halt)

Stopped: Step (Halt)

Target error from Register access: Ee(FF). Redlink interface error 255.

Target error from Remove break/watch: Ee(FF). Redlink interface error 255.

I dont have jumper connected on DFULink header on board. Should I fit one ?

My code is as simple as what I posted. Nothing else is running. Rest of the code is compiled but not executed. I commented out all of the entry points from other functions/objects ... So default project, main function that calls timer initialization which fails with the error shown in debug log. Nothing going on before timer except cr_startup_lpc5410x.cpp

0 Kudos