DMA to GPIO

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DMA to GPIO

Jump to solution
1,743 Views
swa14720
Contributor I

Hi,

I am using Kinetis MK22 MCU. I want to transfer data from memory to GPIO PortC using DMA. When I gave TCD0_DADDR = address of GPIOC_PSOR, the DMA is not working as expected (i.e the data is not been transferred to  DADDR). Does MK22 DMA support GPIO registers as destination address?

Labels (1)
Tags (3)
0 Kudos
1 Solution
1,465 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Please refer the AN4419 Using DMA and GPIO to emulate timer functionality on Kinetis Family devices
I think you'd better use GPIOx_PDOR instead of use GPIOx_PSOR.

GPIOx_PDOR.png

GPIOx_PSOR.png

Best Regards,

Robin

 

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

View solution in original post

3 Replies
1,466 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Please refer the AN4419 Using DMA and GPIO to emulate timer functionality on Kinetis Family devices
I think you'd better use GPIOx_PDOR instead of use GPIOx_PSOR.

GPIOx_PDOR.png

GPIOx_PSOR.png

Best Regards,

Robin

 

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

1,465 Views
swa14720
Contributor I

Thanks @robin_shen

Thanks for your help. I figured this out and exactly that was the issue.i was trying to write onto psor and read from it. But psor doesn't support read. When I changed Daddr to read from pdor it worked perfectly.

0 Kudos
1,465 Views
mjbcswitzerland
Specialist V

Hi

There is no restriction to doing DMA transfers to GPIO on the K22.

In the uTasker project a reference application is to bridge a UART input to GPIO output (almost as if it were a wired connection) by using this configuration:

        // Configure the DMA trigger from the UART input pin change to toggle an alternative port so that the input signal is mirrored to that output without CPU intervention
        //
        static const unsigned long ulOutput = PORTC_BIT16;               // the output to be mirrored to
        fnConfigDMA_buffer(9, DMAMUX0_CHCFG_SOURCE_PORTB, sizeof(ulOutput), (void *)&ulOutput, (void *)&(((GPIO_REGS *)GPIOC_ADD)->PTOR), (DMA_FIXED_ADDRESSES | DMA_LONG_WORDS), 0, 0); // use DMA channel 9 without any interrupts (free-runnning)

Note that it uses the PTOR register so that every write causes a toggle. Maybe you are not using  suitable register or the value being written to it is not correct (?)

Regards

Mark

Complete Kinetis solutions for professionals, training and support: http://www.utasker.com/kinetis.html
Kinetis K22:
- http://www.utasker.com/kinetis/FRDM-K22F.html
- http://www.utasker.com/kinetis/TWR-K22F120M.html
- http://www.utasker.com/kinetis/BLAZE_K22.html
- http://www.utasker.com/kinetis/tinyK22.html