【求助】SSP 使用 DMA 問題請教

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

【求助】SSP 使用 DMA 問題請教

340 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by AdamWang on Thu Jan 10 01:51:34 CST 2013
目前使用 LPC4088 做 SPI DMA 驗證接收發射,SPI 資料接收是 9BITS , 所以我設定 DMA 如下
if ( Mode == P2M )
{
LPC_GPDMACH0->CSrcAddr = SSP0_DMA_RX_SRC ;                            //設定送出資料的 peripherals Address
LPC_GPDMACH0->CDestAddr = SSP0_DMA_RX_DST ;                          //設定接收資料的 Memory Address
LPC_GPDMACH0->CControl = (SSP_DMA_SIZE & 0x0FFF)                    //TransferSize
                        |(0x00 << 12)                                 //SBSize
                        |(0x00 << 15)                                 //DBSize
                        |(0x01 << 18)                                 //SWidth
                        |(0x01 << 21)                                 //DWidth
                        |(1 << 27)                                       //Destination Address Increame
                        |0x80000000 ;                                        //The Terminal Count Interrupt is Enable
}
我確定設定Source 長度是 2Byte 跟 Destination 長度也是 2Byte,從示波器可以看到收到的資料是正確的,但是 RAM 確有錯,
我發現的錯誤是假設第一筆資料是 0X0180 存到 Ram 會是 0x80 0x01,在收到第二筆資料時假設是 0x00A0, Ram 會變成 0x80 0xA0 0x00,表示第二筆資料的低位會蓋到第一筆的高位,想請教如何使 RAM 的資料位移是正確的
Labels (1)
0 Kudos
2 Replies

285 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by AdamWang on Fri Jan 11 02:10:20 CST 2013
我已經解決了
謝謝
0 Kudos

285 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by alan_nn on Thu Jan 10 21:28:24 CST 2013
仅从你提供的信息,没发现问题。可能需要debug来查找问题。建议你或者试下设定为byte或word长度,看看是什么结果呢。这样多些线索来对比综合分析问题。
0 Kudos