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

How do I wait for BLE_EVT_TX_COMPLETE?

Here:devzone.nordicsemi.com/.../group__ble__api.html

Choose to simply not keep track of available buffers at all, and instead handle the BLE_ERROR_NO_TX_BUFFERS error by queueing the packet to be transmitted and try again as soon as a BLE_EVT_TX_COMPLETE event arrives.

I want to know how do I wait for BLE_EVT_TX_COMPLETE?

This is what I did but BLE_EVT_TX_COMPLETE never got triggered at all:

FLAG: if(notification_buffer_is_free ==true)
	{

		data_cache+=i;
		logger_gatt_value_set(LOG_DATA_DATA, (uint8_t*)data_cache,sizeof(log_data_t));
		
	}
	else
	{
		
		goto FLAG;
	}

in the relevant event handler:

			case BLE_EVT_TX_COMPLETE:
     
            notification_buffer_is_free = true;
            break;

Like I said BLE_EVT_TX_COMPLETE never got triggered at all. I'm suspecting that my code turned into an infinite loop and the BLE_EVT_TX_COMPLETE isn't a high priority interrupt so it never got the chance to change the notification_buffer_is_free flag.

How am I supposed to do it? And please don't tell me in order to use BLE_EVT_TX_COMPLETE, I need to get all the other 999,998 of 999,999 things necessary right to be successfully using BLE_EVT_TX_COMPLETE, lol.

Parents
  • @petter

    Hello Petter, I decided to wait in the main loop as I reckon it would be quite unwise to be otherwise, why not do things just like most other people?

    The thing is, after doing just that, my code is working perfectly. Sorry for the late update. Clearly wait for an interrupt (in this case, the tx complete event) while doing a loop isn't the best way to get things done.

    Thank you again for your help!

Reply
  • @petter

    Hello Petter, I decided to wait in the main loop as I reckon it would be quite unwise to be otherwise, why not do things just like most other people?

    The thing is, after doing just that, my code is working perfectly. Sorry for the late update. Clearly wait for an interrupt (in this case, the tx complete event) while doing a loop isn't the best way to get things done.

    Thank you again for your help!

Children
No Data
Related