<?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>S32K中的主题 Re: S32K344 bare-metal DMA initialization</title>
    <link>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2070986#M47315</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I disabled a source address offset but nothing changed. There's no error flags in EDMA. I have buffers in non-cacheable SRAM.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;NVIC-&amp;gt;ISER[0] = 0x10; NVIC-&amp;gt;ISER[5] = 0x40; NVIC-&amp;gt;ICER[0] = 0x10; NVIC-&amp;gt;ICER[5] = 0x40&lt;BR /&gt;&lt;BR /&gt;EDMA-&amp;gt;CSR = 0x300000&lt;BR /&gt;&lt;BR /&gt;Other register fields in EDMA and NVIC are null.</description>
    <pubDate>Mon, 31 Mar 2025 08:53:48 GMT</pubDate>
    <dc:creator>mateusz_swiszcz</dc:creator>
    <dc:date>2025-03-31T08:53:48Z</dc:date>
    <item>
      <title>S32K344 bare-metal DMA initialization</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2069296#M47214</link>
      <description>&lt;P&gt;I've got a problem with DMA init. I was unable to initialize DMA by using bare-metal programming.&amp;nbsp;The interrupt is not called and no data is passed. Meanwhile interrupt from SPI is working. Could you check my DMA configuration? I also set a "LPSPI_DER_RDDE" bit in "IP_LPSPI/n/-&amp;gt;DER" register. This should set DMA for receive data.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void DMA_Init(volatile uint32_t rxBuffer) {
	/*
	For remaining S32K3xx devices: DMAMUX_0 channel 0-15 and DMAMUX_1 channel 0-15 are
	mapped to eDMA Transfer Control Descriptor(TCD) 0-15 and eDMA Transfer Control Descriptor(TCD)
	16-31, respectively
	*/

	// TCD register init
    IP_TCD-&amp;gt;TCD0_SADDR = 0U;
    IP_TCD-&amp;gt;TCD0_SOFF = 0;
    IP_TCD-&amp;gt;TCD0_ATTR = 0U;
    IP_TCD-&amp;gt;NBYTES0.TCD0_NBYTES_MLOFFNO = 0U;
    IP_TCD-&amp;gt;NBYTES0.TCD0_NBYTES_MLOFFYES = 0U;
    IP_TCD-&amp;gt;TCD0_SLAST_SDA = 0;
    IP_TCD-&amp;gt;TCD0_DADDR = 0U;
    IP_TCD-&amp;gt;TCD0_DOFF = 0;
    IP_TCD-&amp;gt;CITER0.TCD0_CITER_ELINKNO = 0U;
    IP_TCD-&amp;gt;CITER0.TCD0_CITER_ELINKYES = 0U;
    IP_TCD-&amp;gt;TCD0_DLAST_SGA = 0;
    IP_TCD-&amp;gt;TCD0_CSR = 0U;
    IP_TCD-&amp;gt;BITER0.TCD0_BITER_ELINKNO = 0U;
    IP_TCD-&amp;gt;BITER0.TCD0_BITER_ELINKYES = 0U;

    //===== DMA MUX =====//
	// Enable a source without periodic triggering
	// 1. Determine the DMA channel with which the source is associated.
	// LPSPI1 DMA RX Request -&amp;gt; Source 46
	// 2. Write 0 to CHCFGn[ENBL] and CHCFGn[TRIG] of the DMA channel.
	IP_DMAMUX_0-&amp;gt;CHCFG[0] &amp;amp;= ~DMAMUX_CHCFG_ENBL_MASK;
	IP_DMAMUX_0-&amp;gt;CHCFG[0] &amp;amp;= ~DMAMUX_CHCFG_TRIG_MASK;
	// 3. You can enable the DMA channel at this point.
	IP_DMAMUX_0-&amp;gt;CHCFG[0] |= DMAMUX_CHCFG_ENBL_MASK;
	// 4. Select the source to be routed to the DMA channel.
	IP_DMAMUX_0-&amp;gt;CHCFG[0] |= DMAMUX_CHCFG_SOURCE(46);

	//===== eDMA =====//
    // 1. Write to the CSR if a configuration other than the default is wanted.
    // 2. Write the channel priority levels to the CHn_PRI registers and group priority levels to the CHn_GRPRI registers if a
    // configuration other than the default is wanted.
    // 3. Enable error interrupts in the CHn_CSR[EEI] registers if they are wanted.
	// 4. Write the 32-byte TCD for each channel that may request service.
	// CH0_SBR_MID: Default master id -&amp;gt; 0b10
	// Source address -&amp;gt; SPI receive buffer
	IP_TCD-&amp;gt;TCD0_SADDR = IP_LPSPI_1-&amp;gt;RDR;
	// Destination address
	IP_TCD-&amp;gt;TCD0_DADDR = rxBuffer;
	// Source Address Offset
	IP_TCD-&amp;gt;TCD0_SOFF = 4;
	// Destination Address Offset
	IP_TCD-&amp;gt;TCD0_DOFF = 4;
	// Source size: 32-bit
	IP_TCD-&amp;gt;TCD0_ATTR |= DMA_TCD_TCD0_ATTR_SSIZE(0b10);
	// Destination size: 32-bit
	IP_TCD-&amp;gt;TCD0_ATTR |= DMA_TCD_TCD0_ATTR_DSIZE(0b10);

	// 4 byte transfer
	IP_TCD-&amp;gt;NBYTES0.TCD0_NBYTES_MLOFFNO = 4;
	// Current Major Loop Count
	IP_TCD-&amp;gt;CITER0.TCD0_CITER_ELINKNO = 1;
	// Beginning Major Loop Count
	IP_TCD-&amp;gt;BITER0.TCD0_BITER_ELINKNO = 1;

	// Interrupt after transfer is complete
	IP_TCD-&amp;gt;TCD0_CSR |= DMA_TCD_TCD0_CSR_INTMAJOR_MASK;

	// Enable interrupt
	__NVIC_ClearPendingIRQ(DMATCD0_IRQn);
	__NVIC_SetPriority(DMATCD0_IRQn, 0);
	__NVIC_EnableIRQ(DMATCD0_IRQn);

	// 5. Enable any hardware service requests via the CHn_CSR[ERQ] registers.
	IP_TCD-&amp;gt;CH0_CSR |= DMA_TCD_CH0_CSR_ERQ_MASK;
	
}

void DMATCD0_Handler(void) {
	// Print rxBuffer
	printf("rxBuffer: %ld", rxBuffer);
	// Clear interrupt request
	IP_TCD-&amp;gt;CH0_INT = 1;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2025 07:47:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2069296#M47214</guid>
      <dc:creator>mateusz_swiszcz</dc:creator>
      <dc:date>2025-03-27T07:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: S32K344 bare-metal DMA initialization</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2070272#M47267</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/224178"&gt;@mateusz_swiszcz&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;You should not offset the source address (TCD0_SOFF), but otherwise I don't see any issue in the code.&lt;/P&gt;
&lt;P&gt;Is there any error flag set in EDMA?&lt;/P&gt;
&lt;P&gt;Do you have the buffers in non-cacheable SRAM?&lt;/P&gt;
&lt;P&gt;Can you dump the EDMA and NVIC registers and share it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2025 11:00:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2070272#M47267</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2025-03-28T11:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: S32K344 bare-metal DMA initialization</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2070986#M47315</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I disabled a source address offset but nothing changed. There's no error flags in EDMA. I have buffers in non-cacheable SRAM.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;NVIC-&amp;gt;ISER[0] = 0x10; NVIC-&amp;gt;ISER[5] = 0x40; NVIC-&amp;gt;ICER[0] = 0x10; NVIC-&amp;gt;ICER[5] = 0x40&lt;BR /&gt;&lt;BR /&gt;EDMA-&amp;gt;CSR = 0x300000&lt;BR /&gt;&lt;BR /&gt;Other register fields in EDMA and NVIC are null.</description>
      <pubDate>Mon, 31 Mar 2025 08:53:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2070986#M47315</guid>
      <dc:creator>mateusz_swiszcz</dc:creator>
      <dc:date>2025-03-31T08:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: S32K344 bare-metal DMA initialization</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2071226#M47324</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/224178"&gt;@mateusz_swiszcz&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Could you share the whole project so that I can test it?&lt;/P&gt;
&lt;P&gt;It can be shared privately via a support ticket.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2025 13:51:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2071226#M47324</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2025-03-31T13:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: S32K344 bare-metal DMA initialization</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2071708#M47337</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/160001"&gt;@danielmartynek&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The whole projects&amp;nbsp;&lt;SPAN&gt;is in the attachment.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 06:24:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2071708#M47337</guid>
      <dc:creator>mateusz_swiszcz</dc:creator>
      <dc:date>2025-04-01T06:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: S32K344 bare-metal DMA initialization</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2072069#M47358</link>
      <description>&lt;P&gt;HI&amp;nbsp;Mateusz,&lt;/P&gt;
&lt;P&gt;Thanks for the project.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, I enabled DMAMUX_0_CH0 at 4028_0000h + 0x3.&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;IP_DMAMUX_0-&amp;gt;CHCFG[3] = 0xAE;&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielmartynek_0-1743512787294.png" style="width: 483px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/330806i6799A1E2B6DC28BA/image-dimensions/483x152?v=v2" width="483" height="152" role="button" title="danielmartynek_0-1743512787294.png" alt="danielmartynek_0-1743512787294.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then I saw that SBE = 1 Source bus error in the&amp;nbsp;TCD0 descriptor.&lt;/P&gt;
&lt;P&gt;The TCD0_SADDR register was not configured (checked in the register view)&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;IP_TCD-&amp;gt;TCD0_SADDR = &amp;amp;IP_LPSPI_1-&amp;gt;RDR;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, it gets to the DMA handler:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielmartynek_1-1743513063363.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/330807iDF12EF10992C01EA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="danielmartynek_1-1743513063363.png" alt="danielmartynek_1-1743513063363.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 13:12:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2072069#M47358</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2025-04-01T13:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: S32K344 bare-metal DMA initialization</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2074177#M47482</link>
      <description>Thanks for the help, it works</description>
      <pubDate>Fri, 04 Apr 2025 09:14:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2074177#M47482</guid>
      <dc:creator>mateusz_swiszcz</dc:creator>
      <dc:date>2025-04-04T09:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: S32K344 bare-metal DMA initialization</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2075064#M47531</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/160001"&gt;@danielmartynek&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why does CHCFG[3] works and CHCFG[0] not when I'm using TCD0 and Channel 0 of DMA? How can i match numbers of CHCFG[n], TCDn, CHn in case of other instances of SPI or other peripheries?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Apr 2025 10:02:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2075064#M47531</guid>
      <dc:creator>mateusz_swiszcz</dc:creator>
      <dc:date>2025-04-07T10:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: S32K344 bare-metal DMA initialization</title>
      <link>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2075088#M47532</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/224178"&gt;@mateusz_swiszcz&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Here is the offset of the registers:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielmartynek_0-1744022054705.png" style="width: 492px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/331618i316B02EA895028A9/image-dimensions/492x204?v=v2" width="492" height="204" role="button" title="danielmartynek_0-1744022054705.png" alt="danielmartynek_0-1744022054705.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielmartynek_1-1744022091817.png" style="width: 492px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/331619i2480C0191840CA36/image-dimensions/492x123?v=v2" width="492" height="123" role="button" title="danielmartynek_1-1744022091817.png" alt="danielmartynek_1-1744022091817.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Apr 2025 10:35:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K344-bare-metal-DMA-initialization/m-p/2075088#M47532</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2025-04-07T10:35:24Z</dc:date>
    </item>
  </channel>
</rss>

