lpcware

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

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
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 的資料位移是正確的

Outcomes