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.
6 years, 6 months ago.
Does this Nucleo board provide CAN Support?
I was looking at the board diagram for the Nucleo-L476RG board and I find pins that seem to support CAN, however based on the peripheralpins.c these serve as alternate function pins. I am not sure what that means. We purchased the discover board which has the same STM MCU, but doesn't have the CAN pins exposed on the board. So before buying this board for testing I just want to make sure the CAN functionality is available on the board not just on the MCU STM32L476.
Thanks, Ajay
Question relating to:
1 Answer
6 years, 6 months ago.
Hello Ajay,
Mbed provides CAN support for this board. As indicated in the pinout pictures and the PeripheralPins.c
file a CAN interface can be setup either at pins PB_8, PB_9 or PA_11, PA_12 (but not both in one program). In mbed this is done simply by creating a CAN object:
CAN myCAN(PB_8, PB_9); // RD pin name, TD pin name //CAN myCAN(PA_11, PA_12); // RD pin name, TD pin name
Then the CAN controller built into the MCU gets configured and connected either to pins PB_8, PB_9 (or PA_11, PA_12). But remember that in order to build a complete CAN node you have to add also a stand alone CAN transceiver (for example an MCP2551 chip) which is neither built into the STM32L476 MCU (neither to other than LPC11C2X series mbed enabled MCUs) nor installed on the board!
For more details have a look at:
Thanks a lot Zoltan for taking the time to respond. I was under the impression that the STM32L476 has CAN support was built into the MCU. If I need the transceiver why does the MCU have CAN pins and what is the purpose of it if it is unable to talk to the CAN bus? I guess I am not clear on that?
Thanks, Ajay.
posted by 01 May 2018CAN is a communication standard. The CAN peripheral of an MCU could process message I/O without CPU usage. You can use this communication standard with many phisycal implementations. The transceiver is a dumb* device, just generates the correct (5V, 12V, 24V, center to edge, edge to edge, etc) differential signal for the bus. So the MCU generates TTL CAN signal and the transceiver converts it to differential signal and drives the bus. Something like an UART TTL to RS232 converter.
- Sometimes it is not so dumb. Some of the transceiver devices could detect CAN traffic and wake up the MCU form deep sleep, etc.
From hardware point of view it's the presence or absence of an on-chip CAN controller what makes the difference between a micro-controller with or without CAN support. To get the feeling how complex such CAN controller could be please have a look at the datasheet of this stand alone CAN controller.
Thanks Zoltan and Mark for taking the time to respond to my queries regarding the CAN functionality. MCP2551 seems like something we could try out. Based on searching how to connect the transceiver to the MCU and the CAN BUS, it seems like pretty straight forward. Do you have any suggestions on things I need to make sure before I go ahead use a simple bread board to tie these components together or if you could point me to a well tested circuit diagram?
Thanks, Ajay
posted by 01 May 2018