SPI DMA First Byte Read Twice Using FRDM-K22F and Processor Expert

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

SPI DMA First Byte Read Twice Using FRDM-K22F and Processor Expert

463 Views
budarriola
Contributor I

Problem

In my application, all spi reads duplicate the first-byte read, and ignore the last byte read.

any suggestions are appreciated.

thank you

bud

 

  OSA_Init();   EDMA_DRV_Init(&dmaController1_State, &dmaController1_InitConfig0);     DSPI_DRV_EdmaMasterInit(FSL_DSPICOM1, &dspiCom1_MasterState, &dspiCom1_MasterConfig0, &dspiCom1_dmaTcd);   DSPI_DRV_EdmaMasterConfigureBus(FSL_DSPICOM1, &dspiCom1_BusConfig0, &dspiCom1_calculatedBaudRate);//startup as slow bus     static uint8_t header[5];   header[0]=1;   header[1]=2;   header[2]=3;   header[3]=4;   header[4]=5;   static uint8_t readdata[5];   readdata[0]=0;   readdata[1]=0;   readdata[2]=0;   readdata[3]=0;   readdata[4]=0;     DSPI_DRV_EdmaMasterTransferBlocking(FSL_DSPICOM1, NULL, header, readdata, 5, 1000u); //readdata == {1,1,2,3,4} after this command (it should be 1,2,3,4,5))      

 

 

i have included the project

to duplicate this problem tie mosi and miso together (PTD6,PTD7)

Kinetis Design Studio Version: 3.0.0

Processor Expert for Kinetis 3.0.1

KSDK_1.2.0

 

SCOPE DECODE SETTINGS

CPOL = 0

CPHA = 1

CS POLARITY = ACTIVE LOW

BIT ORDER = MSB

BITS PER WORD = 8

 

102477_102477.jpgLeCroy.jpg

 

Message was edited by: bud Arriola the previous code I uploaded was for the wrong package ic. I updated the project to have the correct ic. ( The same result can be seen, also if the spi baud rate is lowered then only 3 out of the five bytes will transfer and the cs line will be stuck low.)

 

Message was edited by: bud Arriola I fixed the problem by disabling auto-initialization in the dspi component and the DMA controller though I don't understand why it was wrong.

Original Attachment has been moved to: working-FRDM-K22F-project.zip

Original Attachment has been moved to: FRDM-K22F-project.zip

Labels (1)
Tags (2)
0 Kudos
0 Replies