Hello everyone,
I'm using Keil v5.
I have this piece of code, which works fine, but when put it in a loop I get Hard Faults, caused by memory issues. Increasing stack and heap doesn't help. Inside while(1) I have this function, which calls a couple of other functions, and the last instruction of the last function, called by the function, has *returnValue = sum (an example). The thing is that returnValue = 0xA0007C70, which can't be valid on my 32KB uC. If I remove that, I have memcpy after the function, which is going to fail (if I remove that memcpy, no errors, but everything is useless).
There are other lines inside while(1), but when I had only the function, increasing stack and heap helped.
This kind of errors had made me redo everything, but last time I had issues where memcpy was copying wrong values. I would get insanely large values, where I expected something between 0 and 1.
What is causing these memory problems? I'm running at 80MHz, could that be the problem? Or is it something in the startup?
EDIT: Well, changing it to 40MHz did not help...