I am working on a project that is implementing the segger_rtt framework.
It's based on an NRF52840, it's running FreeRTOS and we're using Segger Embedded Studio (SES).
Using SWD interface through a Segger Flasher.
I have both custom hardware and the PCA10056 NRF DK.
I get same behaviour on both.
I am using pynrfjprog to run some tests externally through the Segger Flasher.
Ideally I would like to do this while debugging using SES.
We are using NRF_LOG to output log information to the debug terminal window in SES.
The script works, however after the end of the script there is no longer a proper connection between the hardware and SES.
No more debug output in the debug terminal window.
But the software is still running ( I am toggling an LED in a task every 1 second-ish ).
And the test script can be executed again with proper connection into the software and any debug output that has been buffered meanwhile will get output ( until buffers are full ).
If I break the software all registers show 0xdeadbeef, and the LED contiues to blink.
Shouldn't it be possible to have two simultaneous connections one through pynrfjprog and one through SES to the same hardware ( here a Segger Flasher ) ?
Below is a copy of the JLINK log that shows JLINK_IsHalted() begins to return ERROR.
This should be around the time where the script is completed.
T3EB4 053:108.064 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000)
T3EB4 053:108.088 - 0.033ms returns 0
T3EB4 053:108.200 JLINK_IsHalted()
T3EB4 053:109.644 - 1.466ms returns FALSE
T2640 053:111.752 JLINK_RTTERMINAL_Control(Cmd = JLINKARM_RTTERMINAL_CMD_STOP)
T2640 053:112.632 CPU_WriteMem(4 bytes @ 0x20018E30)
T2640 053:113.380 - 1.640ms returns 0x00
T3EB4 053:113.536 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000)
T3EB4 053:113.560 - 0.028ms returns 0
T3EB4 053:113.636 JLINK_IsHalted()
T3EB4 053:114.388 - 0.766ms returns FALSE
T3EB4 053:121.232 JLINK_RTTERMINAL_Read(BufferIndex = 0, BufferSize = 0x00008000)
T3EB4 053:121.256 - 0.027ms returns 0
T3EB4 053:121.328 JLINK_IsHalted()
T3EB4 053:122.384 - 1.073ms returns ERROR
It doesn't matter how I end the script, if I call any of the below functions or not it is the same behaviour.
disconnect_from_device(), disconnect_from_emu(), rtt_stop(), close()
I also have another issue that I am having trouble wrapping my head around..
The task that is handling segger communications calls
SEGGER_RTT_Read
in a while(1) loop and if anything has been received it gets processed.
But if I insert a vTaskDelay(0) in case nothing has been read then RTT communication stops working.
rtt_write completes in the script writing the required number of bytes.
But in the device the SEGGER_RTT_Read function never reads anything.