Skip to main content
VLELE.1
Associate II
January 31, 2020
Question

STM32F103C8 CAN transmit using HAL Cube MX and CUBE IDE

  • January 31, 2020
  • 3 replies
  • 1294 views

Hi all,

I am new to ST.

I am struggling with the attached code.

I am trying to transmit CAN message.

Thanks

This topic has been closed for replies.

3 replies

Karl Yamashita
Principal
February 3, 2020

You'll need to supply more information/code.

1. How are you checking that you are transmitting? CAN bus analyzer, oscilloscope? Is you hardware connected to another CAN node, with terminating resistor?

2. What baud rate are you running at? You need to supply the code that shows MX_CAN_Init() and relevant code so we can see if the bit timing is correct

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
VLELE.1
VLELE.1Author
Associate II
February 3, 2020

Hi Karl,

I am using a DSO as well as CAN tool (PEAK PCAN USB) for checking the messages.

Yes there is 120 ohm termination

I have attached the whole code. [Yes i have named LED-BLINK sorry for that] 

Thanks

Karl Yamashita
Principal
February 3, 2020

Some things i am seeing that are incorrect...

  1. i believe you should call HAL_CAN_Start(&hcan); after you set up the CAN filter.
  2. hcan is already defined in can.c and MX_CAN_Init() is called. So you should be only referring to hcan variable.
  3. You have only 1 can controller and yet i see you defined hcan2. So hcan1 and hcan2 are not valid.

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source