Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

APP_UART_COMMUNICATION_ERROR after migration from SDK 14.2 to SDK 15.3

I have been migrating a project from SDK 14.2 to SDK 15.3 and have encountered an issue with UART. I am using the legacy layer with the following configurations:

#define UART_ENABLED 1

#define UART_DEFAULT_CONFIG_HWFC 0

#define UART_EASY_DMA_SUPPORT 0

#define UART_LEGACY_SUPPORT 1

#define UART0_ENABLED 1

#define UART0_CONFIG_USE_EASY_DMA 0

I am sending and receiving JSON strings and am having no issues with transmitting messages, I am seeing the same behaviour as before the migration. Unfortunately I am running into an issue with receiving messages. What's odd is that I can always successfully receive one message without issue. It is when receiving a second message that I get an APP_UART_COMMUNICATION_ERROR. Every message that follows will also get the same error. After observing this behaviour, I can still transmit messages without issue.

The app_uart_event has a type of APP_UART_COMMUNICATION_ERROR while the data fields of error_communication, error_code, and value are all equal to 1. I read in another thread that that is an overflow error, however my RX buffer is 256 characters, and the message it is receiving is 8 characters long.

I tried flushing after receiving the error using app_uart_flush() but it had no effect. I also tried disabling prs to see if that was the cause but it made no difference.

Any help with the issue or insight would be greatly appreciated.

  • No worries. It turned out to be an issue with configuration. When migrating to SDK 15.3 and still using legacy layers, there were a few competing configuration files that I was not aware of / had to make sense of. I spent time porting things over and merging sdk_config.h files, but then in the integration directory of the SDK, I had a templated nrfx_config.h file that was causing issues with getting the configuration I wanted (I had to strip it bare). And finally, under integration>legacy there is the apply_old_config.h file which then undefines and redefines configurations.

    All this to say getting those three files in agreement was an issue and setting things the same across multiple files did not result in desired configurations. So I stripped nrfx_config.h and worked out the configurations between sdk_config.h and apply_old_config.h and got the UART communication working again.

Related