2023-07-04 04:40 AM
Hi!
I am testing CAN communication using STM32F042.
The settings for CAN communication on the same two boards are also set the same.
One board transmits data through CAN communication once per second, and the other board receives data.
If I check the CAN_RX pin (pin no. 21) of the receiving board's stm32F042 with an oscilloscope, I can see the received signal.
But However, the program does not receive it.
Below is the setting and the code for receiving.
Here is parameter setting.
Here is NVIC setting.
HAL_CAN_Start(&hcan); // in main function.
Here is callback function
void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef *phcan)
{
if(HAL_CAN_GetRxMessage(phcan, CAN_RX_FIFO0, &canRxHeader, &canRx0Data[0]) != HAL_OK) {
}
else {
printf("RX : %c%c%c%c%c%c%c%c\r\n", canRx0Data[0], canRx0Data[1], canRx0Data[2], canRx0Data[3], canRx0Data[4], canRx0Data[5], canRx0Data[6], canRx0Data[7]);
}
}
Solved! Go to Solution.
2023-07-05 04:49 AM - edited 2023-07-05 06:35 AM
Hello,
You have to configure correctly the filters otherwise you can't receive any message.
You can inspire from any CAN example provided in CubeF0 firmware. Example: Projects\STM32072B_EVAL\Examples\CAN\CAN_Networking\
2023-07-05 04:49 AM - edited 2023-07-05 06:35 AM
Hello,
You have to configure correctly the filters otherwise you can't receive any message.
You can inspire from any CAN example provided in CubeF0 firmware. Example: Projects\STM32072B_EVAL\Examples\CAN\CAN_Networking\
2023-07-06 05:27 PM
Hi.
Thank you. I resolve it.
2023-07-07 02:30 AM
Hello,
Thank you for the confirmation. Please close this thread.
2023-07-11 05:54 PM
hi
How can I close this thread?
2023-07-12 06:22 AM
Hello,
It was done from our side.
Thank you.