Skip to main content
Visitor II
November 11, 2024
Solved

STM32H723VGT6 FDCAN 0x20 error on trasmission

  • November 11, 2024
  • 1 reply
  • 3585 views

Hi 

I am trying to send some CAN-bus messages from a STM32H723VGT6 mounted on a BIGTREETECH SKR 3 EZ V1.0

I am following this video to send standard CAN messages in external loopback mode (https://www.youtube.com/watch?v=kXyzaaSk6Qs&t=568s&ab_channel=ControllersTech). But whenever I reach the point where I add a message to the TxFifo I get the error 0x20 -> "Parameters error" but I am not sure what could be causing this

Angelo3_0-1731323700247.png

Here are the parameters I set for FDCAN1

Angelo3_1-1731323774525.png

Angelo3_2-1731323798894.png

To avoid additional variables we used the internal clock of the microprocessor, here is the final frequency of the FDcan peripheral

Angelo3_3-1731323888538.png

And the transreceiver mounted on the board is the mcp2542fd-e/sn

 

    This topic has been closed for replies.
    Best answer by mƎALLEm

    1- I don't see a reason to stop the FDCAN after Init:

     

     if(hfdcan1.State != HAL_FDCAN_STATE_READY){
    	 HAL_FDCAN_Stop(&hfdcan1);
     }

     

    2- From stm32h7xx_hal_fdcan.c:

     

     if (hfdcan->State == HAL_FDCAN_STATE_BUSY)
     {
     /* Check that the Tx FIFO/Queue has an allocated area into the RAM */
     if ((hfdcan->Instance->TXBC & FDCAN_TXBC_TFQS) == 0U)
     {
     /* Update error code */
     hfdcan->ErrorCode |= HAL_FDCAN_ERROR_PARAM;
    
     return HAL_ERROR;
     }

     

    -> As you can see in the comment, you didn't allocate memory into RAM for Tx messages.

    You removed the FDCAN Init from the main.c you shared but according to CubeMx Fifo elements number = 0:

    SofLit_0-1731331314348.png

    You need to set it at least to 1.

     

     

    1 reply

    Technical Moderator
    November 11, 2024

    Hello,

    First, you mentioned you are using this board: 


    @Angelo3 wrote:

    Hi 

    I am trying to send some CAN-bus messages from a STM32H723VGT6 mounted on a BIGTREETECH SKR 3 EZ V1.0


    You need to share its schematics.

    + You need to share your code + ioc file.

    Second, if you mean by this HSI, that's not recommended if you are using CAN in Normal mode.


    @Angelo3 wrote:

    To avoid additional variables we used the internal clock of the microprocessor, here is the final frequency of the FDcan peripheral

    Angelo3_3-1731323888538.png


    And the most important question: did you connect another node on the CAN bus?

    Angelo3Author
    Visitor II
    November 11, 2024

    Thank you for the quick reply

    I attached the schematincs of the board. There is a mistake regarding the pins connected to the canbus peripheral. The correct pins are PA11 and PA12 like the default configuration of FDCAN1 from STCubeIde

    I also attached the .ioc file and the main.c file as you requested

    Right now we are just testing the board in external loopback mode, do we still need to have another node connected to the bus?

    Technical Moderator
    November 11, 2024

    Thank you for the sharing.

    According to the schematics, you need to use PB8/PB9 (connected to the tranceiver which is not necessary in LoopBack mode) instead of PA11/PA12 as the latter are used by USB and may external components force the IO levels of the MCU.

    SofLit_0-1731326222360.png

    SofLit_1-1731326284872.png