GPDMA: Cannot copy from 16-bit SPI to internal memory using available API

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

GPDMA: Cannot copy from 16-bit SPI to internal memory using available API

331 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cfgardiner on Wed Jan 07 08:52:58 MST 2015
Hi,

I have a customer project based on an LPC1837. The hardware has many similarities to the Xpresso board. The customer design however has an external 16-channel ADC connected to SPI1 which I want to read every 1 ms. Using lpcopen standard functions I have done it like this:

      Chip_GPDMA_Init(LPC_GPDMA);
     
      dmaChanSpiRx   = Chip_GPDMA_GetFreeChannel(LPC_GPDMA, GPDMA_CONN_SSP1_Rx);
      dmaChanSpiTx   = Chip_GPDMA_GetFreeChannel(LPC_GPDMA, GPDMA_CONN_SSP1_Tx);

      Chip_SSP_DMA_Enable(LPC_SSP1);
      Chip_GPDMA_Transfer(LPC_GPDMA, dmaChanSpiRx, GPDMA_CONN_SSP1_Rx, &spiDin,  GPDMA_TRANSFERTYPE_P2M_CONTROLLER_DMA, 16);
      Chip_GPDMA_Transfer(LPC_GPDMA, dmaChanSpiTx, &spiDout, GPDMA_CONN_SSP1_Tx, GPDMA_TRANSFERTYPE_M2P_CONTROLLER_DMA, 16);

Using these standard functions however it is not possible to configure the DMA transfer-width to the SPI controller to use sixteen bits. This transfer size is required by the external ADC. Examining the lpcopen code I see the following problems (in gpdma_18xx_43xx.h and gpdma_18xx_43xx.c) :

1) GPDMA_LUTPerWid is static and I see no interface for modifying the default configuration:

2) Chip_GPDMA_Transfer does all the work from initialising and setting up the GPDMA_CH_CFG_T structure through to starting the DMA channel without any chance to modify the TransferSize/TransferWidth elements before the DMA channel is started.

3) configDMAMux(), makeCtrlWord() and setupChannel() are all local functions to gpdma_18xx_43xx.c

Looks like I will have to rewrite a variant of Chip_GPDMA_Transfer() for my Board-Support package or am I missing something? Any chance of fixing this in the next lpcopen release? An API to manipulate  GPDMA_LUTPerWid would probably be useful. Or, a variant of Chip_GPDMA_Transfer taking a GPDMA_CH_CFG_T instance as parameter would also be an alternative.


Thanks,
Charles
Labels (1)
0 Kudos
0 Replies