Skip to main content
Associate
October 4, 2023
Question

STM32F103RCT6 - BusFault on address 0x20010000

  • October 4, 2023
  • 4 replies
  • 4590 views

Hi all,

I'm trying to debug a bus fault that happen on a region on ram that is not supposed to exists. MCU has 48kb of RAM, so start from 0x20000000 to 0x2000C000, but i'm able to write 0xFF from 0x2000C000 to 0x20010000.. why??

rdzdvd_0-1696414700487.png

I can see also some data on 0x20010000, it seems random and i can't change it.

So, why BFAR reports 0x20010000?

The function referenced (and attached) by the program counter is simple and I test it with every possible values.

Thanks

This topic has been closed for replies.

4 replies

ONadr.1
Senior III
October 4, 2023

An array defined in a function is created on the stack. Perharps, is to big, for your stack definition. Try to define this array as "static". It moves array to lower RAM and there is no need for initialization every time the function is called.

To RAM size. Are you sure the MCU is really from ST? Most of these MCUs are fakes and there's maybe everything there.

 

rdzdvdAuthor
Associate
October 4, 2023

Nice answer, that array should become a const or, at least, static as you suggest.

To RAM size, i'm pretty sure it is. I can attach a photo.

TDK
October 4, 2023

It sure looks like an out of bounds read/write. What code is at 0x0800C7DD? Should be able to track it down to the exact line it occurs on and figure out why an invalid address is in r1.

"If you feel a post has answered your question, please click ""Accept as Solution""."
rdzdvdAuthor
Associate
October 4, 2023

The line correspond to the 

j+=k;

inside the while loop of the function.

I've tested the function with every values that v can take, and nothing bad happens.. :downcast_face_with_sweat: