Part Number: CC1352R
Hi,
I have (again) the issue that the code works only when connected with the debugger. Looking in the forum this seems to happen no too seldom. Unfortunately also very seldom with a good answer.
I read something about HW issues with the debugger connection. But can that be? I have even no idea. what's the difference from processor point of view running code from internal flash with and without connected debugger.
Here is my actual problem:
- I use a HW timer to get some timing information. The value is read by HWREG(GPT0_NONBUF_BASE + GPT_O_TAR);
- Now I have a wait function that waits for some ticks:
#pragma FUNCTION_OPTIONS("--opt_level=0")
void Tbl_Hw::waitTicks(uint32_t nTicks)
{
uint32_t startValue = HWREG(GPT0_NONBUF_BASE + GPT_O_TAR);
uint32_t actValue;
do
{
actValue = HWREG(GPT0_NONBUF_BASE + GPT_O_TAR);
}
while ((actValue-startValue) < nTicks);
}
And I have a signal function that uses my LED
void Tbl_Hw::SignalPoint(int nSignals)
{
switchRedOff();
//switchGreenOn();
wait_ms(300);
while (nSignals > 0)
{
nSignals--;
switchBlueOn();
wait_ms(200);
switchBlueOff();
wait_ms(200);
}
wait_ms(700);
}
This SignalPoint function is then called in the destructor of a temporary instance of a class. When I run this program then with a connected debugger I see the blue LED lighting. But when the debugger is disconnected, the LED stays dark.
I thought about some optimization, that my wait loop is removed from the compiler. Therefore I inserted the function options pragma. But that seems not to make a difference. Even when I run it with debugger, the debugger downloads the program to the target and executes it. Disconnecting the debugger and performing a power cycle starts then the same program, still located in intern flash. So that can also not be the root cause.
Any idea what I could do to get it also running when the debugger is not connected?
Greetings
Erwin