cancel
Showing results for 
Search instead for 
Did you mean: 

I have a strange phenomenon in stm32f103

Jlim.1
Associate II

Hello

I have a hw configuration that uses mpu6050, lora chip, gps, and bluetooth using stm32f103 mcu. I use lithium polymer 3.7v 1300mah for power to board.

It doesn't make sense to me, but it's like this.

After downloading the firmware via stlink, mpu6050, lora, gps, and blueetooth work well. In this state, the mpu6050 and GPS will not work if the board is powered on for several hours after turning off power to the board.

1.GPS turns on the power in the form of a module and gets GPS data by itself after about a minute, but when the phenomenon occurs, you can't get gps data even if i turn it on for 10 minutes.

2. MPU6050 needs to get acceleration values using i2c, but if i read the values, they all read zero.

3.Other chips are operating normally.

4. When GPS and MPU6050 don't work, downloading the same firmware via st link can work well again, and sometimes it needs to be downloaded a few more times.

What I thought was that I was using the internal clock of the stm32 and the sw is still on/off, but when I first downloaded it, it worked well, then turned off, and then it didn't work, and I thought it was because the clock shook or didn't work well, but when GPS and MPU started not working, I turned it off. I don't know what to do with debugging.

Have you ever experienced this before?

Or is there a good way to debug to find the cause?

Please give me your opinion.ᅲᅲ

13 REPLIES 13
TDK
Guru

Downloading firmware repeatedly doesn't really change anything. The problem is going to be elsewhere. You might have to get a logic analyzer on the pins so you can figure out if the STM32 is the problem or the peripheral ICs are not sending the right data.

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

@TDK​ 

thank you for reply

I'm a beginner, so I don't know.

How do I debug through logic analyzer?

TDK
Guru

Plenty of resources online for that. Here's one:

https://articles.saleae.com/logic-analyzers/what-is-a-logic-analyzer

If you're developing a complex project, I strongly recommend becoming familiar with hardware debugging tools.

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

@TDK​ 

thank you for reply

Is there any other debugging method other than logic analyzer?

Jlim.1
Associate II

@TDK 

Hello

I measured I2C through logic analyzer.

The figure below shows when the I2C is operating normally.

0693W000001qbDUQAY.jpg

The figure below shows I2C behaving abnormally and unable to read values.

I set the I2C frequency to 100k.

So when it's normal, the SCL works well at 100K frequency.

But when it's abnormal, I2C randomly sends out the SCL out of 50-130k instead of 100k.​

0693W000001qbF6QAI.jpg

Why is the SCL sending it off at a different frequency when it has the same firmware and it simply turns it off and on? In this case, which part do I have to?

please .. help me ㅠㅠ​

What specific GPS module are you using? Is it connected via I2C? Does it use clock stretching? Check specs and bandwidth

For debugging add diagnostic and telemetry output to a serial port.

If you get errors on the interfaces, report those, and handle them rather than pounding on the interface.

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

logical reasoning and bisection also work

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

Glad you were able to get a logic analyzer and see what the problem is. I don't know why the SCL line is abnormal, but I would guess there is an issue in your code.

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

@Community member​ 

The I2C is used to communicate with an acceleration sensor called MPU6050.

Logic analyzer results are separate from GPS.