Skip to main content
Ss.61
Associate III
May 4, 2021
Solved

CAN BUS TX & RX example (stm32f042g6u8) , How to create project using CUBEMX?

  • May 4, 2021
  • 3 replies
  • 5931 views

I try to create a project based on CAN bus but the CAN option is disable in CUBEMX ide.

*Controller - stm32f042g6u8 

*Cube mx ide version - V 4.24

  • i want to know how to create a CAN BUS project using cubemx & without it,
  • Examples are suggested for better understanding
This topic has been closed for replies.
Best answer by TDK

Here is one example for STM32F0 with CAN:

https://github.com/STMicroelectronics/STM32CubeF0/blob/4390ff6bfb693104cf97192f98c3dc9e3a7c296a/Projects/STM32072B_EVAL/Examples/CAN/CAN_Networking/Src/main.c

I don't see any for the STM32F042, but the code should be very similar.

3 replies

TDK
Super User
May 4, 2021

You can hover over something that is grayed out to find out why. In this case:

0693W00000ANLqJQAX.png 

So go into SYS to swap pins, then you can enable CAN.

"If you feel a post has answered your question, please click ""Accept as Solution""."
TDK
TDKBest answer
Super User
May 4, 2021

Here is one example for STM32F0 with CAN:

https://github.com/STMicroelectronics/STM32CubeF0/blob/4390ff6bfb693104cf97192f98c3dc9e3a7c296a/Projects/STM32072B_EVAL/Examples/CAN/CAN_Networking/Src/main.c

I don't see any for the STM32F042, but the code should be very similar.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Ss.61
Ss.61Author
Associate III
May 5, 2021

Thank you very much for your input i will try as per your input.