Hi, I'm working with the S32K144 evaluation board but I'm having some trouble using LPUART and eDMA modules. I want to implement something like that:
I'm using the drivers provided by the S32K14x EAR 0.8.6 SDK. I generated all the code (processor code) for both eDMA and LPUART with the right configuration:
After eDMA and LPUART initialization, I call the function LPUART_ReceiveData provoking the following function call:
So my questions are:
Thanks you all!
Bye.
Hi IgoI am trying to implement the same functionality but the issue is i am not able to read from console. Could you please tell me how you set up the communication from PC ?
Hello,
The driver configures the DMA engine to transfer the number of bytes received as parameter to the send/receive function; each of these bytes will be then transferred by the DMA to/from the user buffer upon a request from the LPUART, with no CPU intervention.
Could you please share your project so we can take a look? Maybe there's something wrong in the configuration, I don't think I fully understood the problem.
Thanks,
Vlad
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:
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.
Hi,
Sorry for the delayed response, I'm glad it worked out. The DMA interrupt for the channel allocated for LPUART would be triggered when the transfer completed and, for blocking operation, would call the semaPost function in order to let the blocking function know that it can return (no timeout on the semaWait). If the priority of that interrupt was higher than the FreeRTOS max priority, the program would get stuck in the assert statement you mentioned. Hope this explanation clears things out, if necessary.
Regards,
Vlad
I believe the issue in this case is that the EDMA driver does not actually set an interrupt priority for the DMA channels, so they default to 0. I found this same bug still exists in the 2.6 SDK for the iMX RT1050.