Hi,
I'm using the example nRF5_SDK_11/examples/ble_peripheral/ble_app_uart witn a pc10028 board. The central is done on a linux machine with a python program under bluepy. I can open a connection and exchange datas in both directions without problem.
Then, I tried to check the obtained throughput. Bluepy proposes a CE default interval of 65.5 ms. Moreover, the default values of the periperal attempt to have up to 4 packets per CE. So I arrived to a througput of 2048/0.0655 = 9.77 kbps. To increase this value I was first able to re-negotiate with the central an interval of 30 ms, so arriving to 21.3 kbps. Is it possible to modify the limit of 4 packets per CE?
I also saw that I will have to take care of the flow control: I modified the program to only interpret commands coming from the UART to send the desired number of packets generated by the program (ie "00000000000000000000", "11111111111111111111", ...). I experienced a stop when 8 was reached (error NRF_ERROR_NO_MEM reported). Is this limit of 8 right and where could I change it?
Then, we arrive to the strange thing: I re-used the original ble_app_uart example and inserted some HW debugging function within the code. For example, I inserted generation of a single pulse of trigger on P0.15 in uart_event_handle when a byte is received. When the limit of 20 bytes is reached (or '\n' received) I display on P0.13 (=debug2), before sending the packet via ble, all the values (I emulate a serial connection with start/stop bit to see on a logic analyser). I have also placed other pulses on P0.12 (=debug1) and P0.14 (=debug3), single debug1 pulse in uart_irq_handler and single debug3 pulse in uart_event_handler.
A trace of 60 bytes sent is shown below: trace.pdf
When I send 60 bytes (115200 bauds), everything is fine and the 3 packets are correctly received by bluepy. All the expected debug pulses are present (debug1, debug2, then trigger) and the spacing between pulses is 0.1 ms and correspond to 115200 bauds. After each 20 bytes, values are displayed on debug2. The 3 packets are sent in the same CE most of the time (but could be 1+2 in some cases according to the asynchronism between UART and CEs).
However as soon I send more then 64 bytes, no one pulse is shown any more and nothing is received by bluepy. From this point, the UART is dead and I need to de-connect and re-connect the board on the USB plug to be able to work with the UART. The connection is still alive since I see empty PDUs exchanged between the peripheral & the central.
From where come this limit of 64? UART_RX_BUF_SIZE is 256. And how the device can guess that it will receive more than its limit and decide to crash before (no one pulse is displayed, even not the first one) ?
I'm using arm-none-eabi-gcc version 5.2.1 and can debug with eclipe luna (4.4.2). The connection to the debugger is also lost after sending more than 64 bytes.
Thanks for any kind of help.
Bernard