Kinetis K64F Uart DMA Interruption not Firing

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Kinetis K64F Uart DMA Interruption not Firing

2,664件の閲覧回数
leonardobueno
Contributor I

I am using all UARTS on kinetis K64F to control several peripherals. I created a baremetal drivers based on KSDS 1.2 to handle the uarts. This lib initializes uarts that have eDMA channels using fsl_uart_edma_driver.h just like the uart_edma_non_blocking_example_frdmk64f example.

There are a few changes though. I replaced the RX Interruption Handler function, and I changed the interruption priority to avoid conflict with the RTOS timer.

All the UARTs sends data fine using the KSDK functions, but only uart 0 receives data from the peripheral. And I don't see a reason for that, since I am initializing all the UARTs the same way and making sure the indexes and variables are correct for each UART.

Bellow is the important part of the initiation code.

The Global Variables are declared on an external config file, but the general types can be seen bellow. All the Arrays have the same number of positions as there are UARTs on the microcontroller.

The PinConfigTable declares how to initialize the Port Mux, the PortConfig included de configuration of baud and etc, Port Instance has the UART Instance.

pastedImage_2.png

At the initialization code, PortId is used as an index for my configuration tables, while the portInstance is the instance of device UART. On the code bellow I initialize the UART with EDMA.

pastedImage_0.png

Here is the part where I configure the RX pin. First the PortMux is enabled and configured, and than my callback is used to replace the KSDK one so I can handle the incoming data on my way. After setting the channel priority I start the receiving process.

pastedImage_1.png

It works fine for all the TX channels, and for the UART 0 RX, but the other RX channels do not work. As I checked, changing the priority and not installing the callback does not affect the result. The eDMA RX interruptions simply dont fire.

Any guess on what might be causing this behavior?

UPDATE 1:

I just edited the KSDK example mentioned above to work with UART1, and I have exactly the same behavior. Even using the FRDM K64F, with no changes on clock, interruptions, and any other configurations, the RX do not work.

UPDATE 2:

Edited the KSDK example to work with UART 2 and eDMA and it worked fine on both the FRDM board and on my prototype. I believe its some clock configuration that is not working properly. I use the clock configuration bellow declared on system_MK64F12.h version 2.5.

   0 ... Default  part configuration

         Multipurpose Clock Generator (MCG) in FEI mode.

         Reference clock source for MCG module: Slow internal reference clock

         Core clock = 20.97152MHz

         Bus clock  = 20.97152MHz

Does this affect the DMA?

ラベル(1)
0 件の賞賛
返信
10 返答(返信)

2,048件の閲覧回数
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

Please refer KSDK Rev. 1.3.0 uart example for TWR-K64F120M board, the detailed example path is below:

C:\Freescale\KSDK_1.3.0\examples\twrk64f120m\driver_examples\uart\uart_edma_non_blocking\iar

Customer could run this demo at TWR-K64F120M board and check if UART1 could using EDMA module driver normally.

If yes, customer could compare the EDMA module register value and check if there with any difference setting.

Wish it helps.

best regards,

Ma Hui

0 件の賞賛
返信

2,048件の閲覧回数
leonardobueno
Contributor I

Dear Ma Hui,

I did what you proposed. The code configures both TX and RX DMA channels on my project and on KSDK project. But, it on my project it doesnt fire the RX interruptions, while on the KSDK project it works. I can't see why this is happening.

Do you have any guess?

Thank you for your patience

Leonardo Bueno

0 件の賞賛
返信

2,048件の閲覧回数
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

I would recommend customer to compare the eDMA/ UART registers difference after the eDMA module and UART module be initialized.

Wish it helps

Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

2,048件の閲覧回数
leonardobueno
Contributor I

Dear Ma Hui,

This is what I am having when I tried to experimento with the FreeRTOS. I put the edma and the uart initialization inside a FreeRTOS task. This way I am trying to avoid the problems related on [RTOS Support] DMA usart issue on STM32F4 . With this, I got the UART 1 to work fine, as well as the UART 0. But all other UARTs as with the same issue. Only the TXs are working, not the RXs.

I checked the registers you sugested and compared them with the KSDK examples. I have not seen anything unsual. They are set equally. Do you have any other idea I should try?

Thank you for your patience

Leonardo Bueno

0 件の賞賛
返信

2,048件の閲覧回数
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

Sorry for the later reply.

From the above description, when customer using FreeRTOS task to initialize DMA and UART, the UART1 could work fine with both RX and TX? Right?


Wish it helps
Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

2,048件の閲覧回数
leonardobueno
Contributor I

Dear Ma Hui,

Yes, that is correct. When I initialise the DMA and the UART before the FreeRTOS all the TXs work, but only the UART0 RX works. If I initialise the DMA and the UART inside a FreeRTOS task, all the TXs still work, and only UART0's and UART1's RXs work. The table bellow may help understanding.

                                                 INITIALIZATION MOMENT

                    DMA nad UART before RTOS     DMA and UART inside RTOS

UART0TX               OK                                                       OK

UART0RX               OK                                                      OK

UART1TX               OK                                                      OK

UART1RX       NOT WORKING                                         OK

UART2TX               OK                                                      OK

UART2RX       NOT WORKING                               NOT WORKING

UART3TX               OK                                                      OK

UART3RX       NOT WORKING                               NOT WORKING

Is there anything I am missing? Should I do anything differently?

Thank you for your patience

Leonardo Bueno

0 件の賞賛
返信

2,048件の閲覧回数
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

Have you tried to initialize only UART2 module with DMA to check if it working status?

For there with more UART modules could trigger DMA engine, the DMA module only with one channel work at the same time.

There exists the channel preemption situation with high priority channel will engage the DMA engine.

Please check if each UART module could work with DMA separately.

If yes, there need to balance the DMA channel priority to make each DMA channels has chance to work.


Wish it helps
Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

2,048件の閲覧回数
leonardobueno
Contributor I

Dear Ma Hui,

Here is what I am having. I initialized only the individual UART Ports and tested them using a different hardware. I could make all of them work. But when I tested them using my hardware I observed the DMA is fired by and active edge detection on the UARTs and after that it stops firing. This active edge happens when I power on the external modules communication with my device. Even if I disable the active edge interruption on every uart port, the DMA are still fired once and than frozen. Is there any way to avoid this active edge problem? I need to turn on and off my external devices very often on my application, but when I do so, the uart fires the DMA without characters and the DMA channel stops working. Any idea?

Thank you for your patience

Leonardo Bueno

0 件の賞賛
返信

2,048件の閲覧回数
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

Could you share the eDMA related initialization code and UART initialization code for checking?

I am not sure you mentioned the different hardware is NXP provided TWR-K64F120M board or FRDM-K64F board?

What 's the difference hardware design between you mentioned different hardware with your hardware about UART related circuit?

If there with some product design secrete, we would recommend customer to submit a new issue to NXP support.


Wish it helps
Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

2,048件の閲覧回数
leonardobueno
Contributor I

Dear Ma Hui,

Thanks for answering so quickly. Here are some results I am obtaining. After many tests I noticed that on my project, the UART RX only bugs when I am executing it inside a FREERTOS task. Even though all the DMA and UART as correctly configured.

Do you know of any configuration of the FREERTOS that may interfere on this behavior?

Thank you for your patience

Leonardo Bueno

0 件の賞賛
返信