rt1062上使用dma读取lpspi的数据

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

rt1062上使用dma读取lpspi的数据

782 Views
WeimWang
Contributor I
我参照着sdk的例程写了一个dma读取lpspi的数据,我先利用xbara将ad的busy引脚连接到dma的请求信号: XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputIomuxXbarIn22, kXBARA1_OutputDmaChMuxReq30);
然后我将DMA的触发源头设置成这样:
DMAMUX_SetSource(DMAMUX, RX_DMA_LPSPI_CHANNEL, kDmaRequestMuxXBAR1Request0);
因为只读数据,所以我只配置RX:
   LPSPI_MasterTransferCreateHandleEDMA(LPSPI1, &g_m_handle, LPSPI_MasterUserCallback, NULL, &rxHandle,
                                                  &txHandle);
    /*Start master transfer*/
    masterXfer.txData   = NULL; //不发送
    masterXfer.rxData   = masterRxData; //接收数组
    masterXfer.dataSize = TRANSFER_SIZE; //接收数据大小
    masterXfer.configFlags = kLPSPI_MasterPcs0 | kLPSPI_MasterByteSwap | kLPSPI_MasterPcsContinuous;  
    LPSPI_MasterTransferEDMA(LPSPI1, &g_m_handle, &masterXfer);

但是我在调试时,一直读不到lpspi发的数据,麻烦大家帮我看看 ,啥情况
0 Kudos
4 Replies

767 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,

既然能进入到lpspi_master_edma_handle_t中的callback函数(LPSPI_MasterUserCallback),至少表示SPI的transfer和receive动作是完成了的,那接下来我建议你,传输人为设定的数据就像SDK library的例程一样,然后用逻辑分析仪捕获数据看看是否真的被传输出去了,至于接收测试,你需要提供一个slave器件发送数据给master。

TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

780 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
非常感谢使用NXP产品,很高兴为你提供技术支持!
从你的代码来看,DMA触发源来自XBARA,不是原来的kDmaRequestMuxLPSPI1Rx,当前最重要的,我觉得你最好debug一下,验证DMA请求是否产生,以及DMA 传输是否完成,至于是否完整的接收数据倒不是首要的任务。
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

775 Views
WeimWang
Contributor I

应该是进入的是发送完成后的回调(LPSPI_MasterTransferCreateHandleEDMA 这个函数必须指定发送和接受句柄,然后没有发送数据,所以一下就进回调了),从spi接收一直进不了回调,也就是可能没触发

0 Kudos

777 Views
WeimWang
Contributor I

应该是调用了,程序能进去到我设置的回调函数LPSPI_MasterUserCallback

0 Kudos