-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nrf52840_pca10056: Leading spurious 0x00 byte in UART output #14753
Comments
I have noticed the same issue before, and the way I fixed it then was be removing all GPIO configuration of the PINS, and only assigning them to the UART peripheral. |
@joerchan Thanks for the input. I think there are 2 issues here:
I have contacted @simtind about 1., and he will escalate that to Segger. |
I don't think it is caused by the Zephyr application. On the logic analyzer, I can see this break signal on the TXD line (resulting in the byte |
I tried also with other Nordic DKs, i.e.:
but I didn't succeed to replicate the issue on any of them. So far I saw this unwanted break signal only on pca10056. |
After further investigation, this is indeed an issue with the nrf52840_pca10056 Development Kit PCB. Closing since this is a hardware issue. |
it's not actually a segger issue: here's my 'fix' static int gpio_glitch_init(const struct device *d)
{
ARG_UNUSED(d);
/* Force GPIO P1.02 (uart1 TX, btmon TX) high so we don't have a stray
* 0x00 in the serial output.
*/
NRF_P1->DIRSET = 1UL << 2;
NRF_P1->OUTSET = 1UL << 2;
return 0;
}
SYS_INIT(gpio_glitch_init, PRE_KERNEL_1, 0); it might not be triggered when doing an nvic reset because the gpio registers might retain some information from the previous configuration, whereas a pin reset will clear everything in the SoC (just speculating). |
Note to future readers:
This is a hardware issue, due to the fact that at boot time, nRF52840 pins float, and so the buffer will likely pull them low weakly. That weak state is buffered by the mux, making the segger chip see a continuously low signal.
It is exclusive to the nRF52840 Development Kit (nrf52840_pca10056) and does not affect other Nordic nRF Development Kits.
Workaround: Use
nrfjprog -r
instead of pressing the reset button on the board.When booting up, Zephyr generates a framing error that is interpreted by the Segger CDC ACM driver implementation in the debug MCU as a byte of value
0x00
. This ends up in the serial port input of the application on the Desktop. Usually this doesn't matter because we are just outputting text, but in some cases we send data with a protocol and that is a big issue because it throws the protocol out of sync.In particular this prevents
btmon
from correctly parsing the header of the first packet after reset when building Zephyr withCONFIG_BT_DEBUG_MONITOR
.To reproduce simply build
samples/hello_world
for the nrf52840_pca10056 board and reboot it, then check the output on the CDC ACM serial port and on a logic analyzer.Note the leading 0:
Trace showing the framing error that is also interpreted by the logic analyzer as a
0x00
:The text was updated successfully, but these errors were encountered: