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

UART framing error

hi,

I have implemented a UART to receive network packets from another controller to send it over BLE.

UART config are: 8bits data, 9600 baud rate, no parity, HW flow control disable.

I have disable the flow control and to keep UART and BLE event non-concurrent I have implemeted radio notification. Whenever radio notification is set, a GPIO pin is set. Another controller always sends byte before checking this GPIO. If GPIO is reset means there is no radio active, it sends data to nRF.

Sometimes, nRF UART gets framing error (0x0c). If I check signals logic analyzer, there is no coincidence of BLE and uart. I can conclude that it is not because of BLE.

But when I switch on a application timer(app_timer_start) to call an handler every 500 ms to get RSSI samples, the frequency of UART error increases. Here is the code snippet.

if ((m_client[i].srv_db.conn_handle != 0xFFFF)&&(m_client[i].state == STATE_RUNNING))
{
   err_code = sd_ble_gap_rssi_get(m_client[i].srv_db.conn_handle,&p_rssi[m_client[i].srv_db.conn_handle][indice]);
   err_code = sd_ble_gap_rssi_stop(m_client[i].srv_db.conn_handle);
	 
} 

What could be the reason of UART error? When I call sd_ble_gap_rssi_get api, is this API internally sends BLE packets to RSSI? If it sends any packet, application should get radio notification event.

Thanks.

Parents
  • Hi

    The fact that the radio is not ON doesn't necessarily mean that the CPU is not busy with post or pre-processing of BLE data. The SoftDevice might still have control over the CPU and hence blocking your application. And when you call sd_ble_gap_rssi_get() and sd_ble_gap_rssi_stop() you give the SoftDevice even more tasks to do which might explain why you see an increased number of errors.

    sd_ble_gap_rssi_get() does not start any BLE transmissions by itself, but it reads the RSSI value of the last received BLE packet.

    As a side note; Maybe you already do this in your code, but remember that you have to start the RSSI sampling with sd_ble_gap_rssi_start() and then wait for the next BLE event before you can read valid data. When you call sd_ble_gap_rssi_stop() you will have to start and wait again before you read the RSSI.

Reply
  • Hi

    The fact that the radio is not ON doesn't necessarily mean that the CPU is not busy with post or pre-processing of BLE data. The SoftDevice might still have control over the CPU and hence blocking your application. And when you call sd_ble_gap_rssi_get() and sd_ble_gap_rssi_stop() you give the SoftDevice even more tasks to do which might explain why you see an increased number of errors.

    sd_ble_gap_rssi_get() does not start any BLE transmissions by itself, but it reads the RSSI value of the last received BLE packet.

    As a side note; Maybe you already do this in your code, but remember that you have to start the RSSI sampling with sd_ble_gap_rssi_start() and then wait for the next BLE event before you can read valid data. When you call sd_ble_gap_rssi_stop() you will have to start and wait again before you read the RSSI.

Children
No Data
Related