I am trying to use the Zero Copy TX Transfer Mode for Sending Data via UART peripheral but getting an assertion failure at
ioutilsGIVE_ZERO_COPY_MUTEX
.
In my task, I am calling the the FreeRTOS
write as follows:
~~~
const uint8t text[] = “————–rn”;
xReturned = FreeRTOS_ioctl( xUART0Handle, ioctlOBTAIN_WRITE_MUTEX, (void *)(50UL/portTICK_RATE_MS));
if( xReturned == pdTRUE )
{
xReturned = FreeRTOS_write(xUART0Handle, text, 16);
}
~~~
Within the FreeRTOS_write function, I am calling the
ioutilsINITIATE_ZERO_COPY_TX
which initiates the transfer. Once the transfer is complete, the ISR for the peripheral is called where I am calling the
ioutilsGIVE_ZERO_COPY_MUTEX
.
This is where the assertion fails within queue.c ->
BaseType_t xQueueGiveFromISR(QueueHandle_t xQueue, BaseType_t *const pxHigherPriorityTaskWoken)
.
~~~
/* Normally a mutex would not be given from an interrupt, especially if
there is a mutex holder, as priority inheritance makes no sense for an
interrupts, only tasks. */
configASSERT(!((pxQueue->uxQueueType == queueQUEUE_IS_MUTEX) && (pxQueue->pxMutexHolder != NULL)));
~~~
I am not sure where I am going wrong and would appreciate any help. Thanks!