About CAN communicaton with STM32F042
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-07-04 4: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.
- Labels:
-
CAN
-
STM32F0 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-07-05 4:49 AM - edited ‎2023-07-05 6: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\
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-07-05 4:49 AM - edited ‎2023-07-05 6: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\
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-07-06 5:27 PM
Hi.
Thank you. I resolve it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-07-07 2:30 AM
Hello,
Thank you for the confirmation. Please close this thread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-07-11 5:54 PM
hi
How can I close this thread?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-07-12 6:22 AM
Hello,
It was done from our side.
Thank you.
