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

UART error codes

Hello,

 

I am using nRF52840, SDK_16.0.0, SoftDevice S140 V7.0.1 and Segger for flashing the image. I am using ‘ble_app_blinky’.

 

1) I ported UART into my code and it is working fine with FDMI / UART cable connected. When I don’t connect UART cable I am getting APP_UART_COMMUNICATION_ERROR even though I did not do any Serial communications. Below is the “Call Stack”.

 

2) When will APP_UART_FIFO_ERROR occur. Is this when Rx FIFO buffer is full (NRF_ERROR_NO_MEM).

a) How about Tx buffer fill.

 

3) I further debugged and modified code as below in uart_event_handle(). I have two scenarios.

Scenario 1) Only nRF will be connected and data will be read using BLE.

Scenario 2) Other chip will be connected to nRF over UART interface and read data.

a) In Scenario 2 I am not facing issue. But in Scenario 1 I am getting 'Fatal error'. We need to use same code base in both scenarios. So to avoid this I did below modifications. Is this fine ?

b) I am getting below error. As per Product specification it is "Break condition" (8) and "Framing error occurred" (4). Even with this, if there is no serial communication will other code execute properly. Like BLE, Flash, FDS etc...

0> <info> app: Err:Com 4
0> <info> app: Err:Com 8

 case APP_UART_COMMUNICATION_ERROR:
            //APP_ERROR_HANDLER(p_event->data.error_communication);
            NRF_LOG_INFO("Err:Com %d", p_event->data.error_communication);
            break;

Thanks & Regards

Vishnu Beema

  • Hi,

    It seems that there is an interrupt firing as you go into the interrupt routine handler. Are the pins that you use for UART floating when nothing is connected? 

     

    So to avoid this I did below modifications. Is this fine ?

    Printing out an error message is ok during the development phase but I don't think that it's a good practice for recovery for a deployed product as it doesn't recover the application. 

    Jared

  • Hello,

    Below is my device high level architecture. Chip 1 is master and control power supply to nRF chip so that chip 1 can on/off nRF chip.

     

    As mentioned in my previous post, there are two scenarios.

     

    Scenario 1) Only nRF chip will be active and chip 1 will be in low power mode. During this time nRF chip only will be active.

    Scenario 2) Both Chip1 and nRF will be powered so that there can be serial communications over uart and even during DFU / Image up gradation.

     

    So nRF chip does not know whether Chip 1 is active or not. So in both scenarios I need to enable UART driver.

     

    1) In Scenario 1 may be uart pins might be floating. But still why there are interrupts.

    a) Is this due to glitches on uart pins.

     

     2) In what way it will not be a good practice to skip the error. Can you please give more details on this.

     

    If there are any other alternative approach, please suggest.

     

    Thanks & Regards

    Vishnu Beema

  • Hi,

    1. Yes, a floating pin might trigger an interrupt as it floats. I would recommend setting the pin as input with the input buffer disconnected when the UART module isn't enabled. Could you provide a trace of the UART pins while you run the application?
    2. It's not a good idea because the error is never handled.
  • Sorry for late response. I was busy with other project.

    For point 1, about floating pin, to my understanding, by default even if I don't configure pin, it will be configured as Input and Disconnect. 

    But issue here is, if pins are configured as UART and if that pins are not connected on other side, then pins will be floated and get unnecessary interrupts.

    Please correct me if I am wrong in my understanding.

    Thanks & Regards

    Vishnu Beema

Related