Other Parts Discussed in Thread: HALCOGEN
Tool/software: Code Composer Studio
Hi,
I need to read 4 ADC's sample data in sequence in period, which 4 ADC share the same SPI but accessed by a demultiplexer triggered by CS. To read an ADC sample data, It need to communicate with ADC following frame: 1 read command + 3 clock, which are 4 bytes, each byte in 8 bits.
Now I want to use DMA mode to readout ADC sample data. Here is my design: connect DMA request[0] , which is SPI receive in standard mode request to DMA CHANAN 1, while DMA request[1] , which is SPI transit in standard mode request to DMA CHANNEL 0, and my control packets are defined as following:
g_dmaCTRL dmaCtrl_tran = {
( uint32 ) &***[0], // initial source address
( uint32 ) &spiREG1->DAT1, // initial destination address
DMA_CH1, // next ctrl packet to be trigger + 1
4, // frame count
4, // element count
0, // element destination offset
4, // element source offset
0, // frame destination offset
16, // frame source offset
0x04, // dma port
ACCESS_32_BIT, // read element size
ACCESS_32_BIT, // write element size
1, // trigger type - frame/block
ADDR_OFFSET, // addresssing mode for source
0, // addresssing mode for destination
0, // auto-init mode
NO_CHANNEL, // uint32 COMBO; // next ctrl packet trigger(Not used)
};
g_dmaCTRL dmaCtrl_rec= {
( uint32 ) &spiREG1->BUF, // initial source address
( uint32 ) Spi1DmaRevData, // initial destination address
DMA_CH0, // next ctrl packet to be trigger + 1
4, // frame count
4, // element count
4, // element destination offset
0, // element source offset
16, // frame detination offset
0, // frame source offset
0x04, // dma port
ACCESS_32_BIT, // read element size
ACCESS_32_BIT, // write element size
1, // trigger type - frame/block
0, // addresssing mode for source
ADDR_OFFSET, // addresssing mode for destination
0, // auto-init mode
NO_CHANNEL, // next ctrl packet trigger(Not used)
};
and my problem is it can't work. From my OSC, I only capture 16 spi clock periodically which means 2 bytes, and CS0 only active at the first 8' clock but inactive at the following 8'clock, If it work, one CS will keep active for 32 spi clocks ( 4 bytes) as it work in SPI receiver interrupt mode.
I think there is something I am wrong, would you please tell me how to configure DMA packet or if you can provide me an example about SPI DMA in Rm44L920?
Best Regards,