Skip to main content
KMew
Senior III
Sep 20, 2022 3:48 PM UTC
Question

CAN Communication: Can't Receive Message

I am attempting to use my STM32H7B3I-EVAL evaluation board to send and receive CAN communication messages. I am communicating with a Vector CANalayzer (16.0, VN1630A). The CANalyzer is being used both to display messages received from the evaluation board, as well as transmit its own data and send it to the evaluation board.

I am currently running the following C code attached to this.

The CANalyzer sees the data that is being sent in the bode for lines 111-138 in the code. However, when I try to receive data from the CANalyzer and make an LED blink on the evaluation board, it does not work.

CANalyzer settings:

0693W00000Svp2xQAB.png0693W00000Svp3MQAR.png 

0693W00000Svp2BQAR.png 

The data I'm sending from the CANalyzer:

Message ID: 0x123

Data Length: 8

Data: Alternates between 0x2233445566778899 to 0x1223344556677889 every 2 seconds

I'm unsure why this code is successfully sending data to the CANalyzer but not receiving the data sent from it.

Have I not configured the Rx properly?

This topic has been closed for replies.

9 replies

Javier1
Principal
Sep 20, 2022 3:50 PM UTC

are you using a canbus transceiver?

show us a picture of your setup

hit me up in https://www.linkedin.com/in/javiermuñoz/
KMew
KMewAuthor
Senior III
Sep 20, 2022 8:55 PM UTC

Hello Javier0693W00000SvpupQAB.jpg,

Thank you for the response. I am using the built-in CANbus transceiver on the evaluation board. I am communicating to the CANalyzer via a DB9 cable, as shown in the picture. I have verified the wiring (since I am successfully sending data from the evaluation board to the CANalyzer)

KMew
KMewAuthor
Senior III
Sep 20, 2022 3:54 PM UTC

0693W00000Svp5SQAR.jpg 

Hello Javier,

Thank you for the response. I am using the built-in CANbus transceiver on the evaluation board. I am communicating to the CANalyzer via a DB9 cable, as shown in the picture. I have verified the wiring (since I am successfully sending data from the evaluation board to the CANalyzer)

Tesla DeLorean
Guru
Sep 20, 2022 9:52 PM UTC

>>Have I not configured the Rx properly?

Use Unique Filter numbers, that way they don't overwrite / replace each other.

Perhaps Have a broad/open one that catches every thing rather than be selective, until you have something working.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
KMew
KMewAuthor
Senior III
Sep 20, 2022 11:13 PM UTC

Hello,

Thank you for the reply!

I apologize if this is an obvious question, but how do I make it more broad/open? What do I have to change, specifically?

Tesla DeLorean
Guru
Sep 20, 2022 11:57 PM UTC
 /* Configure Rx filter */
 sFilterConfig.IdType = FDCAN_STANDARD_ID;
 sFilterConfig.FilterIndex = 0; // Multiple, and different
 sFilterConfig.FilterType = FDCAN_FILTER_MASK;
 sFilterConfig.FilterConfig = FDCAN_FILTER_TO_RXFIFO0;
 sFilterConfig.FilterID1 = 0x000; // Compare == ?
 sFilterConfig.FilterID2 = 0x000; // Mask &=
 if (HAL_FDCAN_ConfigFilter(&hfdcan, &sFilterConfig) != HAL_OK)
 {
 /* Filter configuration Error */
 Error_Handler();
 }
 
...
 
 /* Start the FDCAN module */
 if (HAL_FDCAN_Start(&hfdcan) != HAL_OK)
 {
 /* Start Error */
 Error_Handler();
 }
 
 if (HAL_FDCAN_ActivateNotification(&hfdcan, FDCAN_IT_RX_FIFO0_NEW_MESSAGE, 0) != HAL_OK)
 {
 /* Notification Error */
 Error_Handler();
 }
...

Or perhaps looks at using HAL_FDCAN_ConfigGlobalFilter() ?

HAL_FDCAN_ConfigGlobalFilter(&hfdcan, FDCAN_ACCEPT_IN_RX_FIFO1, FDCAN_ACCEPT_IN_RX_FIFO0, FDCAN_REJECT_REMOTE, FDCAN_REJECT_REMOTE);

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..