Tool/software:
Hi, I'm using SPI for a tft display and I measure that when I do a poll for TX FIFO full it takes 1.5 uS between transfers and if I write the TX FIFO without polling it takes 100nS, is it normal? how can I achieve minimun time between transfers?
for (;;) {
vTaskDelay(pdMS_TO_TICKS(500));
SPI_Write_9bits(0x15);
SPI_Write_9bits(0x14);
SPI_Write_9bits(0x13);
SPI_Write_9bits(0x12);
vTaskDelay(pdMS_TO_TICKS(500));
DL_SPI_transmitData16(SPI_0_INST, 0x15);
DL_SPI_transmitData16(SPI_0_INST, 0x15);
DL_SPI_transmitData16(SPI_0_INST, 0x15);
DL_SPI_transmitData16(SPI_0_INST, 0x15);*/
}
void SPI_Write_9bits(uint16_t writeData) {
while(DL_SPI_isTXFIFOFull(SPI_0_INST)){};
DL_SPI_transmitData16(SPI_0_INST, writeData);
}
I also notice that even if I set DL_SPI_FRAME_FORMAT_MOTO4_POL0_PHA1 the CS line is not held down between transfers, this is the spi config:
static const DL_SPI_Config gSPI_0_config = {
.mode = DL_SPI_MODE_CONTROLLER,
.frameFormat = DL_SPI_FRAME_FORMAT_MOTO4_POL0_PHA1,
.parity = DL_SPI_PARITY_NONE,
.dataSize = DL_SPI_DATA_SIZE_9,
.bitOrder = DL_SPI_BIT_ORDER_MSB_FIRST,
.chipSelectPin = DL_SPI_CHIP_SELECT_0,
};
static const DL_SPI_ClockConfig gSPI_0_clockConfig = {.clockSel = DL_SPI_CLOCK_BUSCLK,
.divideRatio = DL_SPI_CLOCK_DIVIDE_RATIO_1};
SYSCONFIG_WEAK void SYSCFG_DL_SPI_0_init(void) {
DL_SPI_setClockConfig(SPI_0_INST, (DL_SPI_ClockConfig *)&gSPI_0_clockConfig);
DL_SPI_init(SPI_0_INST, (DL_SPI_Config *)&gSPI_0_config);
DL_SPI_setBitRateSerialClockDivider(SPI_0_INST, 0);
/* Enable module */
DL_SPI_enable(SPI_0_INST);
}The clock is at 80Mhz and SPI at 40Mhz, I'm also using freeRTOS.
thank you in advance
Rafael