AnsweredAssumed Answered

K61 SPI over DMA using MQX I/O peripheral code performance issue

Question asked by Jins Paul on Oct 1, 2019
Latest reply on Oct 9, 2019 by Jins Paul

Hello Team,

 

I've been using SPI for K61 to communicate  wifi chip (Ti CC3120). My SPI communication running on 20MHz speed. To improve the performance (we have a webhmi, which communicate through wifi chip) I have used SPI over DMA.

SPI2 codes i have modified for DMA init.

 

1. In the _bsp_init() function I've enabled 

/* Initialize DMA */
result = dma_init(_bsp_dma_devif_list);
if (result != MQX_OK) {
return result;
}

2. and SPI

 

#if BSPCFG_ENABLE_SPI2
_io_spi_install("spi2:", &_bsp_spi2_init);
#endif

 

the only change i have done is code is; added DSPI_ATTR_USE_ISR in the SPI2 init.

 

const SPI_INIT_STRUCT _bsp_spi2_init = {
&_spi_dspi_dma_devif, /* Low level driver interface */
&_bsp_dspi2_init, /* Low level driver init data */
{ /* Default parameters: */
20000000, /* Baudrate */
SPI_CLK_POL_PHA_MODE0, /* Mode */
8, /* Frame size */
1, /* Chip select */
DSPI_ATTR_USE_ISR, /* Attributes */
0xFFFFFFFF /* Dummy pattern */
}
};

 

I was expecting my webhmi communication works very fast after above changes but performance went down. I didn't change much in the application code which runs on MQX4.2.

 

Am I missing something in above procedure? I don't have clear idea about  how DMA I/O peripheral code works.

I'm using IO_read and IO_write function for SPI read and write. how can I improve the SPI communication performance ?

 

Please guide me.

 

Thanks in advance.

Br,

Paul

Outcomes