2024-02-15 11:45 AM - last edited on 2024-02-16 12:25 AM by SofLit
Hello,
I've started to develop with the Riverdi STM32 Embedded Display and I'm trying to use the CAN BUS to display data, but unfortunately I can't. I'm not receiving any data. The CAN on the board is a FDCAN and I've set it to classic, because that's the function I need to use. I'm not receiving any data. The baud rate is set to 500kbit/s as I need it, but whatever I send to the board via the CAN BUS, I'm not receiving it. I need to receive from any CAN BUS ID. I'm also trying to find information on how to send data properly between the Main -> model. I've found some information but it's 2-3 years old and I could use a little more help.
Thanks a lot.
Solved! Go to Solution.
2024-02-20 06:19 AM
thanks everyone, i found the problem after doing some other research, the buffer for fifo0 must be setter
hfdcan1.Init.RxFifo0ElmtsNbr = 1; // 1 is the minimum that must be for it to receive data in the FIFO0 otherwise param error and nothing enters.
2024-02-15 12:01 PM
Perhaps filter setting or configuration are wrong? Show code, use the </> format tool
Assume perhaps next to no one here has this board, perhaps Riverdi has their own forum or support channels?
Review FDCAN examples in CubeH7 for relevant DISCO or EVAL boards.
2024-02-15 12:15 PM
void MX_FDCAN1_Init(void)
{
/* USER CODE BEGIN FDCAN1_Init 0 */
/* USER CODE END FDCAN1_Init 0 */
/* USER CODE BEGIN FDCAN1_Init 1 */
/* USER CODE END FDCAN1_Init 1 */
hfdcan1.Instance = FDCAN1;
hfdcan1.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
hfdcan1.Init.Mode = FDCAN_MODE_NORMAL;
hfdcan1.Init.AutoRetransmission = DISABLE;
hfdcan1.Init.TransmitPause = DISABLE;
hfdcan1.Init.ProtocolException = DISABLE;
hfdcan1.Init.NominalPrescaler = 1;
hfdcan1.Init.NominalSyncJumpWidth = 13;
hfdcan1.Init.NominalTimeSeg1 = 65;
hfdcan1.Init.NominalTimeSeg2 = 14;
hfdcan1.Init.DataPrescaler = 25;
hfdcan1.Init.DataSyncJumpWidth = 1;
hfdcan1.Init.DataTimeSeg1 = 2;
hfdcan1.Init.DataTimeSeg2 = 1;
hfdcan1.Init.MessageRAMOffset = 0;
hfdcan1.Init.StdFiltersNbr = 1;
hfdcan1.Init.ExtFiltersNbr = 0;
hfdcan1.Init.RxFifo0ElmtsNbr = 0;
hfdcan1.Init.RxFifo0ElmtSize = FDCAN_DATA_BYTES_8;
hfdcan1.Init.RxFifo1ElmtsNbr = 0;
hfdcan1.Init.RxFifo1ElmtSize = FDCAN_DATA_BYTES_8;
hfdcan1.Init.RxBuffersNbr = 0;
hfdcan1.Init.RxBufferSize = FDCAN_DATA_BYTES_8;
hfdcan1.Init.TxEventsNbr = 0;
hfdcan1.Init.TxBuffersNbr = 0;
hfdcan1.Init.TxFifoQueueElmtsNbr = 0;
hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;
hfdcan1.Init.TxElmtSize = FDCAN_DATA_BYTES_8;
if (HAL_FDCAN_Init(&hfdcan1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN FDCAN1_Init 2 */
/* Configure standard ID reception filter to Rx buffer 0 */
sFilterConfig.IdType = FDCAN_STANDARD_ID;
sFilterConfig.FilterIndex = 0;
sFilterConfig.FilterType = FDCAN_FILTER_RANGE;
sFilterConfig.FilterConfig = FDCAN_FILTER_TO_RXFIFO0;
sFilterConfig.FilterID1 = 0x000;
sFilterConfig.FilterID2 = 0x7FF;
sFilterConfig.RxBufferIndex = 0;
if(HAL_FDCAN_ConfigFilter(&hfdcan1, &sFilterConfig) != HAL_OK)
{
Error_Handler();
}
if(HAL_FDCAN_Start(&hfdcan1) != HAL_OK)
{
Error_Handler();
}
if(HAL_FDCAN_ActivateNotification(&hfdcan1, FDCAN_IT_RX_FIFO0_NEW_MESSAGE, 0) != HAL_OK)
{
Error_Handler();
}
/* USER CODE END FDCAN1_Init 2 */
}
Hello Tesla DeLorean,
yes, it could be that my configuration or filter is wrong, so here is some of my code. As for Riverdi, I've already written to them to get more information, but they don't have a forum, so I'm waiting.
I've been trying to solve my problem for a while and I can't find a solution. I'd like to find a recent and complete tutorial for programming this type of board. My experience of programming with an embedded screen is new.
Thank you for your help.
2024-02-15 01:06 PM
Their MCU is dual core: STM32H757. Make sure you assign the CAN to the proper core.
2024-02-16 12:23 AM
Before going ahead with the code, is there a CAN transceiver on the board?
If yes, what is the node you've connected on the bus to transmit data to your board?
How did You connect CAN_H and CAN_L?
Is that possible to share your CAN schematics part? at least a diagram?
2024-02-16 05:18 AM
@SofLit Their web page says: "Fully independent 2xCAN FDs Applicable in industrial and automotive area."
https://riverdi.com/product/7-inch-lcd-display-stm32h7-frame-rvt70hssfwn00
2024-02-16 05:49 AM
i know the problem it's not hardware but more with my code so i search a solution or tutorial for FDCAN and the stm32H757 with screen
2024-02-16 05:51 AM
Ok since the board features CAN transceivers, (and apart of previous questions) you need also to check the two termination resistors of 120 ohm connected to the bus.
Check also the wires continuity of CAN_H and CAN_L on the transceivers' pins.
What is your FDCAN ker clock?
Please provide your ioc file.
2024-02-16 05:55 AM
@Frankydoody wrote:
i know the problem it's not hardware but more with my code
How are you sure? which tests you did for this?
2024-02-19 05:14 AM
good morning,
yes, i'm very sure that it's not the hardware, but the software that's the problem. the board i use is the one from Riverdi. I tested the components that could be faulty and everything was ok. So I know and I'm convinced that my problem is software and if I can find an updated tutorial on FDCAN and touchgfx that would be perfect. All I'm trying is to receive CAN messages from a 500kbit/s CAN classic and simply display the ID on the screen for testing purposes. The code I've published comes from MX and I've confirmed that it's configured in 500kbit/s.
Thanks