Skip to main content
Explorer II
August 19, 2024
Question

STM32 MCU CAN clock register default value

  • August 19, 2024
  • 2 replies
  • 1448 views

Hello folks,

Anyone knows the default CAN clock frequency on STM32H753 MCU when powered on, assuming the CAN bit timing register (CAN_BTR) was not set by FW during the initialization?

If this value would be a random, could it be changed depending on reflow temperature?

Best,

    This topic has been closed for replies.

    2 replies

    Super User
    August 19, 2024

    Short answer: 500 kbit/sec

    The default register values are shown in the reference manual. In this case.

    TDK_1-1724100247423.png

    The reference manual does this math for you:

    TDK_0-1724100187352.png

    Note that the FDCAN is disabled after reset and the firmware will need to enable it. Programs typically set the timing at this time.

    Also note there is no CAN_BTR register on this chip. At least, I can't find it and it's not showing up in a search.

    fourhesAuthor
    Explorer II
    August 19, 2024

    Thanks. Without setting this register, CAN communication was working mostly and sometimes it didn't work. I wonder where this difference is coming from. If the default value is 0A33 which makes 500kbps, it makes sense as I see it. However, sometimes it does not communicate whatever reason. Is this because FDCAN was not enabled after power cycle? Also, if we do soft reset (not hard power cycle), would the previous register value will be retained?

    Will be great if you can share your experience. Trying to solve this puzzle. This behavior seems to be random to me.

    Super User
    August 19, 2024

    It's a software bug, you need to look at the code and debug and not guess at solutions. We're not going to be able to solve it here (at least not without seeing the code), it's specific to your code. When your code is "not communicating", debug, look at register values, see where cpu execution is at, etc, to determine the root cause.

    Register values are not retained after a soft reset. They are reset to their reset values (except for some things like RTC).

    Super User
    August 19, 2024

    Hi,

    Afaik there is no default can frequency, it depends on what you set or what you want.

    That's the result from the clock for the can module and the bit timing you set -> making the can bit rate.

    What your version of Cuba is doing, if you set/change nothing...just try, to find out.

    fourhesAuthor
    Explorer II
    August 19, 2024

    Thanks AScha.3. Does this mean not setting up the value would never work?