Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 4 months ago.
Cannot get CAN working with Nucleo F072RB
I have a Nucleo F072RB board which has a single CAN bus. I have 2 boards and looking to pass really basic communications from one to the other. I have not been able to use any of the examples, each time I get an error indicating that the class CAN is not setup. I don't seem to be able to find a CAN.h that works with the board, or any information to write the code without it. Any help would be greatly appreciated as I am very new to coding.
Question relating to:
2 Answers
9 years ago.
Hi Paul,
It looks like the CAN API has not yet been written for the ST processors.
Looking at the library sources (see the SDK docs), these are the chips for which the CAN API has been written:
libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/TARGET_LPC11CXX/can_api.c libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC15XX/can_api.c libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/can_api.c libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC23XX/can_api.c libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC2460/can_api.c libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/can_api.c libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088_DM/can_api.c libraries/mbed/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/can_api.c
The NXP chips' can_api.c files look to be 250-350 lines of code each, while the Renesas one is about 775 lines of code.
Perhaps you could encourage someone to write the CAN API HAL functions for the ST CAN controller?
The ST libraries have support for the CAN peripherals; look in libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F0/stm32f0xx_hal_can.h and its sister file stm32f0xx_hal_can.c
9 years ago.
Hi Paul,
Seems mbed does not provide CAN API for the NUCLEO boards yet. However, if NUCLEO-F103RB or STM32F103C8T6 boards are available to you then you might give CAN_Nucleo_Hello a try. Have a look also at the CANnucleo library. I think also the associated wiki pages might help you.
Zoltan