eCSPI DMA problem for iMX6S

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

eCSPI DMA problem for iMX6S

1,081件の閲覧回数
kdm84
Contributor I

We are developping a device based on IMX6S. The driver of eCSPI in the BSP does not support DMA transfer, so we have written a driver that support DMA. We write a test program that transmit data to SPI, but we found that no value was sent from the DMA to the Tx FIFO of the SPI.

We set the register as shown below.

  1. Initialize ECSPI2.

- ECSPI2_CONREG (0x01F0E2F9)

BURST_LENGTH = 31

CHANNEL_SELECT = 0 (CS0)

DRCTL = 0

PRE_DIVIDER = 14

POST_DIVIDER = 2

CHANNEL_MODE = 15 (ALL CS Master)

SMC = 1

XCH = 0

HT = 0

EN = 1

- ECSPI2_CONFIGREG (0x00000100)

HT_LENGTH =0

SCLK_CTL = 0

DATA_CTL = 0

SS_POL = 0

SS_CTL = 1 (SS_CTL_CS0)

SCLK_POL = 0

SCLK_PHA = 0

- ECSPI2_INTREG (0x0)

: not setting

- ECSPI2_DMAREG (0xA09F0080)

RXTDEN = 1

RX_DMA_LENGTH = 32

RXDEN = 1

RX_THRESHOLD = 31

TEDEN = 1

TX_THRESHOLD = 0

- ECSPI2_STATREG (0x3)

: not setting

TDR = 1

TE =1

- ECSPI2_TESTREG (0x80000000)

LBC = 1

-------------------------------------------------

  1. prepare DMA.

- 32 byte tx/rx buffer

- Script addr

tx : mcu2app, rx : app2mcu

Buffer Descriptor Mode

Interrupt + Warp + Done

- 4byte buswidth

- burstsize = 32

- set callback function

- event number

tx : 6, rx : 5

TX DMA : chan=0x2, mode=0xb0020, peripAddr=0x200c004

RX DMA : chan=0x3, mode=0xb0020, peripAddr=0x200c000

-------------------------------------------------

  1. set CS0

gpio set to high.

-------------------------------------------------

  1. start DMA.

write (1 << tx_channel) to SDMA_HSTART(0x0C)

write (1 << rx_channel) to SDMA_HSTART(0x0C)

-------------------------------------------------

I tried to check sdma function in loopback mode.

Just write to 32bit data to ECSPI2_TXDATA(Transmit Data Register). then tx dma callback function indicated.

Do you have any idea where is the problem?

0 件の賞賛
返信
3 返答(返信)

952件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Dong-Min

one can look at eCSPI5 example with sdma

imx6q.dtsi\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

and documentation

fsl-imx-cspi.txt\spi\bindings\devicetree\Documentation - linux-imx - i.MX Linux kernel 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

952件の閲覧回数
kdm84
Contributor I

I am implementing at the firmware level.
I'm referring to i.MX6_PLATFORM_SDK and Linux's imx-spi.c.

0 件の賞賛
返信

952件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

such kind of development can be supported only through

Commercial Support and Engineering Services | NXP 

Best regards
igor

0 件の賞賛
返信