Skip to main content
Explorer
February 15, 2024
Solved

fdcan on Riverdi STM32H7 Embedded Display 7"

  • February 15, 2024
  • 8 replies
  • 10448 views

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.

    This topic has been closed for replies.
    Best answer by Frankydoody

    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.

    8 replies

    Graduate II
    February 15, 2024

    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.

    Explorer
    February 15, 2024

     

     

    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. 

    Super User
    February 15, 2024

    Their MCU is dual core: STM32H757. Make sure you assign the CAN to the proper core.

     

    Technical Moderator
    February 16, 2024

    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?

    Super User
    February 16, 2024

    @mƎALLEm 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

    PavelA_0-1708089383551.png

     

    Technical Moderator
    February 16, 2024

    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.

    Super User
    February 19, 2024

    >Now I just need to find the right parameters

    Great! Use the debugger, step into HAL_FDCAN_Init and find where it returns the error.

     

     

    FrankydoodyAuthorAnswer
    Explorer
    February 20, 2024

    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.

    Explorer II
    January 9, 2025

    Hi @Frankydoody I am trying to do the same thing, if you can share the code that would be great

    Graduate
    March 29, 2024

    I also started the development with an embedded Riverdi STM32 display. In the example from TouchGFX, all peripherals are configured on one M7 core.
    Are you using two cores in your development? Did you manage to configure the core-M4?