SPI does not work in DMA mode

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

cross mob
Anonymous
Not applicable

Hi,

i am trying to use SPI on the SN8000xUFL platform.

If I initialize the SPI with "SPI_NO_DMA" bit set, everything works as expected and I can see SPI transfers on the oscilloscope.

If I set the "SPI_USE_DMA" there are not transfers.

The code is pretty straightforward, I found it in one of the examples:

   wiced_spi_device_t spi = {

           .port        = WICED_SPI_1,

           .chip_select = WICED_GPIO_23,

           .speed       = 1500000,

           .mode        = (SPI_CLOCK_RISING_EDGE | SPI_CLOCK_IDLE_LOW | SPI_USE_DMA | SPI_MSB_FIRST),

           .bits        = 8

       };

     wiced_spi_init(&spi);

     wiced_spi_message_segment_t segments[1];

     uint8_t out[16];

     uint8_t in[16];

     segments[0].tx_buffer = out;

     segments[0].length = 16;

     segments[0].rx_buffer = in;


   while(1){

        // change the resistance on this channel from min to max:

        wiced_spi_transfer(&spi, segments, 1);

      }

Is there something I have missed or an extra peripheral I forgot to configure?

0 Likes
9 Replies
GregG_16
Employee
Employee
50 sign-ins 25 sign-ins 25 comments on KBA

Hello,

Is this still an issue for you, if so, I can have someone from Murata help us look into this.  Feel free to send me a PM.

0 Likes
Anonymous
Not applicable

Hi,

Here is Xinsi Lin from Murata. can you please us know which version of Wiced-SDK you are using, we will do a check.

Thanks.

Xinsi Lin

0 Likes
Anonymous
Not applicable

Hi Xinsi,

I am using version 3.1.2.

Best regards,

Ivan

0 Likes
Anonymous
Not applicable

I am actually not sure if is has something to do with the Murata module.
The SPI that I am trying to use is not connected to a module, it is an external SPI bus I am using to  connect to an external ADC.

0 Likes
Anonymous
Not applicable

thanks for the updates.

We use SPI DMA  for our application which is working fine.  You need also configure DMA if you want to  use DMA. Your code sample doesn't show whether you have DMA configured.

0 Likes
Anonymous
Not applicable

Should it be done at the WICED API level?

Is there any example of how to do that?

0 Likes
Anonymous
Not applicable

There is an example in WICED-SDK-3.1.2\WICED\platform\MCU\STM32F2xx\WWD\wwd_SPI.c.

0 Likes
Anonymous
Not applicable

Do you need any sample code for how to use DMA + SPI?

0 Likes
Félix_T
Level 5
Level 5
10 sign-ins First comment on blog 50 replies posted

There was an issue in another thread, which looks like it was deleted, where the TX and RX DMA definitions were reversed for SPI.  There was also another problem, but I don't remember what it was.

0 Likes