<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reading GPIO using DMA and PIT in i.MX RT Crossover MCUs</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1969592#M32096</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/130609"&gt;@lukasz_iwaszkie&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your updated information.&lt;/P&gt;
&lt;P&gt;I import a SDK demo, and modify it, I can use DMA to transfer GPIO status to Buffer.&lt;/P&gt;
&lt;P&gt;I use MIMXRT1170-EVKB board, and circle read GPIO13_00Pin(SW7)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mayliu1_3-1728455420108.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/303650i9D420771985A8181/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mayliu1_3-1728455420108.png" alt="mayliu1_3-1728455420108.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Please pay attention to the following points：&lt;/P&gt;
&lt;P&gt;1：The target cache type should be 4 bytes&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mayliu1_5-1728455476649.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/303653i17D2E538D25E75D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mayliu1_5-1728455476649.png" alt="mayliu1_5-1728455476649.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2：you can use &lt;SPAN&gt;GPIOXX-&amp;gt;DR to&amp;nbsp;&lt;/SPAN&gt;read GPIO status.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mayliu1_4-1728455455890.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/303652iAA188B15DDAC7AAD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mayliu1_4-1728455455890.png" alt="mayliu1_4-1728455455890.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3：I use while(1) and delay to circle start DMA transfer, you can change it, using PIT timer to trigger&amp;nbsp; DMA transfer.&lt;/P&gt;
&lt;P&gt;Wish it helps you.&lt;BR /&gt;If you still have question about it, please kindly let me know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;mayliu&lt;/P&gt;</description>
    <pubDate>Wed, 09 Oct 2024 06:34:27 GMT</pubDate>
    <dc:creator>mayliu1</dc:creator>
    <dc:date>2024-10-09T06:34:27Z</dc:date>
    <item>
      <title>Reading GPIO using DMA and PIT</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1967788#M32065</link>
      <description>&lt;P&gt;Dear community.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I started experimenting with imxrt1011 (on EVK board) and can't get eDMA to read GPIO2 periodically. I verified that GPIO2-&amp;gt;PSR returns the state of my pins (polling). Pin configuration is generated by MCUXpresso Config Tool BTW - 8 pins are set to GPIO2 inputs. I checked that my DMA example (modified ping-pong example) woks when I source data from memory buffer instead of GPIO2-&amp;gt;PSR. PIT also seems to be working, because I checked on an oscilloscope that I can slow down DMA transfers using it. Yet, when I try to source data from GPIO2-&amp;gt;PSR nothing happens, and even my callback (EDMA_Callback) doesn't get called.&amp;nbsp; My DMA configuration is as follows:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;AT_NONCACHEABLE_SECTION_ALIGN_INIT (uint8_t destBuf[BUFFER_LENGTH], 32) = {0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U};

void init ()
{
        CLOCK_SetMux (kCLOCK_PerclkMux, 1U);
        CLOCK_SetDiv (kCLOCK_PerclkDiv, 0U);

        pit_config_t pitConfig{};
        PIT_GetDefaultConfig (&amp;amp;pitConfig);
        PIT_Init (PIT, &amp;amp;pitConfig);
        PIT_SetTimerPeriod (PIT, kPIT_Chnl_0, USEC_TO_COUNT (1000U, CLOCK_GetFreq (kCLOCK_OscClk)));
        PIT_StartTimer (PIT, kPIT_Chnl_0);

        edma_transfer_config_t transferConfig{};
        edma_config_t userConfig{};

        DMAMUX_Init (DMAMUX);
        DMAMUX_EnableChannel (DMAMUX, EDMA_CHANNEL_0);
        DMAMUX_EnableAlwaysOn (DMAMUX, EDMA_CHANNEL_0, true);
        DMAMUX_EnablePeriodTrigger (DMAMUX, EDMA_CHANNEL_0);

        EDMA_GetDefaultConfig (&amp;amp;userConfig);
        EDMA_Init (DMA0, &amp;amp;userConfig);
        EDMA_CreateHandle (&amp;amp;g_EDMA_Handle, DMA0, EDMA_CHANNEL_0);
        EDMA_SetCallback (&amp;amp;g_EDMA_Handle, EDMA_Callback, nullptr);
        EDMA_ResetChannel (g_EDMA_Handle.base, g_EDMA_Handle.channel);

        // Prepare descroptor 0
        EDMA_PrepareTransfer (&amp;amp;transferConfig,
                              (void *)&amp;amp;GPIO2-&amp;gt;PSR,       // srcAddr eDMA transfer source address.
                              1,                         // srcWidth eDMA transfer source address width(bytes).
                              &amp;amp;destBuf[0],               // destAddr eDMA transfer destination address.
                              1,                         // destWidth eDMA transfer destination address width(bytes).
                              1,                         // bytesEachRequest (minor count B) eDMA transfer bytes per channel request.
                              HALF_BUFFER_LENGTH,        // transferBytes (major * minor count B) eDMA transfer total B.
                              kEDMA_PeripheralToMemory); // transferType eDMA transfer type.

        EDMA_TcdSetTransferConfig (&amp;amp;tcdMemoryPoolPtr[0], &amp;amp;transferConfig, &amp;amp;tcdMemoryPoolPtr[1]);

        // Prepare descroptor 1
        EDMA_PrepareTransfer (&amp;amp;transferConfig,
                              (void *)&amp;amp;GPIO2-&amp;gt;PSR,          // srcAddr
                              1,                            // srcWidth
                              &amp;amp;destBuf[HALF_BUFFER_LENGTH], // destAddr
                              1,                            // destWidth
                              1,                            // bytesEachRequest
                              HALF_BUFFER_LENGTH,           // transferBytes
                              kEDMA_PeripheralToMemory);    // transferType

        EDMA_TcdSetTransferConfig (&amp;amp;tcdMemoryPoolPtr[1], &amp;amp;transferConfig, &amp;amp;tcdMemoryPoolPtr[0]);

        EDMA_TcdEnableInterrupts (&amp;amp;tcdMemoryPoolPtr[0], kEDMA_ErrorInterruptEnable | kEDMA_MajorInterruptEnable);
        EDMA_TcdEnableInterrupts (&amp;amp;tcdMemoryPoolPtr[1], kEDMA_ErrorInterruptEnable | kEDMA_MajorInterruptEnable);
        EDMA_InstallTCD (DMA0, EDMA_CHANNEL_0, tcdMemoryPoolPtr);
        EDMA_EnableAutoStopRequest (DMA0, EDMA_CHANNEL_0, false);
        EDMA_StartTransfer (&amp;amp;g_EDMA_Handle);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 09:28:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1967788#M32065</guid>
      <dc:creator>lukasz_iwaszkie</dc:creator>
      <dc:date>2024-10-07T09:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: Reading GPIO using DMA and PIT</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1967863#M32066</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/130609"&gt;@lukasz_iwaszkie&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Thank you for your interest in the NXP MIMXRT product, I would&amp;nbsp; like to provide service for you.&lt;/P&gt;
&lt;P&gt;I think there's a bit of a problem with the code you wrote(EDMA_PrepareTransfer), Please check it.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mayliu1_0-1728301564772.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/303083iD7AC49E66AE50229/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mayliu1_0-1728301564772.png" alt="mayliu1_0-1728301564772.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In SDK library, fsl_edma.c describe&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;EDMA_PrepareTransfer as follows.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="background-color: #ffffff; padding: 0px 0px 0px 2px;"&gt;
&lt;DIV style="color: #000000; background-color: #ffffff; font-family: 'Courier New'; font-size: 10pt; white-space: pre;"&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt;The data address and the data width must be consistent. For example, if the SRC&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt; * is 4 bytes, the source address must be 4 bytes aligned, or it results in&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0;"&gt;&lt;SPAN&gt; * source address error (SAE).&lt;/SPAN&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mayliu1_2-1728301692908.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/303085iE8EB1950989B654C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mayliu1_2-1728301692908.png" alt="mayliu1_2-1728301692908.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Please modify the&amp;nbsp;&lt;SPAN&gt;EDMA_PrepareTransfer function param, and then try to test the project again.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wish it helps you.&lt;BR /&gt;If you still have question about it, please kindly let me know.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;mayliu&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 11:54:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1967863#M32066</guid>
      <dc:creator>mayliu1</dc:creator>
      <dc:date>2024-10-07T11:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: Reading GPIO using DMA and PIT</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1967880#M32068</link>
      <description>&lt;P&gt;Thanks for a quick reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp; I set srcWidth to 1 hoping for reading 8 least significant bits from GPIO2-&amp;gt;PSR. Is that possible? Do you mean that since GPIO2-&amp;gt;PSR is 32bit I should always read 4B from it? Because otherwise if I do only 1B reads, then, according to what you pasted my corresponding addresses should be 1B aligned, which is always the case isn't it? All things aside, I tried with srcWidth == 4, destWidth == 4 and bytesEachRequest == 4 and nothing changed &lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 12:38:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1967880#M32068</guid>
      <dc:creator>lukasz_iwaszkie</dc:creator>
      <dc:date>2024-10-07T12:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Reading GPIO using DMA and PIT</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1968181#M32072</link>
      <description>&lt;P&gt;I changed GPIO2 to GPIO1 for a test and it worked immediately. And according to &lt;A href="https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Is-it-possible-to-transfer-high-speed-data-via-HSGPIO-using-eDMA/m-p/1933972" target="_self"&gt;this &lt;/A&gt;it seems like HS GPIO is not supported by eDMA (unfortunately). And on RT1011 GPIO2 is HSGPIO, while GPIO1 is regular GPIO...&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 21:55:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1968181#M32072</guid>
      <dc:creator>lukasz_iwaszkie</dc:creator>
      <dc:date>2024-10-07T21:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Reading GPIO using DMA and PIT</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1969592#M32096</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/130609"&gt;@lukasz_iwaszkie&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your updated information.&lt;/P&gt;
&lt;P&gt;I import a SDK demo, and modify it, I can use DMA to transfer GPIO status to Buffer.&lt;/P&gt;
&lt;P&gt;I use MIMXRT1170-EVKB board, and circle read GPIO13_00Pin(SW7)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mayliu1_3-1728455420108.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/303650i9D420771985A8181/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mayliu1_3-1728455420108.png" alt="mayliu1_3-1728455420108.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Please pay attention to the following points：&lt;/P&gt;
&lt;P&gt;1：The target cache type should be 4 bytes&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mayliu1_5-1728455476649.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/303653i17D2E538D25E75D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mayliu1_5-1728455476649.png" alt="mayliu1_5-1728455476649.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2：you can use &lt;SPAN&gt;GPIOXX-&amp;gt;DR to&amp;nbsp;&lt;/SPAN&gt;read GPIO status.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mayliu1_4-1728455455890.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/303652iAA188B15DDAC7AAD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mayliu1_4-1728455455890.png" alt="mayliu1_4-1728455455890.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3：I use while(1) and delay to circle start DMA transfer, you can change it, using PIT timer to trigger&amp;nbsp; DMA transfer.&lt;/P&gt;
&lt;P&gt;Wish it helps you.&lt;BR /&gt;If you still have question about it, please kindly let me know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;mayliu&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 06:34:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1969592#M32096</guid>
      <dc:creator>mayliu1</dc:creator>
      <dc:date>2024-10-09T06:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Reading GPIO using DMA and PIT</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1969912#M32105</link>
      <description>&lt;P&gt;Thank you. Yes, this is very valuable piece of info as well you posted : GPIO registers have to be read as a whole by the eDMA, and in general (that is 32bits). 1010 RM on page 462, chapter 12.5 says: "12.5 GPIO Register Descriptions: There are eight 32-bit GPIO registers. All registers are accessible from the IP interface. &lt;STRONG&gt;Only 32-bit access is supported&lt;/STRONG&gt;."&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 11:50:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1969912#M32105</guid>
      <dc:creator>lukasz_iwaszkie</dc:creator>
      <dc:date>2024-10-09T11:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Reading GPIO using DMA and PIT</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1970968#M32121</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/130609"&gt;@lukasz_iwaszkie&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your updated information.&lt;/P&gt;
&lt;P&gt;I'm glad that you can read the GPIO state with DMA right now, Thanks for the answer that&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;"&lt;/SPAN&gt;DMA does not have access to HS GPIO".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a nice day&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;mayliu&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 05:39:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Reading-GPIO-using-DMA-and-PIT/m-p/1970968#M32121</guid>
      <dc:creator>mayliu1</dc:creator>
      <dc:date>2024-10-10T05:39:34Z</dc:date>
    </item>
  </channel>
</rss>

