This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

peripheral_uart crashes using fifo's for ble transmission in nrf connect sdk 1.8.0

hi, i am using ncs 1.8.0 for an application where i need to send some data every 10 ms. directly sending data over NUS with bt_nus_send() from the main thread works fine. but when i try to send data through exiting ble_write_thread by putting data into fifo_uart_rx_data results in these warnings in the log and skips a lot of data to be sent to the receiver.

[00:00:43.284,240] <wrn> bt_att: No ATT channel for MTU 16520
[00:00:43.284,240] <wrn> bt_gatt: No buffer available to send notification
[00:00:43.284,271] <wrn> peripheral_uart: Failed to send data over BLE connection
[00:00:43.294,250] <wrn> bt_att: No ATT channel for MTU 16520
[00:00:43.294,250] <wrn> bt_gatt: No buffer available to send notification
[00:00:43.294,281] <wrn> peripheral_uart: Failed to send data over BLE connection
[00:00:43.314,270] <wrn> bt_att: No ATT channel for MTU 16520
[00:00:43.314,270] <wrn> bt_gatt: No buffer available to send notification
[00:00:43.314,300] <wrn> peripheral_uart: Failed to send data over BLE connection

using ble_write_thread also works fine for larger intervals of time. only problem is when i set the interval to 10 ms it crashes likes this.

i have incresed the mtu size and heap size also but it did not show any considerable change.

these are the changes i made in prj.conf


#incresing the mtu size
CONFIG_BT_L2CAP_TX_MTU=240
CONFIG_BT_BUF_ACL_RX_SIZE=240

#thread naming
CONFIG_THREAD_NAME=y
#increasing the heap size
CONFIG_HEAP_MEM_POOL_SIZE=4096

any advice on how to get this correct.

thanks in advance.

Parents
  • Hi

    Glad to hear you figured out the reason for the initial crash! I think you should make sure the memory is "ready" before the application starts transmitting data, I think it would be best to wait for a READY EVENT of some kind, which it kind of sounds like you already do.

    Best regards,

    Simon

  • Hi Simon,
    thanks for your reply. After some testing the problem boiled down to one thing. If I allocate some memory and call bt_nus_send() in the same thread it doesn't run out of memory and works without a glitch at any rate of transmission. But if I allocate memory in one thread and pass it through FIFO's (which according zephyr documentation doesn't add any delay) and call bt_nus_send() from another thread, then the memory doesn't get freed in time and new memory allocation becomes difficult. (i have also tested the application with different priority levels for allocating and sending threads).


    Can you explain why it is happening like this.

    Is it correct to conclude that FIFO's might have some delay while passing data. If so what method do you suggest to pass data faster between different threads?

Reply
  • Hi Simon,
    thanks for your reply. After some testing the problem boiled down to one thing. If I allocate some memory and call bt_nus_send() in the same thread it doesn't run out of memory and works without a glitch at any rate of transmission. But if I allocate memory in one thread and pass it through FIFO's (which according zephyr documentation doesn't add any delay) and call bt_nus_send() from another thread, then the memory doesn't get freed in time and new memory allocation becomes difficult. (i have also tested the application with different priority levels for allocating and sending threads).


    Can you explain why it is happening like this.

    Is it correct to conclude that FIFO's might have some delay while passing data. If so what method do you suggest to pass data faster between different threads?

Children
No Data
Related