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

BTLE_CONNECTION_TIMEOUT while connection interval is small

Hi experts,

I need nrf51822 to send thousands of packets (notification) to Master Control Panel (PC), and expect for high data rate. So, I turned the connection interval from 100 ms to 20 ms in Master Control Panel. Unfortunately, the connection is broken after about 5 seconds. Everything is ok if the connection interval is 100ms.

my device configuration is like #define MIN_CONN_INTERVAL MSEC_TO_UNITS(10, UNIT_1_25_MS) #define MAX_CONN_INTERVAL MSEC_TO_UNITS(200, UNIT_1_25_MS) #define SLAVE_LATENCY 10
#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(5000, UNIT_10_MS)

It seems the reason of timeout is I can't send packets as soon as possible. While the connection interval is 20 ms, the actual data rate is about 30 packets per seconds. The low data rate should be because I need read data from SPI Flash for sending.

I'm very confused why it happened. If I didn't send any notification, the connection was always on; but it timeout if I sent notification not fast enough.

Wondering for your help!

Parents
  • Thanks Petter. I have solved this problem, by rewriting the spi flash access functions using the new spi_master driver, which enables spi interrupt. So, I think the problem may be due to the polling method. Too much cpu cycles are wasted to waiting for spi completion. BTW, I found sd_ble_gatts_hvx will return NRF_ERROR_INVALID_STATE if it is called in interrupt. I used scheduler to solve it.

    Thanks again!

Reply
  • Thanks Petter. I have solved this problem, by rewriting the spi flash access functions using the new spi_master driver, which enables spi interrupt. So, I think the problem may be due to the polling method. Too much cpu cycles are wasted to waiting for spi completion. BTW, I found sd_ble_gatts_hvx will return NRF_ERROR_INVALID_STATE if it is called in interrupt. I used scheduler to solve it.

    Thanks again!

Children
No Data
Related