7 years, 9 months ago.

Nucleo-F746ZG Identifier "CAN" is undefined

Hello everybody. I have a problem in my code. An error occurs during the compilation. Identifier "CAN" is undefined "CAN can(PD_0,PD_1)" in: CAN can1(PD_0, PD_1);

include the mbed library with this snippet

#include "mbed.h"

DigitalOut myled(LED1);
CAN can1(PD_0, PD_1);

int main() {
    while(1) {
        myled = 1; // LED is ON
        wait(0.2); // 200 ms
        myled = 0; // LED is OFF
        wait(1.0); // 1 sec
    }
}

2 Answers

7 years, 9 months ago.

Hi. In deed, the Controller Area Network doesn't seem to be implemented yet in the mbed.h library for the Nucleo boards. I know that a few users have built libraries to use, so you'll most probably need to include another library in order to make it work. Check out this page for example :https://developer.mbed.org/users/hudakz/code/CANnucleo/ It doesn't seem to work with your board tho. I'd try to browse the website for such a library if I were you. Or try to contact someone who wrote a similar library.

Hope it helped you in any way.

7 years, 9 months ago.

Try using this library. It worked great for me. https://developer.mbed.org/users/hudakz/code/CANnucleo/