I have been working on a project with 4 UARTs.
One of them will be used to transfer some data to external devices and receive some answers.
However, the answers can have different sizes.
I am trying to use the SDK examples of UART transfer interrupt. But, the callback only use to work then the receive buffer is completed.
Since the answer's size is not always the same, what is the best way to do it?
I'm using RT1051.
Thanks in advance.
You may like to consider the uTasker project for i.MX RT.
It allows all i.MX RT LPUARTs to be used in interrupt or DMA modes (also Rx free running DMA is possible which is a solution that hasn't been seen any where else yet).
In addition it supports MODBUS ASCII and RTU on as many LPUARTs as are available in the chip (as well as over TCP).
Finally it allows the i.MX RT to be simulated in approx. real-time whereby all LPUARTs are emulated [including interrupts and DMA operation] (allowing them to be connected to PC UARTs or virtual COM ports for complete testing and debugging in Visual Studio). This results in much reduced development times and more accurate solutions in comparison to using examples and more traditional techniques; its drivers have been proven over years of use in millions of industrial products.
Ok, it's a nice suggestion.
For the first moment, I will try to develop it without uTasker, but I will consider it for future applications.
So, I still have a basic question.
What are the differences between transport and interrupts UART method?
I am not sure about the advantages of each method.
Thanks in advance.
The examples normally include a polled method and an interrupt method.
The polled method is very primitive to give a basic understanding of the operation and is not recommended for real use since it has a high risk of losing reception characters when the polling rate is not high enough during to other processor activity.
This means that the lowest level solution for real work is interrupt driven mode and for improved efficiency DMA can be used.
[uTasker project developer for Kinetis and i.MX RT]