9 years, 8 months ago.

Getting Error L6218E in my program

Hi all,

I am trying to use the deepsleep and a wake-up timer in the LPC11U68 using LPCXpresso11U68 platform to compile it. I followed an example here but I keep getting the same error. Here is the code I have done so far (I imported the WakeUp library in my program folder):

Deepsleep and WakeUp timer

#include "mbed.h"
#include "WakeUp.h"
 
DigitalOut  led(P2_2);

void deepsleep(void) 
{
    // PCON[PD] set to deepsleep
    LPC_PMU->PCON = 0x1;
 
    // SRC[SLEEPDEEP] set to 1 = deep sleep
    SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
 
    // Power up everything after powerdown
    LPC_SYSCON->PDAWAKECFG &= 0xFFFFF800;
 
    // wait for interrupt
    __WFI();
}
  
int main() {
    
    //The low-power oscillator can be quite inaccurate on some targets
    //this function calibrates it against the main clock
    WakeUp::calibrate();
    
    led = 1;
    wait(0.5);
    led = 0;
    
    //Set wakeup time for 2 seconds
    WakeUp::set_ms(2000);
    
    //Enter deepsleep, the program won't go beyond this point until it is woken up
    deepsleep();
     
    while(1) {
    
        led = !led;
        wait(1);
        
     }
  }

It blinks first and then enters in a sleep mode. After 2s, it should wake up and enter the while loop and blink the whole time. This is just to test the wakeup timer. However I keep getting the same errors (Error L6218E):

"Undefined symbol WakeUp::set_ms(unsigned) (referred from main.cpp.LPC11U68.o)" "Undefined symbol WakeUp::calibrate() (referred from main.cpp.LPC11U68.o)"

I tested before the deepsleep function with an external interrupt and it works perfectly. It is when I introduce the wake up that it happens those two errors. Please, anyone can help me out with this problem? Thanks anyway.

2 Answers

9 years, 8 months ago.

considering the WakeUp Library, if we look at the cpp files from Erik -> https://developer.mbed.org/users/Sissors/code/WakeUp/file/f3adba7cf7c4/Device

Each Wakeup....cpp file begins with an #ifdef TARGET_...

So, there 2 possibilities :

-1- this library isn't for your platform -2- try to use the good Define to allow it to compile.

As actually no define is related to your platform, then the cpp code isn't compiled and then the linker can not find this code to link it with the main.

Hi, thanks for your answer. I don't understand whta you mean by using the Define. Can you tell me which part of my code to modify?

posted by Javier Garach 21 Apr 2015

if your platform is compatible with the TARGET_LPC11XX_11CXX then Try add before your the include of "WakeUp.h" this directive :

#define TARGET_LPC11XX_11CXX

but really not shure it will works as I'm not shure these platforms use the same pins/code

posted by Raph Francois 21 Apr 2015
9 years, 8 months ago.

The most likely code that can be re-used is that of the LPC11u24. So in the LPC11u24 file in the WakeUp library replace the #ifdef TARGET_LPC11U24, by #ifdef TARGET_LPC11U68.

Please report back if that compiles and if it works. If yes I will add it to the library. But I don't have the 11u68 myself so I cannot test it.