Showing results for 
Search instead for 
Did you mean: 

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

Associate II


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.

Chief II


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 ?

If you feel a post has answered your question, please click "Accept as Solution".
Senior II

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:



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.

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Associate II

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

@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 ...


Associate II

I looked at the registers in debug mode.

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?