4 months, 1 week ago.

Nucleo CAN2 channel don't work

Hi, i have one nucleo board L496ZG which have 2 CAN channels but i can use CAN1 without problems, the CAN2, at any pin which are available for this peripheral, don't work. Not in tx and not in rx. The code is the same which i use with CAN1. Anyone know the problem and help me? Thank's

Comment on this question

2 Answers

4 months, 1 week ago.

I'm not sure this is the correct answer, but ...
The https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/TARGET_STM32L4/can_device.h source says ...

#define CAN_NUM 1 // Number of CAN peripherals present in the STM32 serie

It seems CAN2 is not supported on the STML4 devices.

Thank's Yoshi for asnwer, but i have view the mcu datasheet and the CAN channels are 2, so if you see this document, you can see the pin definition for CAN 2 channel. https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L496xG/TARGET_NUCLEO_L496ZG/PeripheralPins.c I don't have find the specific L496ZG target definitions, but i think logic which the definitions are connected to the mcu specifications. So, otherwise, if it's how you think, i have a big problem because i need two CAN channels.

posted by Neri Tiziano 12 Jun 2019
4 months, 1 week ago.

The basic mbed code really only supports the one channel in ST. However, you are free to customize your mbed build and add the necessary setup to get it working. I suspect you can derive a second class from the basic CAN class. The ST devices have a unique control setup for the 2nd CAN as it slaves to the primary CAN control internal mechanism. ST has reference documents on their website on this. Or alternatively you can see if the ST CUBE MX software can supply some automated code setup for you.


You need to log in to post a question