Memory problem with MC13213-SRB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Memory problem with MC13213-SRB

973 Views
lex4098
Contributor III
I feel like RAM memory runs out sometimes: the UART stops sending
correct characters and the MCU seems blocked.

How can I check if I have exhausted my RAM?
I usually initialize a dynamic var and see its address,
then check if it is in the upper part of the RAM: but
unfortunately sometimes the heap could increase from the
lower part of the RAM and collide with the upper one;
in that case, RAM is exhausted.

Someone solved this problem?
Is there a way to trash unusued vars from the RAM?


   
Labels (1)
0 Kudos
1 Reply

270 Views
Alban
Senior Contributor II
Hello Lex,

Usually, the variables are allocated from the bottom of the RAM, whilst the stack goes from the TOP.
I can advise to configure the debug module to interrupt if there is an access in the variable space +1 or the stack space -1.
I mean, you keep one byte in the middle that should never be accessed, otherwise it means not enough RAM and/or stack corruption.

If the breakpoint is triggered, your break module knows there is something wrong.
Otherwise, it is very difficult to observe in a real life application.

Cheers,
Alban.
0 Kudos