LPC55S69 Getting nowhere with SPI - DMA - Linked or Ping-Pong transfers

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

LPC55S69 Getting nowhere with SPI - DMA - Linked or Ping-Pong transfers

1,111 Views
IanMcCarthy
Contributor I

This has dragged on for far too long now...

I've been through the examples for single SPI/DMA transfers and these work.

I've been through the examples for DMA/Linked memory transfers and these work.

But none cover my requirement and try s I might I can't get one to fit.

I need a free running SPI TX/RX using DMA with either linked configurations or just ping-pong to start.

Surely there must be someone on here that's achieved this already, who'd be willing to share some knowledge?

The best I've managed so far is a set of linked configurations for SPI_DMA, which execute just once (despite the last linking back to the first) and then stop.

The worse is a single 8-bit transfer for linked 16-bit transfers.

I'm running out of ideas and pretty sure I'm now trying things that have already failed.

Anybody..?

 

Labels (3)
Tags (3)
0 Kudos
Reply
2 Replies

1,093 Views
IanMcCarthy
Contributor I

Third attempt to post an update...

I need to continuously receive data from a slave SPI device at a fixed rate (manually triggering won't meet the requirements).

The code below shows where I'm currently at, but this just generates 2 SPI clock pluses and that's it.

I'm assuming once SPI is configured I can configure a linked set of DMA descriptors and after a single manual start, this will run indefinately, or am I mistaken?

If someone would be willing to help out, it'd be much appreciated.

    srcClock_Hz = EXAMPLE_SPI_MASTER_CLK_FREQ;

    SPI_MasterGetDefaultConfig(&masterConfig);
    masterConfig.sselNum = (spi_ssel_t)EXAMPLE_SPI_SSEL;
    masterConfig.sselPol = (spi_spol_t)EXAMPLE_MASTER_SPI_SPOL;
    masterConfig.dataWidth = kSPI_Data8Bits;

    masterConfig.baudRate_Bps = 8000;

    SPI_MasterInit(EXAMPLE_SPI_MASTER, &masterConfig, srcClock_Hz);
    DMA_Init(EXAMPLE_DMA);

    // Enable channels
    DMA_EnableChannel(EXAMPLE_DMA, EXAMPLE_SPI_MASTER_TX_CHANNEL);
    DMA_EnableChannel(EXAMPLE_DMA, EXAMPLE_SPI_MASTER_RX_CHANNEL);

    // Set channel priorities
    DMA_SetChannelPriority(EXAMPLE_DMA, EXAMPLE_SPI_MASTER_TX_CHANNEL, kDMA_ChannelPriority3);
    DMA_SetChannelPriority(EXAMPLE_DMA, EXAMPLE_SPI_MASTER_RX_CHANNEL, kDMA_ChannelPriority2);

    // Create channel handles
    DMA_CreateHandle(&masterTxHandle, EXAMPLE_DMA, EXAMPLE_SPI_MASTER_TX_CHANNEL);
    DMA_CreateHandle(&masterRxHandle, EXAMPLE_DMA, EXAMPLE_SPI_MASTER_RX_CHANNEL);

    // Set channel callbacks
    DMA_SetCallback(&masterTxHandle, TxCallback, NULL);
    DMA_SetCallback(&masterRxHandle, RxCallback, NULL);
    DMA_SetupDescriptor(
    		&dmaTxDescriptors[0],
				DMA_CHANNEL_XFER(true, false, true, false, 1, 0, 0, 1),
				&masterTxData,
				(void *)&SPI7->FIFOWR,
				&dmaTxDescriptors[1]);

    DMA_SetupDescriptor(
    		&dmaTxDescriptors[1],
				DMA_CHANNEL_XFER(true, false, true, false, 1, 0, 0, 1),
				&masterTxData,
				(void *)&SPI7->FIFOWR,
				&dmaTxDescriptors[2]);

    DMA_SetupDescriptor(
    		&dmaTxDescriptors[2],
				DMA_CHANNEL_XFER(true, false, true, false, 1, 0, 0, 1),
				&masterTxData,
				(void *)&SPI7->FIFOWR,
				&dmaTxDescriptors[0]);


    DMA_PrepareChannelTransfer(&dmaChannelConfig,
    		&masterTxData,
				(void *)&SPI7->FIFOWR,
				DMA_CHANNEL_XFER(true, false, true, false, 1, 0, 0, 1),
				kDMA_MemoryToPeripheral,
				NULL,
				// &dmaChannelTrigger,
				&dmaTxDescriptors[0]
    );

    DMA_SubmitChannelTransfer(&masterTxHandle, &dmaChannelConfig);

    DMA_StartTransfer(&masterTxHandle);

 

0 Kudos
Reply

1,079 Views
PabloAvalos
NXP TechSupport
NXP TechSupport

Hi @IanMcCarthy 

 

I would like to apologize for the delay. We are experimenting an anormal volume of questions these days. I really thank you for your patience.

 

Regarding your question, once you do a single manual start (run on debug session), all the code has to run indefinitely, and SCK from SPI has to generate more than 2 pulses (continuosly until you press stop). I would like to ask for you which example from our SDK you are using for LPC55S69? What changes did you make to the code? So I can reproduce your code on my board and see what is going on.

 

Thank you so much for your help. Please let me know if you have more questions.

 

Best Regards.
Pablo Avalos.

0 Kudos
Reply