Skip to main content
Essayator
Associate II
Mar 13, 2022 7:52 PM UTC
Solved

Hello, I'm a beginner, I try to retrieve values from a sensor by i2c, but I can't, I'm brought back to this code that I don't understand since I've never done assembler: ldr sp,=_stack /* Set stack pointer */

..

This topic has been closed for replies.
TDK
TDKBest answer
Mar 13, 2022 8:32 PM UTC

That is the start of the reset handler. Read RCC->CSR bits to determine why the chip reset. Possibly a watchdog issue. The watchdog does not stop in debug mode by default.

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

6 replies

TDK
TDKBest answer
Mar 13, 2022 8:32 PM UTC

That is the start of the reset handler. Read RCC->CSR bits to determine why the chip reset. Possibly a watchdog issue. The watchdog does not stop in debug mode by default.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Essayator
EssayatorAuthor
Associate II
Mar 13, 2022 8:37 PM UTC

Thank you for your answer, can you tell me how to fix the problem because I am coding in c and my code is supposed to read data from a sensor at an i2c address

TDK
Mar 13, 2022 8:49 PM UTC

I have some suggestions in my previous post.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Essayator
EssayatorAuthor
Associate II
Mar 13, 2022 8:52 PM UTC

how to read this bit  RCC->CSR bits

TDK
Mar 13, 2022 9:02 PM UTC

If you are using STM32CubeIDE, when you're in debug mode, open the SFRs tab and scroll to the RCC peripheral and read the values in the CSR register. Compare those against what is shown in the reference manual to determine the source of the reset.

In the "SFRs" view. (Window -> Show View -> SFRs).

"If you feel a post has answered your question, please click ""Accept as Solution""."
Essayator
EssayatorAuthor
Associate II
Mar 13, 2022 9:13 PM UTC

Here is what I find in the rcc:

Peripheral: RCC

Base address: 0x40021000

there is no value