Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

SDK 17.1 UART example exit with error_code=0x0c or 0x4001

I am working on UART example and serial port.

I got compile error and modified retarget.c line 99 with

  #if defined(__SES_VERSION) && (__SES_VERSION >= 34000) && !defined(__SEGGER_RTL_VERSION)

I got like error and set

    Project -> Options... -> Library ->Library I/O : RTT 

With 2 fixes, build and flash were success. But the app ends with APP_UART_COMMUNICATION_ERROR

I am not sure my modification is correct for this sample. What kind of change is good for this example?

My environments:

  SES 6.30 macOS x64

  SDK 17.1 examples/peripheral/uart/pca10040

  nRF52-DK,PCA10040,nRF52832

  DK RX/CTS/TX/RTS/GND pins are connected with serial port TXD/RTS/RXD/CTS/GND

  • Hello,

    The most common sources of the APP_UART_COMMUNICATION_ERROR event is either that there is a floating RX pin (not connected to anything, so the input voltage can drift and generate "junk" data), or that the connected device is using the incorrect baudrate (the nRF and the connected device are not using the same baudrate).

    What do you mean by "example exits with err_code = 0x0c or 0x4001"? Are both of these coming from the same event? APP_UART_COMMUNICATION_ERROR? The 0x0C means that it is a framing error, but this should not be able to give an err_code of 0x4001. 

    Where do you see the 0x4001?

    what is your UART connected to? And what baudrate does the connected device use? (and what baudrate do you use?)

    Best regards,

    Edvin

  • >Where do you see the 0x4001?

    app_error_handler_gcc.c line 47, app_error_handler()

    I comment out main.c line76 for workaround this issue.

    //APP_ERROR_HANDLER(p_event->data.error_communication);


    I saw some garbage data of 0x79 after app_uart_get()

  • FT232R USB - RS232C cable does not work with UART sample.

    I got APP_UART_COMMUNICATION_ERROR and garbage data of 0x79.

    Prolific USB-TTL cable is working fine with UART sample. No communication error. No garbage data.

  • I suggest that you try to hook up a logic analyzer on the UART pins to check whether the RS232 device actually sends 0x79. Does the RS232 cable work after this "garbage data"? 

    tni said:

    >Where do you see the 0x4001?

    app_error_handler_gcc.c line 47, app_error_handler()

    Ah, you mean that the ID is 0x4001. That just means that it is an NRF_FAULT_ID_SDK_ERROR (and not an SDK_ASSERT, or a Softdevice assert).

Related