This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

RTT repeats output that is meant to be sent only once

Well not my best title. But I hope you can follow this explanation:

I added RTT to my project to replace UART. It works so far. But there is a strange behaviour... Code goes something like this:

int main(void)
{
SEGGER_RTT_WriteString(0, "Hallo!\n");	
    for (;;)
    {
      power_manage();		
			if(test_flag) { SEGGER_RTT_WriteString(0, "ABC!\n");	; test_flag=false;}
}
}

on Connection Event a Timer is started that sets the test_flag every second to true. The Timer is stopped on Disconnection Event.

When I start the device the RTT Viewer prints "Hallo" as expected. When I connect to the device via Bluetooth it starts printing "ABC" every second as expected. But whenever I disconnect it also prints "Hallo" and I can't figure out why?

I could swear there was no such a problem with UART.. but I put a delay for the Hallo now and this code is also repeated after the disconnection.. So it looks like the chip resets after disconnection..(from MCP) Why else it would run all the main() code again? I set a breakpoint inside the error handler and debugged but nothing...

I will restore to a backup without RTT and try the exact same with UART once again. But I can't remember such a problem..

main.c

Parents Reply Children
No Data
Related