cancel
Showing results for 
Search instead for 
Did you mean: 

Program runs correctly in step by step debug but not in run

Posted on July 16, 2015 at 19:07

Hi. I'm using stm32f429i-discovery I am controlling RFM69HC module (device) over SPI and I could get communicating both of them. I'm checking device's ID, and some other controllable registers and there is no problem of these. I've created a device struct and creating some arrays dynamcally so first I needed more heap size then the default one (in the *.s file Heap_Size variable) and increased it to 400 (default is 200). Now I am facing an error that when I connecting the board with keil and run without any breakpoints, program has not set some registers in the device over spi (I'm checking written value with reading the same address on the device), and returning (-1) but when I put there a bp then go into the function and complete it step by step, it is not returning any error (which means returns 0) device is configuring correctly. I'm checking these return values and writing the results to the LCD on discovery board. When I stepping function returning 0, when in run it's returning -1. I'm thinking about memory alignment but I'm not sure.

4 REPLIES 4
Posted on July 16, 2015 at 20:02

> Now I am facing an error that when I connecting the board with keil and run without any

> breakpoints, program has not set some registers in the device

Namely which registers? How do yo know they are not set?

JW
Posted on July 16, 2015 at 20:07

If you park a peripheral viewer over the SPI you will break it. Most specifically if it reads DR it will change the state of SR/RXNE

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on July 16, 2015 at 20:46

I'm sorry I edited the question to be more clear if you need I think I can write example code

Posted on July 16, 2015 at 21:15

I've solved the problem. Device is getting ready so slowly so in debug mode MCU is enough slow for that but in run mode MCU is doing check 100 times but device is still trying to get ready. The device datasheet has no info about that. When I increased it to 500 it's working now. Thanks again