S32K144_DMA_SPI data lost

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S32K144_DMA_SPI data lost

1,079 次查看
johnsen_zhou
Contributor I

Dear:

I'm using DMA to transfer SPI data (NO SDK);

It is right to transmit 32bit,but when i transmit 10 groups of 32bit-data:

extern L9369_command DMA_SPI_L9369 = {0x11111111,0x22222222,0x33333333,0x44444444,0x55555555,0x66666666,0x77777777,0x88888888,0x99999999,0xaaaaaaaa};

The oscilloscope will lose several groups of data,and the first six groups of data are correct;

but when i  use single step transmission by using breakpoints , it is right .

why the data lost ?

thanks!khumphriMandarRHinnenjimtrudeauMartinvladcenteamarc.paquetteRChapman

pastedImage_3.png

pastedImage_4.png

0 项奖励
3 回复数

919 次查看
vanaua
Contributor I

hi! Have you solved your problem? Similarly, I had a problem with using spi's dma mode for host and slave communication. I did not use the SDK, but directly read and write registers when programming.  I tried to use s32k116 that was set as a slave device to  communicate with the external spi host device,however, While the host  keeps sending 128 bytes of data, the slave DmaA receive interrupt could not be triggered,so I could not receive or send any data. could you help me find out where the problem is? Thank you very much.

0 项奖励

919 次查看
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

At first, could you please check error flags in the Status Register (SR)? Is any error flag set? 

How much data does DMA transfer through SPI per one request?

How do you have configured the Transmit FIFO Watermark?

Thank you.

Best regards,

Diana

0 项奖励

919 次查看
wjandsq
Contributor IV

see

https://community.nxp.com/message/1315921

If the transmitted bytes exceed 32 bytes, NXP cannot provide a useful LPSPI program, and there are too many bugs about LPSPI.

In particular, PCS cannot be controlled by software.


For STM32F4, without interrupt and DMA, the following code can achieve full duplex. But there is no way for S32K144.

uint8_t RxData;
while((hspi->Instance->SR & SPI_SR_TXE) != SPI_SR_TXE);
*((__IO uint8_t *)&hspi->Instance->DR) = TxData;
while((hspi->Instance->SR & SPI_SR_RXNE) != SPI_SR_RXNE);
RxData = *((__IO uint8_t *)&hspi->Instance->DR);
return RxData;

0 项奖励