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.
4 years, 11 months ago.
Problem with the use of the CAN class.
Hello I have a problem with this, I am trying to use the CAN-BUS in the NXP OM13094 expansion for the LCPXpresso54608 board and when I try to compile an error ocurred: "Unknown type name 'CAN'". I think that this error is due to the fact that the development board does not have CAN communication but that it has the expansion. The problem is that the expansion isn't in mbed library and you can't used. Does anyone know how to help me? Thank you.
1 Answer
4 years, 11 months ago.
Hi José, I have only some tips because I have not experience with NXP boards.
Your board already have a CAN interface. You can check the page 6 here https://www.nxp.com/docs/en/data-sheet/LPC546XX.pdf or when you look on the pinout of your board, you can see some CAN pins https://os.mbed.com/platforms/LPCXpresso54608/
- P1_18-CAN1-RD
- P1_17-CAN1-TD
- P3_19-CAN0-RD
- P3_18-CAN0-TD
But for complete usable CAN-BUS you need a CAN transceiver like is TJA1059 contained on your Dual CAN transceiver Shield. https://www.nxp.com/docs/en/user-guide/UM11035.pdf So you not need a library for your shield, because it is only transceiver from CAN RD / TD to differential pair CAN-H / CAN-L. You need a driver/library for CAN interface of you LCPXpresso54608 because your problem with "Unknown type name 'CAN'" looks like Mbed standart CAN.Api does not support CAN interface on your board.
- On github I found https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MCU_LPC546XX/drivers/fsl_mcan.h maybe someone from NXP can explain you what you can do.
- If you want to test your shield, you can connect your CAN shield to your Nucleo-F446RE by wires (because different pinout).
- If all fail you can buy another CAN Shield/modul with State-alone CAN controller (only example MCP2515) and CAN transceiver (only example MCP2551 or TJA1050) and connect it to your board via SPI. Something like this https://robotdyn.com/can-bus-shield-for-arduino.html but ofc for this variant you need a library.
Best regards
J.
Thank you for your help Jan, I think that the library in github ( https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MCU_LPC546XX/drivers/fsl_mcan.h ) must work but I dont know how to use it really well so I am looking for help in that. Thanks again and regards.
posted by 10 May 2019