<?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: S32K144 DMA SPI Processor Expert in S32K</title>
    <link>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1943591#M40321</link>
    <description>&lt;P&gt;I have written the following code. With this I am able to read ID of FLASH chip using&amp;nbsp;LPSPI_DRV_MasterTransferBlocking function.&lt;/P&gt;&lt;P&gt;I also tried to use&amp;nbsp;EDMA_DRV_ConfigSingleBlockTransfer function to do the same but with this I am not able to read the received data from FLASH chip, although on scope I can verify correct data is received from external FLASH in both case.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What should be done so that I can receive data using&amp;nbsp;EDMA_DRV_ConfigSingleBlockTransfer function. I have noticed that clock pulses are only output when data is sent to external flash i.e. in TX mode. In RX mode no clock is sent so I have sent dummy 3-byte data to receive 3 bytes of data from FLASH. But I believe I should send 1 byte data in TX and receive 3byte data in RX if using EDMA driver. Let me know what I am doing wrong here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#include "Cpu.h"

volatile int exit_code = 0;

uint32_t JEDEC_ID;
uint32_t JEDEC_DMA_ID;
uint64_t UNIQUE_ID;
uint8_t  SendData[10];
uint8_t  ReceiveData[10];
uint8_t  ReceiveDataDMA[10];
uint8_t  TxDataSize;

/* User includes (#include below this line is not maintained by Processor Expert) */
#define TIMEOUT 10

int main(void)
{
    /* Processor Expert internal initialization */
    #ifdef PEX_RTOS_INIT
    PEX_RTOS_INIT();
    #endif

    /* Clock and Pin Initialization */
    CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
    CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
    PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
    EDMA_DRV_Init(&amp;amp;dmaController1_State, &amp;amp;dmaController1_InitConfig0, edmaChnStateArray, edmaChnConfigArray, EDMA_CONFIGURED_CHANNELS_COUNT);

    /* Initialize LPSPI2 */
    LPSPI_DRV_MasterInit(LPSPICOM2, &amp;amp;lpspiCom2State, &amp;amp;lpspiCom2_MasterConfig0);
    LPSPI_DRV_MasterSetDelay(LPSPICOM2, 1, 1, 1);

    JEDEC_ID = 0;
    JEDEC_DMA_ID = 0;

    /* Send command 0x9F to read status */
    SendData[0] = 0x9F;
    SendData[1] = 0xFF;
    SendData[2] = 0xFF;
    SendData[3] = 0xFF;
    TxDataSize = 0x04;

    LPSPI_DRV_MasterTransferBlocking(LPSPICOM2, &amp;amp;SendData, &amp;amp;ReceiveData, TxDataSize, TIMEOUT);
    JEDEC_ID = ((ReceiveData[1] &amp;lt;&amp;lt; 16) | (ReceiveData[2] &amp;lt;&amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; | (ReceiveData[3]));

    /* Configure DMA for the next transfer */
    EDMA_DRV_ConfigSingleBlockTransfer(EDMA_CHN1_NUMBER, EDMA_TRANSFER_MEM2PERIPH, SendData,
                                       (uint32_t)&amp;amp;(LPSPI2-&amp;gt;TDR), EDMA_TRANSFER_SIZE_1B, 4);
    EDMA_DRV_ConfigSingleBlockTransfer(EDMA_CHN0_NUMBER, EDMA_TRANSFER_PERIPH2MEM, (uint32_t)&amp;amp;(LPSPI2-&amp;gt;RDR),
                                       ReceiveDataDMA, EDMA_TRANSFER_SIZE_1B, 3);

    /* Start the SPI transfer using DMA */
    EDMA_DRV_TriggerSwRequest(EDMA_CHN1_NUMBER);  // Trigger the DMA to start sending the command
    EDMA_DRV_TriggerSwRequest(EDMA_CHN0_NUMBER);  // Trigger the DMA to start receiving the data

    OSIF_TimeDelay(100); // mS Delay
    while (1);

    /* RTOS startup code */
    #ifdef PEX_RTOS_START
    PEX_RTOS_START();
    #endif

    for (;;)
    {
        if (exit_code != 0)
        {
            break;
        }
    }
    return exit_code;
}&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 29 Aug 2024 14:49:08 GMT</pubDate>
    <dc:creator>Selva24</dc:creator>
    <dc:date>2024-08-29T14:49:08Z</dc:date>
    <item>
      <title>S32K144 DMA SPI Processor Expert</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1940976#M40152</link>
      <description>&lt;P&gt;I want to configure S32K144 DMA to communicate with an external SPI FRAM/FLASH chip, but I am not able to find any example with processor expert how to configure DMA and LPSPI for this application and how to access FRAM read and write. Kindly give some example project or correct method to do this using PE.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 06:53:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1940976#M40152</guid>
      <dc:creator>Selva24</dc:creator>
      <dc:date>2024-08-27T06:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 DMA SPI Processor Expert</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1941467#M40175</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/239641"&gt;@Selva24&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;You can use the included example from the RTM v3.0.0:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Julin_AragnM_0-1724779745423.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/295615iCAAB5CE3B20FDB42/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Julin_AragnM_0-1724779745423.png" alt="Julin_AragnM_0-1724779745423.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;There is also this non-SDK example, which uses the PIT module, and e&lt;SPAN&gt;very trigger starts a minor DMA loop (8 bytes) transfer to the LPSPI1 TX FIFO&lt;/SPAN&gt;:&amp;nbsp;&lt;A href="https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-LPIT-DMA-LPSPI/ta-p/1108628" target="_blank"&gt;Example S32K144 LPIT DMA LPSPI - NXP Community.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Julián&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 17:30:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1941467#M40175</guid>
      <dc:creator>Julián_AragónM</dc:creator>
      <dc:date>2024-08-27T17:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 DMA SPI Processor Expert</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1942276#M40231</link>
      <description>&lt;P&gt;&amp;nbsp;I have used lpspi_dma_s32k144 example and able to send receive data with this. But I am confused if this is proper method of using DMA for data transfer with an external FRAM/FLASH device. I was assuming we have to use:&lt;/P&gt;&lt;P&gt;EDMA_DRV_ConfigSingleBlockTransfer();&lt;/P&gt;&lt;P&gt;EDMA_DRV_ConfigLoopTransfer();&lt;/P&gt;&lt;P&gt;EDMA_DRV_ConfigScatterGatherTransfer();&lt;/P&gt;&lt;P&gt;EDMA_DRV_ConfigMultiBlockTransfer();&lt;/P&gt;&lt;P&gt;one of these functions to do data transfer. Am I wrong? When will this function be used can someone clarify?&lt;/P&gt;&lt;P&gt;What I want to do is I have to store a data log from processor to external FRAM device at periodic intervals and after some particular time or memory fill, I want to transfer FRAM data into external Flash. My FRAM and FLASH will be on same SPI lines with different CS. In this case DMA should take the load off processor and do all this automatically without or with minimum main processor intervention. So which method will be proper way? Is&amp;nbsp;lpspi_dma_s32k144 example correct method or I have to use one of above function or any other function of EDMA driver. I believe EDMA driver should be configured for this, but I am not able to get the correct way to do it. Also, I would prefer to use SDK or processor expert functions to do it. Can you guide me in the right way to achieve this.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 12:51:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1942276#M40231</guid>
      <dc:creator>Selva24</dc:creator>
      <dc:date>2024-08-28T12:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 DMA SPI Processor Expert</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1943591#M40321</link>
      <description>&lt;P&gt;I have written the following code. With this I am able to read ID of FLASH chip using&amp;nbsp;LPSPI_DRV_MasterTransferBlocking function.&lt;/P&gt;&lt;P&gt;I also tried to use&amp;nbsp;EDMA_DRV_ConfigSingleBlockTransfer function to do the same but with this I am not able to read the received data from FLASH chip, although on scope I can verify correct data is received from external FLASH in both case.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What should be done so that I can receive data using&amp;nbsp;EDMA_DRV_ConfigSingleBlockTransfer function. I have noticed that clock pulses are only output when data is sent to external flash i.e. in TX mode. In RX mode no clock is sent so I have sent dummy 3-byte data to receive 3 bytes of data from FLASH. But I believe I should send 1 byte data in TX and receive 3byte data in RX if using EDMA driver. Let me know what I am doing wrong here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#include "Cpu.h"

volatile int exit_code = 0;

uint32_t JEDEC_ID;
uint32_t JEDEC_DMA_ID;
uint64_t UNIQUE_ID;
uint8_t  SendData[10];
uint8_t  ReceiveData[10];
uint8_t  ReceiveDataDMA[10];
uint8_t  TxDataSize;

/* User includes (#include below this line is not maintained by Processor Expert) */
#define TIMEOUT 10

int main(void)
{
    /* Processor Expert internal initialization */
    #ifdef PEX_RTOS_INIT
    PEX_RTOS_INIT();
    #endif

    /* Clock and Pin Initialization */
    CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
    CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
    PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
    EDMA_DRV_Init(&amp;amp;dmaController1_State, &amp;amp;dmaController1_InitConfig0, edmaChnStateArray, edmaChnConfigArray, EDMA_CONFIGURED_CHANNELS_COUNT);

    /* Initialize LPSPI2 */
    LPSPI_DRV_MasterInit(LPSPICOM2, &amp;amp;lpspiCom2State, &amp;amp;lpspiCom2_MasterConfig0);
    LPSPI_DRV_MasterSetDelay(LPSPICOM2, 1, 1, 1);

    JEDEC_ID = 0;
    JEDEC_DMA_ID = 0;

    /* Send command 0x9F to read status */
    SendData[0] = 0x9F;
    SendData[1] = 0xFF;
    SendData[2] = 0xFF;
    SendData[3] = 0xFF;
    TxDataSize = 0x04;

    LPSPI_DRV_MasterTransferBlocking(LPSPICOM2, &amp;amp;SendData, &amp;amp;ReceiveData, TxDataSize, TIMEOUT);
    JEDEC_ID = ((ReceiveData[1] &amp;lt;&amp;lt; 16) | (ReceiveData[2] &amp;lt;&amp;lt; &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; | (ReceiveData[3]));

    /* Configure DMA for the next transfer */
    EDMA_DRV_ConfigSingleBlockTransfer(EDMA_CHN1_NUMBER, EDMA_TRANSFER_MEM2PERIPH, SendData,
                                       (uint32_t)&amp;amp;(LPSPI2-&amp;gt;TDR), EDMA_TRANSFER_SIZE_1B, 4);
    EDMA_DRV_ConfigSingleBlockTransfer(EDMA_CHN0_NUMBER, EDMA_TRANSFER_PERIPH2MEM, (uint32_t)&amp;amp;(LPSPI2-&amp;gt;RDR),
                                       ReceiveDataDMA, EDMA_TRANSFER_SIZE_1B, 3);

    /* Start the SPI transfer using DMA */
    EDMA_DRV_TriggerSwRequest(EDMA_CHN1_NUMBER);  // Trigger the DMA to start sending the command
    EDMA_DRV_TriggerSwRequest(EDMA_CHN0_NUMBER);  // Trigger the DMA to start receiving the data

    OSIF_TimeDelay(100); // mS Delay
    while (1);

    /* RTOS startup code */
    #ifdef PEX_RTOS_START
    PEX_RTOS_START();
    #endif

    for (;;)
    {
        if (exit_code != 0)
        {
            break;
        }
    }
    return exit_code;
}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 29 Aug 2024 14:49:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1943591#M40321</guid>
      <dc:creator>Selva24</dc:creator>
      <dc:date>2024-08-29T14:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 DMA SPI Processor Expert</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1943633#M40338</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/239641"&gt;@Selva24&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;The example showcases a simple way to configure the eDMA and the LPSPI modules. The EDMA_DRV_Init function configures the DMA component, and both&amp;nbsp;LPSPI_DRV_MasterTransfer/SlaveTransfer trigger a MultiBlock transfer if DMA is configured. It is meant to be used as reference and showcases the basic configuration for these peripherals.&lt;/P&gt;
&lt;P&gt;You can also take a look at the edma_transfer_s32k144 example, which may prove more useful for understanding the DMA driver. It demonstrates the following eDMA use cases:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;single block memory to memory transfer&lt;/LI&gt;
&lt;LI&gt;loop memory to memory transfer&lt;/LI&gt;
&lt;LI&gt;memory to memory transfer using scatter/gather&lt;/LI&gt;
&lt;LI&gt;LPUART transmission/reception using DMA requests&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Depending on the transfer method, it uses one of the functions you mentioned. You could either configure a loop transfer or a multiblock transfer each time the LPSPI module triggers, as the example shows.&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Julián&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2024 15:13:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1943633#M40338</guid>
      <dc:creator>Julián_AragónM</dc:creator>
      <dc:date>2024-08-29T15:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 DMA SPI Processor Expert</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1946253#M40490</link>
      <description>Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/200831"&gt;@Julián_AragónM&lt;/a&gt;&lt;BR /&gt;Thanks for helping out. Now I am almost able to achieve what I wanted to do. I still have one doubt.&lt;BR /&gt;LPSPI_DRV_MasterTransfer is a non blocking function while LPSPI_DRV_MasterTransferBlocking is a blocking function meaning processor waits for the reply. My question is if SPI is programmed in DMA mode then does main processor also blocks / waits if blocking function is used? Or only DMA controller will wait and main processor is free to do its work ?</description>
      <pubDate>Tue, 03 Sep 2024 11:28:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1946253#M40490</guid>
      <dc:creator>Selva24</dc:creator>
      <dc:date>2024-09-03T11:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 DMA SPI Processor Expert</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1946671#M40514</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/239641"&gt;@Selva24&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;The&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;LPSPI_DRV_MasterTransferBlocking&amp;nbsp;&lt;/STRONG&gt;will still block the processor since&amp;nbsp;the function does not return any value until the transfer is complete. DMA only helps with memory to peripheral (or peripheral to peripheral) data transmission once the transfer is completed.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;BR /&gt;Julián&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 22:47:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1946671#M40514</guid>
      <dc:creator>Julián_AragónM</dc:creator>
      <dc:date>2024-09-03T22:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 DMA SPI Processor Expert</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1946987#M40536</link>
      <description>Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/200831"&gt;@Julián_AragónM&lt;/a&gt;,&lt;BR /&gt;Ok thanks. So LPSPI_DRV_MasterTransfer with callback function should be most efficient way to implement DMA with minimum main processor interruption I believe.</description>
      <pubDate>Wed, 04 Sep 2024 07:54:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1946987#M40536</guid>
      <dc:creator>Selva24</dc:creator>
      <dc:date>2024-09-04T07:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 DMA SPI Processor Expert</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1947459#M40565</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/239641"&gt;@Selva24&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Yes, that is correct.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2024 17:10:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-DMA-SPI-Processor-Expert/m-p/1947459#M40565</guid>
      <dc:creator>Julián_AragónM</dc:creator>
      <dc:date>2024-09-04T17:10:17Z</dc:date>
    </item>
  </channel>
</rss>

