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

Serial + BLE + I2C + Timer + GPIO -> serial not works

We are developing an application on the nRF52840 kit with SDK 15.2. We are using Keil as compiler. I have started developmet my application with the example ble_app_cscs. In this example I added the libraries for use the serial, I2C, timer and GPIO.
After that, when I start the application and I connecting the nRF52840 device with app and I receiveng data from UART, after a random time the serial stops to work, while the I2C, GPIO and timer works correctly.
The firmare is running and it communicate with the App but the function that receive from the Uart return always no data. The data continue to come from Uart, I can see them with oscylloscope, but the receive function say always no data. This happen after a random time, it can be immediatly or after some minutes.
When te uart stops to receive data, the error that it return is the numer 13 : timeout.
If I use the BLE or the UART separatly they work fine. I attached all project.
Do you have any idea about this problem?

ble_app_cscs.zip

  • Hi,

    I have inserted the function APP_ERROR_CHECK() after the function nrf_serial_read :

    ret_loop = nrf_serial_read ( &serial_uart , &buff_received_uart_badge , 18 , NULL , 5 ) ;

    APP_ERROR_CHECK ( ret_loop ) ;

    When RFID reader read the badge, the application, with debugger active, stopped automatically in the function app_error_handler :

    Why the application stopped automatically ?

  • NRF_BREAKPOINT_COND will insert a assembly operation forcing a breakpoint. Most likely one of the conditions above was true, but not the one you set a breakpoint in.

  • Hi, 

    I have does many test, these are the results :

    Test 1 : 

    ret_loop = nrf_serial_read ( &serial_uart , &buff_received_uart_badge , 18 , NULL , 5 ) ; 

    After that the RFID reader read the badge many time, the serial stopped and not work. 

    Test 2 :

    ret_loop = nrf_serial_read ( &serial_uart , &buff_received_uart_badge , 18 , NULL , 5 ) ; 

    APP_ERROR_CHECK ( ret_loop ) ;

    The application enter in function app_error_handler with error code 0x0D, because really not receive data because the RFID reader not read the badge.

    Test 3 :

    ret_loop = nrf_serial_read ( &serial_uart , &buff_received_uart_badge , 18 , NULL , 5 ) ;

    if ( ( ret_loop != NRF_SUCCESS ) && ( ret_loop != NRF_ERROR_TIMEOUT ) )
    APP_ERROR_CHECK ( ret_loop ) ;

    In this way i have filtered error code 0x0D. After that the RFID reader read the badge many time, the application not entry never in the function APP_ERROR_CHECK , and the serial not work. I understand that the serial not work also when in case RFID reader read the badge because i have inserted in a break point in case the function nrf_serial_read have received data.

  • Can you post the state of the UARTE registers (when it is not working) for the UARTE instance that stops working?

    Have you tried passing a variable to the parameter p_read of nrf_serial_read, and see if it actually is able to read any bytes?

    I suppose you have checked the UART line with a logic analyzer to see if there is any incoming data?

    Are you able to transmitt data to the device when the UART is in error state?

  • Hi,

    These are the UARTE registers, when it is not working:

    I have tried passing a variable to the parameter p_read of nrf_serial_read, but also in thiscase the UART stops working:

    uint8_t p_read ;

    ret_loop = nrf_serial_read ( &serial_uart , &p_read , 1 , NULL , 5 ) ;

    I have verify that RFID reader sends the data to nrf-52840 kit with the oscilloscope.

    If the UART is stops working, the application continue works.

Related