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

UART with SoftDevice, Trouble Receiving/Transmitting

Hi all

I would like to use UART on a custom board using the nrf52840 chip. I am using the app_uart driver and have gotten a loopback to work. I have a couple of questions:

  1. I've tried just sending and receiving data with the UART on the custom board using the ap_uart driver, so custom pins. The initialization is successful and it seems as if the Transmit is also successful ie it's not throwing an error but when putting a scope on the pin, nothing is getting transmitted on the pin. I've double checked that I'm checking the correct pin. 
  2. Trying to read from the UART, again I can see that the data is getting through to the Rx pin with the scope but it's not getting read at all. The error it is throwing is 5-Not Found, which doesn't seem that helpful.
  3. When I looked up the 'Not Found' error, it says that when using the UART with the SoftDevice, the Flow control needs to be enabled? I don't think I can do that with my board.

Using 9600 baud rate, SDK15.2, debugging using the DK

Transmit code snippet:

uint8_t * tx_data = (uint8_t *)("Hello\r\n");
uint32_t ret;

for (uint32_t i = 0; i < MAX_TEST_DATA_BYTES; i++) {
    ret = app_uart_put(tx_data[i]);
    if (ret == NRF_SUCCESS){
        memset(tempBuff, '\0', sizeof(tempBuff));
        get_readable_error_message((uint32_t)ret, tempBuff, sizeof(tempBuff));
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"[DEBUG] UART Write Error! err_code = %\r\n", ret, tempBuff);
        return (false);
    }
}

Receive code snippet:

uint32_t ret;
uint8_t rx_data[50];

ret = app_uart_get(&rx_data);
if (ret != NRF_SUCCESS)
{
    memset(tempBuff, '\0', sizeof(tempBuff));
    get_readable_error_message((uint32_t)ret, tempBuff, sizeof(tempBuff));
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"[DEBUG] UART Read Error! err_code = %d (%s)\r\n", ret, tempBuff);
    return false;
}

ETA: Code snippets

Parents Reply Children
No Data
Related