Psoc 6 reset DMA after SPI SS rises

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
SeBa_4568951
Level 1
Level 1

Hello,

I am trying to receive automatically (minimal code interaction) to receive an unknown size of data via SPI. This data should get transferred by the Dma into my memory (psoc 63 BLE dev board with psoc Creator 4.2).

I am trying to realise a register maped spi slave: This first data byte int the MOSI line defines the reading register id that shall be accessed. Each further byte increments the register id. This works as fare fine if the transition size is known by the dma descriptor.

Realisation:
I have two DMAs
RX : two descriptors for rx (gets trigger by the SPI Slave RX-DMA singal)
1. Size one byte  -> write the data to the src addr af the TX DMA
2. Skipp 29 bytes

TX one descriptor for tx

  1. Write data from src to spi

If I send 30 bytes the dma chain gets resetet as expected and works fine.

Now I plan to make this independent from the transmission size.
I’ve tried it with polling on the spi slave to determine whether the slave is done or not. And Reset then the DMA with no effect. 

How to reset the an DMA for psoc 6 PDL 3.1.0 in Software(descriptor, xloop count, src/dest addr,…) and is there an hardware way to do this?
Thank you very much.

0 Likes
1 Solution
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi SeBa_4568951​,

You can trigger an GPIO interrupt on the rising edge of the SS signal to know the end of SPI transmission. In the GPIO interrupt ISR, you can call the following functions. Call Cy_DMA_Channel_DeInit () .This will clear all  the DMA registers and then recall  Cy_DMA_Channel_Init () to reconfigure the DMA Channel.

Regards,

Bragadeesh

Regards,
Bragadeesh

View solution in original post

3 Replies
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi SeBa_4568951​,

You can trigger an GPIO interrupt on the rising edge of the SS signal to know the end of SPI transmission. In the GPIO interrupt ISR, you can call the following functions. Call Cy_DMA_Channel_DeInit () .This will clear all  the DMA registers and then recall  Cy_DMA_Channel_Init () to reconfigure the DMA Channel.

Regards,

Bragadeesh

Regards,
Bragadeesh

Thank you for the respond,

This seems to works for me.

BUT:

i had to deInit all descriptors too, to get this working.

ps.

The links are broken

0 Likes

Hi SeBa_4568951​,

While doing a reint, are you setting the next descriptor pointer correctly?

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes