ESP32 FreeRTOS - Posting to a queue from BLE GATT event handler

jhulbert
Posts: 7
Joined: Thu Jan 28, 2021 9:50 pm

ESP32 FreeRTOS - Posting to a queue from BLE GATT event handler

Postby jhulbert » Wed Nov 17, 2021 4:04 am

I have an ESP32 running as a GATT server which receives 512 bytes of data at a time from the GATT client. I want to then transmit this data over UART.

A pointer to the data gets posted to a FreeRTOS queue, which is received by my uart_tx_task.

I am thinking the fastest way to do this would be to have the Bluetooth controller and Bluedroid running on Core 0, and the uart_tx_task running on Core 1. That way, the data can be transmitted over UART on Core 1, while Core 0 will receive the next 512 bytes of data over BLE.

Questions:

- Do FreeRTOS functions called from the GATT profile event handler need to be the ISR safe versions, i.e. do I need to call xQueueSendFromISR as opposed to xQueueSend?

- When the GATT event handler on Core 1 sends the data to the queue, will uart_tx_task on Core 0 immediately be unblocked and start running, or will it only start running at the next tick interrupt? I know in a normal single core system, you would use the pxHigherPriorityTaskWoken parameter of xQueueSendFromISR in conjunction with taskYIELD_FROM_ISR to achieve this. I'm not sure how the taskYIELD macros fit in with a multicore system.

Thanks!

jhulbert
Posts: 7
Joined: Thu Jan 28, 2021 9:50 pm

Re: ESP32 FreeRTOS - Posting to a queue from BLE GATT event handler

Postby jhulbert » Tue Nov 23, 2021 3:09 am

I think I've answered the first question. Some Espressif examples, such as ble_spp_server call xQueueSend() from the GATT event handler, so the xxxFromISR() versions are not necessary.

I'm still unsure about the second question - any suggestions?

Who is online

Users browsing this forum: Google [Bot] and 97 guests