Initializing CAN object results in MbedOS error 0x80FF0100

#include “mbed.h”

DigitalOut myled(LED1);

int main() {
CAN can1(D15, D14);

printf("RTC example\n"); 
set_time(1387188323); // Set RTC time to 16 December 2013 10:05:23 UTC
printf("Date and time are set.\n");

while(1) {
    time_t seconds = time(NULL);
    printf("Time as a basic string = %s", ctime(&seconds));
    myled = !myled;      
    wait(1);
}

}

I’m using STM32L476RG nucleo board, I ran the above code in the online compiler, the code runs find without initializing the CAN object but when I added that line to initialize the CAN object, it shows me this fault:

  • MbedOS Error Info ++
    Error Status: 0x80FF0100 Code: 256 Module: 255
    Error Message: Fatal Run-time error
    Location: 0x80056BB
    Error Value: 0x0
    For more info, visit: mbedos-error
    – MbedOS Error Info –
    can ESR 0x6200.0021 + timeout status 0

does anyone know why?

Hi Andre,

I try can example:
https://os.mbed.com/docs/mbed-os/v5.15/apis/can.html#can-hello-world
with Online compiler and the board you have and compiles without problems.
On the above code you already initialize Can with the line
CAN can1(D15, D14);
So with the line you got the fault? Could you specify what is the critical code?

Thanks,
Pekka