FTDI Community

General Category => Discussion - Software => Topic started by: Kesokeso on March 16, 2021, 02:47:10 PM

Title: How to improve the performance of Vinculum Master SPI communication?
Post by: Kesokeso on March 16, 2021, 02:47:10 PM
Hi, I use Vinculum2-32 to implement the USB host function to output the data acquired from the USB Device to the outside by SPI.
The following settings have been made to improve the performance of Vinculum's Master SPI communication.
However, the following time deteriorated the performance of SPI communication.
The time when the clock is output by the SPI Write function after CS becomes low, the time from when the clock is output by the SPI Write function until the next SPI Write function is executed, and the time when the clock is output by the SPI Write function.
There is more than 400 usec of blank time.
Please let me know if there is a way or setting to eliminate these blank times.
In addition, the vos_init settings of tick and quantum are not effective for improving performance.

   /* SPI Settings */
   ....
   
   //Enable DMA ->Effective for improving performance
   spim_iocb.ioctl_code = VOS_IOCTL_COMMON_ENABLE_DMA;
   spim_iocb.set.param = DMA_ACQUIRE_AND_RETAIN;
   vos_dev_ioctl(hSPI_MASTER, &spim_iocb);
   
   //Clock 20MHz ->Effective for improving performance
   spim_iocb.ioctl_code = VOS_IOCTL_SPI_MASTER_SET_SCK_FREQUENCY;
   spim_iocb.set.spi_master_sck_freq = 20000000;
   vos_dev_ioctl(hSPI_MASTER, &spim_iocb);
   
   //Delay 0
   spim_iocb.ioctl_code = VOS_IOCTL_SPI_MASTER_SET_DATA_DELAY;
   spim_iocb.set.param = 0;
   vos_dev_ioctl(hSPI_MASTER, &spim_iocb);
   
   //Auto Toggle Disable because of slave device specification
   spim_iocb.ioctl_code = VOS_IOCTL_SPI_MASTER_SS_0;
   spim_iocb.set.param = SPI_MASTER_SS_DISABLE;
   vos_dev_ioctl(hSPI_MASTER, &spim_iocb);
   
   ...
   
   
   /* SPI Master Write */
   spim_iocb.ioctl_code = VOS_IOCTL_SPI_MASTER_SS_0;
   spim_iocb.set.param = SPI_MASTER_SS_ENABLE;
   vos_dev_ioctl(hSPI_MASTER, &spim_iocb);

   vos_dev_write(hSPI_MASTER, wcmd, 4, &num);
   vos_dev_write(hSPI_MASTER, data, 4, &num);

   spim_iocb.set.param = SPI_MASTER_SS_DISABLE;
   vos_dev_ioctl(hSPI_MASTER, &spim_iocb);

Thank you.