ESP32 FreeRTOS - Posting to a queue from BLE GATT event handler
Posted: 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!
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!