Execution time of bt_nus_send

Hi,

This is the follow up on this question, I'm not sure how it was closed.

I'm getting different execution times (not transmission time, like mentioned in the answer here) for `bt_nus_send` function, although in the above mentioned post it is said that the function is not blocking. So, I'm wondering why sometimes the function takes a couple of milliseconds to execute if it is not blocking.

In most cases it is stable, and around ~100 microseconds, but I think when there is a problem with connection, I get a couple of milliseconds. If the function only queues data in the SoftDevice controller's FIFO for transmission in the next connection event, I expect similar execution times each time the function is called.

What could be the cause of the problem?

Parents
  • Hi

    Have you set the return value to check whether bt_nus_send() returns successfully or if it returns an error code when it's taking longer to complete? I would assume that it retries when the connection is poor, as the SoftDevice controller hasn't been able to send the previous buffer successfully and therefore the buffer isn't ready to get new data from bt_nus_send(). I'm currently waiting for a clarification from the devs on what could hold the bt_nus_send() function.

    UPDATE: The developers says this indeed could be blocking on memory buffers for sending the packet in the Zephyr host. Sorry about any confusion.

    Best regards,

    Simon

  • Simon, thank you for the answer, sorry for my late response.

    So, to conclude, if I understood you correctly, bt_nus_send will block until buffer in which it puts the packets has available memory, right?

Reply Children
Related