It's true. I was interpretating wrongly the driver function. Now I'm able to receive a block of UART messages without interrupting the CPU at each new message, but only when the last message of the block is moved in memory by the DMA. At this point a callback function is called, but there is a problem.
I'm using FreeRTOS and it seems that when I call LPUART_ReceiveData at a certain point the execution freezes on:
configASSERT( ucCurrentPriority >= ucMaxSysCallPriority );
Above this command there is a comment:
/*
The following assertion [i.e., configASSERT(...)] will fail if a service routine (ISR) for
an interrupt that has been assigned a priority above
configMAX_SYSCALL_INTERRUPT_PRIORITY calls an ISR safe FreeRTOS API
function. ISR safe FreeRTOS API functions must *only* be called
from interrupts that have been assigned a priority at or below
configMAX_SYSCALL_INTERRUPT_PRIORITY
[...]
Interrupts that use the FreeRTOS API must not be left at their
default priority of zero as that is the highest possible priority,
which is guaranteed to be above configMAX_SYSCALL_INTERRUPT_PRIORITY,
and therefore also guaranteed to be invalid.
*/
The problem is that I don't know which is the interrupt it is reffering to.
The LPUART_DRV_ReceiveDataBlocking performs the following things:
- calls The LPUART_DRV_StartReceiveDataUsingDma function which:
- configures the block transfer
- installs the callback LPUART_DRV_CompleteReceiveDataUsingDMA that invoke the callback I installed on the LPUART receiver
- enables the overrun interrupt: LPUART_SetIntMode(base, LPUART_INT_RX_OVERRUN, true);
- starts the DMA channel
- enables the DMA requests for LPUART Receiver
2. if LPUART_DRV_StartReceiveDataUsingDma returns with success, we have finished the block transfer.
In this code, I can't see where interrupt has been instantiated except for the overrun interrupt error, that should not occur since I'm transferring messages with the DMA.
I think that the callback functions are called inside the interrupt service routine referred to the dma end of transfer interrupt, but I can't see this in the code.
EDIT (SOLUTION)
I solved the problem by changing the priority of the DMA channel 0 (the one connected to the LPUART1_RX) to 2 instead of 0. Thanks anyway.