Skip to main content
Visitor II
April 26, 2024
Question

microcontroller (stm32f407VGT) peripherals => CAN, IC2, SPI and GPIO don't work properly

  • April 26, 2024
  • 4 replies
  • 2190 views

Hello,

I have a problem with my microcontroller (stm32f407VGT). The microcontroller runs correctly in our application for 30 minutes or 5 minutes (times are always different until the error occurs). Then suddenly the peripherals no longer work, e.g. no CAN messages are sent or received, all I2C and SPI buses do not read in correctly, GPIO outputs no longer switch HIGH (e.g.: LED turns on briefly for 300ms and then goes off, even though the LED should stay on for 1 second.

I have already debugged and the microcontroller continues to run normally. There is no hard fault, otherwise the system timer also continues to run normally. I suspect it's not an EMC problem, since the problem doesn't occur periodically in our application.

Does anyone have a suggestion on how I can fix the problem so that the microcontroller runs reliably.

    This topic has been closed for replies.

    4 replies

    Super User
    April 26, 2024

    Hi,

    not clear...when debug is connected, no problem , never ?

    +

    Temperature of chip ...then ?

    +

    Did you check with DSO the VDD 3,3V , clock, etc. stable - when it stops working ?

    Visitor II
    April 26, 2024

    Check the stability of your power supply. Sudden drops or fluctuations in voltage could cause the microcontroller to behave erratically or peripherals to malfunction. If you have made a custom board with the stm32f407VGT, you must check if your PCB has any fault. You can test with a multimeter or a PCB tester: https://www.pcbway.com/project/shareproject/Miniature_PCB_Tester_c2b226d2.html

    PHolz.1Author
    Visitor II
    May 14, 2024

     

    Hi,

    thanks for your tips. I checked the power supply and the voltage is stable. The clock also runs correctly and the temperature of the chip is fine.

    I checked the peripherals again (I2C, SPI and GPIO) and they still worked.

    I have determined that the CAN bus is the problem. After a random time, CAN messages are no longer sent, but messages are still received. Sometimes it happens after 10 minutes or only after an hour. The strange thing is that the microcontroller continues to run normally. No hard fault or other error occurs.

    Is it possible that the mailbox is full?

    Does anyone have a suggestion how I can solve the problem.

    Graduate II
    May 14, 2024

    The Status Registers on the CAN peripheral are available for review, check them. Output telemetry and diagnostic output to a serial port so the debugger doesn't need to be connected but you can observe system state and behaviour.

    PHolz.1Author
    Visitor II
    May 14, 2024

    I have also noticed that the data to be sent is not written to the register (CAN_TDL0R and CAN_TDH0R).

    Super User
    May 14, 2024

    @PHolz.1 wrote:

    I have also noticed that the data to be sent is not written to the register (CAN_TDL0R and CAN_TDH0R).


    how do you observe that?

    As @Tesla DeLorean said, provide diagnostics to give you insight into what's going on; what changes when the problem occurs; etc ...

     

    https://community.st.com/t5/stm32-mcus-products/stm32-debugging-not-available/m-p/673971/highlight/true#M244107

     

    PHolz.1Author
    Visitor II
    May 14, 2024

    I looked at the registers in debug mode.

    Super User
    May 14, 2024

    Remember that a debugger access is just like any other access to those registers.

    Would those registers be expected to read-back what was previously written?