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

nrf52832 not working outside debugger.

Hi

I have a wired situation in my project. Everything is working fine when I am running my heart-rate device with the debugger. When I detach the debugger or just power-cycle the device behaviour becomes wired. The device still advertise, so I can see it from my phone. But, when I try to connect to it from my phone, it will not connect anymore. If I do "connect jLink" from Segger studio, then everything works fine again.

I am using SEGGER_RTT_WriteString a lot, and I suspected that it could be that the output to the debugger via SWD was blocking when I am not running the debugger. So, I have checked in my code that I am doing SEGGER_RTT_Init() at start, and I have set the SEGGER_RTT_CONFIG_DEFAULT_MODE to 0 (i.e SKIP when buffer is full).

I am using nRF52832 with our own HW, Segger Studio and j-Link Ultra. The sdk version 14.2.0.

Any idea where to start looking for a solution?

Regards Arne

Parents Reply Children
  • That is 100% incorrect. RTT writes to a circular buffer and if nothing reads it, it just overwrites. RTT is designed and documented to be left enabled even if you don't have a debugger connected with that exact purpose, ensuring that you don't need to change code depending on whether you are debugging or not.

    Quote from the Segger RTT site

    A:	SEGGER-RTT uses non-blocking mode per default, which means it does not halt program execution if no debugger is present and J-Link is not even connected. The application program will continue to work.
    

    So whatever the original poster's issue is, it's not that.

  • Ok, if you said so. So it seems not solving this problem for everyone then. But at least it solved the issue for a few people that I know. Can you provide a better solution for the problem then? It does not seems to work for OP by just leaving the RTT enabled.

  • not I who says so - it's Segger who says so and they wrote RTT. They explicitly made it so it's low overhead and you're able to leave it in your code whether connected or not for exactly this reason. No I don't know what the original poster's issue is and they are going to have to look into it some more, however just making statements like "RTT requires the JLink to be connected all the time" which is factually incorrect doesn't really help does it.

  • Well, sorry disappoint you but that was a fact for me as I experienced it myself a few times and the same answer also worked for a few people that I know as I said. I just shared what I have experienced in the hope that it could help others with a similar issue. Sorry if that doesn't work for you.

  • but that's my point - you didn't just say you've found cases you were unable to explain where turning off RTT fixed a bug you couldn't understand. You made the statement that RTT requires JLink to be connected all the time which is just straight up false and not as designed by Segger. The problem with posts like this is someone then does turn off RTT, it randomly fixes the actual bug they do have which is something different and then the incorrect "fact" that 'RTT causes your program to hang if JLink isn't connected' becomes something people find when they search for answers and think it's true. Then people randomly remove RTT, make life hard and never find their actual issues.

    If you want to post opinion, go ahead, but at least say 'in my experience' or 'you are supposed to be able to leave RTT code on all the time but I've had some problems with that I never got to the bottom of'.

Related