Skip to main content
Visitor II
June 11, 2024
Solved

FDCAN on STM32G0

  • June 11, 2024
  • 2 replies
  • 2909 views

Hi,

I am trying to communicate via FDCAN with a board equipped with a STM32G0 by using this library https://github.com/owennewo/SimpleCAN

I already tested it successfully with both STM32H743 and STM32H723 but I am having troubles with the G0 

When I try to send a message from the G0 I get error code 200 back from the serial logs

Does anyone have an idea of why is this happening?

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

    Hello,

    For PlatformIO: we don't support such a platform. Please use ST tools, mainly CubeMx/HAL in order to support you efficiently.

    Since loopback mode is working fine, I suspect two issues:

    - Hardware issue: connection or something else ..

    - Clock config: Need to use HSE with an external crystal instead of HSI.

    What about bit timing config: CAN prescaler, NBS1 and NBS2 values?

    Please consider all above points I pointed out.

    2 replies

    Technical Moderator
    June 11, 2024

    Hello and welcome to the ST community,

    First, STM32H7 and and STM32G0 don't have the same FDCAN implementation.

    Second, what HW are you using? could you please provide more details?

    Angelo3Author
    Visitor II
    June 11, 2024

    Yes but I was hoping that the library was able to astract the different implementations based on the hals

    Here is the board I am using https://github.com/bigtreetech/EBB/tree/master/EBB%20CAN%20V1.1%20(STM32G0B1)/EBB42%20CAN%20V1.1

    It is equipped with a STM32G0B1CBT6

    Technical Moderator
    June 11, 2024

    Hello,

    Thank you for the answer.

    First I invite you using CubeMx to create the project and configure the FDCAN from the GUI based on G0 product.

    Second, from your shcematics: https://github.com/bigtreetech/EBB/blob/master/EBB%20CAN%20V1.1%20(STM32G0B1)/EBB36%20CAN%20V1.1/Hardware/BIGTREETECH%20EBB36%20CAN%20V1.1-SCH.pdf the transceiver used on your board is SN65HVD1050DR which is 1Mb/s max baudrate. So you can't exceed 1Mb/s with FDCAN.

     

    Technical Moderator
    June 11, 2024

    Third: did you try Loopback mode? it's interesting to use this mode in order to locate the issue.

    Fourth: What is the clock source you are using? and what is the node connected on the other side of your CAN bus?

    PS: HAL_FDCAN_ERROR_FIFO_FULL ((uint32_t)0x00000200U) /*!< Get element from empty FIFO. -> seems there is no transmitted frame until the FIFO is get full!

    Angelo3Author
    Visitor II
    June 11, 2024

    Thank you so much for the quick reply

    1. We are using PlatformIO and a StLink programmer to configure the MCU
    2. We set the baudrate of all the nodes to 125000 which shoud be well under 1Mb/s
    3. Yes we tried loopback mode and it seems to be able to receive its own messages
    4. PlatformIO already supports this board, (here are the config files https://we.tl/t-2GpoxtnjeU). From the board json file the clock frequency should be "f_cpu": "64000000L".
    5. The other node connected to the bus is a BTT Kraken equipped with a STM32HT723VG. We connected an oscilloscope in between the two and we are able to see and decode the wave coming from the H7 but it's only radio silence from the G0 
    mƎALLEmAnswer
    Technical Moderator
    June 11, 2024

    Hello,

    For PlatformIO: we don't support such a platform. Please use ST tools, mainly CubeMx/HAL in order to support you efficiently.

    Since loopback mode is working fine, I suspect two issues:

    - Hardware issue: connection or something else ..

    - Clock config: Need to use HSE with an external crystal instead of HSI.

    What about bit timing config: CAN prescaler, NBS1 and NBS2 values?

    Please consider all above points I pointed out.