Part Number:CC3235SFOther Parts Discussed in Thread:SYSCONFIG
请问我想要使用DMA资源来访问外设数据,我应该如何配置并使用呢?
Kevin Qiu1:
DMA仅供SPI I2S UART等外设使用,这些外设例程中已经配置了DMA
DMA说明参考:https://dev.ti.com/tirex/content/simplelink_cc32xx_sdk_5_30_00_08/docs/drivers/doxygen/html/_u_d_m_a_c_c32_x_x_8h.html
https://dev.ti.com/tirex/content/simplelink_cc32xx_sdk_5_30_00_08/docs/drivers/doxygen/html/index.html
,
wu:
我就是使用SPI的时候,但是发现我的SPI没有使用DMA,因为它一直占用着CPU的时间
,
Kevin Qiu1:
你用例程直接测试也是这样吗
,
wu:
例程没有测试,我不知道例程哪里设置了才算是使用了DMA呢,我看例程代码好像并没有特殊的说明
,
Kevin Qiu1:
SPI例程已经内置了DMA程序,可以在sysconfig中看到配置的DMA
参考:https://e2e.ti.com/support/wireless-connectivity/wi-fi-group/wifi/f/wi-fi-forum/729813/ccs-launchcc3220modasf-spi-dma
,
wu:
但是我应该怎么配置才能确定已经使用了DMA呢,而且如何证明SPI例程就已经使用了DMA呢?
,
wu:
为什么我使用SPI读取数据的时候,程序停在了DMA中断了,应该如何解决呢
程序卡在了这里
,
Kevin Qiu1:
DMA错误通常是传入了不正确的指针或者堆栈溢出
https://e2e.ti.com/support/wireless-connectivity/wi-fi-group/wifi/f/wi-fi-forum/984018/cc3220sf-i-use-cc3220sf-chip-after-modifying-the-spi-program-the-program-stops-running-and-returns-to-the-ti-driver-config-file-dma-error-handling-function-abnormal-interrupt-what-is-the-reason
另外注意Data buffers要和 data frame size对齐
SPI data frames can be any size from 4-bits to 32-bits. The SPI data frame size is set in SPI_Params.dataSize passed to SPI_open. The SPICC32XXDMA driver implementation makes assumptions on the element size of the SPI_Transaction txBuf and rxBuf arrays, based on the data frame size. If the data frame size is less than or equal to 8 bits, txBuf and rxBuf are assumed to be arrays of 8-bit uint8_t elements. If the data frame size is greater than 8 bits, but less than or equal to 16 bits, txBuf and rxBuf are assumed to be arrays of 16-bit uint16_t elements. Otherwise, txBuf and rxBuf are assumed to point to 32-bit uint32_t elements.
data frame size
buffer element size4-8 bits
uint8_t9-16 bits
uint16_t17-32 bits
uint32_tData buffers in transactions (rxBuf & txBuf) must be address aligned according to the data frame size. For example, if data frame is 9-bit (driver assumes buffers are uint16_t) rxBuf & txBuf must be aligned on a 16-bit address boundary, if data frame is 20-bit (driver assumes buffers are uint32_t) rxBuf & txBuf must be aligned on a 32-bit address boundary.