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

cancel
Showing results for 
Search instead for 
Did you mean: 

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

113 Views
Contributor I

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

Tags (4)
2 Replies

6 Views
NXP TechSupport
NXP TechSupport

Hi Paul:

Please refer to known issues and limitations of the DSPI issues related to the DMA usage in MQX_Release_Notes.pdf

pastedImage_2.png

Regards

Daniel

0 Kudos

6 Views
Contributor I

Hello Daniel,

Thank you for your reply. I knew this issue, so I was using eDMA for SPI2 only, SPI0 and SPI1 are using normal interrupt based. Before DMA implementation, I was using SPI2 as interrupted based but which made some context switching delay between task. how can I used current eDMA I/O peripheral driver in interrupt mode? 

In below code we used to DSPI_ATTR_USE_ISR enable SPI2 on interrupt based.


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

but if I use DMA based, how can I enable DMA interrupt?

Please let me know.

Br,

Paul

0 Kudos