I'm not able to get clear/un-corrupted data across the ttyACM on the nrf52840-PDK. I must be missing something, seems like this would have been solved a million times, but I have googled this with no results that work.
I've tried all the combinations i can think of, here is what worked the 'best' (least corruption / most readable output on serial on my host):
- baud 115200
- data bits 8
- stop bits 1
- parity none
- flow-ctrl hw(RTS/CTS)
Corresponding to sdk_config.h settings (the only change from the default in sdk14 is HWFC, which is disabled by default):
- #define UART_ENABLED 1
- #define UART_DEFAULT_CONFIG_HWFC 1
- #define UART_DEFAULT_CONFIG_PARITY 0
- #define UART_DEFAULT_CONFIG_BAUDRATE 30801920 #115200
- #define NRF_LOG_DEFERRED 1
Running a mimally modified 'ble_app_hts' from the examples:
- above sdk_config.h settings
- added "NRF_LOG_INFO('####') in the main-loop
- tried with, and without, a "long" busy-wait loop inside the main loop (in case i was swamping things).
- Same results. With the busy loop, the NRF_LOG_INFO is called once per ~second, eg a few orders of magnitude under the serial bandwidth.
- still using defered logging, as above, which is the default.
This is what is expected on the serial port:
<info> app: #### <info> app: #### <info> app: #### <info> app: #### .....
But this is what i see: eg logging is clearly working but one end (likely my config?) is introducing corruption:
<info> app: #### <info> ap> app: ####<info<info> <info> app: #### <info> app: #### <info> a<info> app: #### fo> app: ##p: #### p: #### <info> app: #### pp: #### fo> app: ##<info> app: #### <info> app: #### <info> app: #### <info> app: #### <infp: #### <info> app: #### <info> app: #### <info> app: #### <info> app: #### <info> app: #### o> app: ####p: #### <info> app: #### <info> app: #### <info> app: #### <info> app: #### <info> app:#### <info> app: #### <info> app: #### <info> app: ####
So my question is, what settings to use to get correct output over serial to my host?
If you see something wrong with my settings, that would work. Alternatively, I am new to the SDK, perhaps you could give a known-good setup for me to flash. Eg:
- what sdk version & what example (I'm using the HTS peripheral in http://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v14.x.x/nRF5_SDK_14.2.0_17b948a.zip)
- exactly what (if any) code changes needed
- exactly what host settings.
- I'm obviously on linux. ubuntu16.04 x64
- for a specific tool if possible, eg putty or (especially) stty+screen since their settings aren't the most straightforward