Tool/software:
Dear Team,
I have configured the SPI driver in Code Composer and set a 1MHz clock, but my SPI transactions are slower than expected. I am not able to achieve a 1MHz clock whenever I call the SPI write function in the main while
loop.
Here is my code for setting the SPI parameters:
void spi_param_setting(void)
{
SPI_Params_init(&spiParams);
spiParams.frameFormat = SPI_POL0_PHA1;
spiParams.bitRate = 1000000;
spiParams.mode = SPI_MASTER;
spiParams.transferMode =SPI_MODE_CALLBACK;
spiParams.transferCallbackFxn = spicallbackfx;
open_spi();
}
while (1) {
// sleep(time);
// Send_data();
GPIO_write(CONFIG_GPIO_CS, 1); //CS HIGH
//GPIO_write(CONFIG_GPIO_LED_0, 1);
//data[0] = 0x01;
//data[1] = 0x3F;
spi_write_hw(1,data);
// usleep(1);
GPIO_write(CONFIG_GPIO_CS, 0); // CS LOW
// usleep(1);
//GPIO_write(CONFIG_GPIO_LED_0, 0);
//GPIO_write(CONFIG_GPIO_CS, 1);
}