I have slightly altered the SPI Loop Back example provided with TI-RTOS, by just adding a larger arrary of data to send. However when I increase the SPI speed in the MHz range it seems to lose timing.
I need to send at 6.4Mhz, but my LA is reporting 6.858Mhz, the strange thing is, that I can bring it down to 6MHz or less in my settings, but it still seems to be sending 6.858MHz.
Are there any settings I should be aware of, or have a reached some sort of limit. I am developing on the Tiva C LaunchPad (TM4C123GXL).
Here is my code, it is nothing special.
SPI_Handle masterSpi; SPI_Transaction masterTransaction; bool transferOK; SPI_Params spiParams; SPI_Params_init(&spiParams); spiParams.bitRate = 6400000; spiParams.transferMode = SPI_MODE_BLOCKING; spiParams.mode = SPI_MASTER; spiParams.dataSize = 8; spiParams.frameFormat = SPI_POL0_PHA1; /* Initialize SPI handle as default master */ masterSpi = SPI_open(Board_SPI0, &spiParams); int j,l; for (j = 0; j < 3; j++) { testData[l++] = 0b10101010; testData[l++] = 0b11111000; testData[l++] = 0b11111000; testData[l++] = 0b11111000; testData[l++] = 0b11111000; testData[l++] = 0b11111000; testData[l++] = 0b11111000; testData[l++] = 0b11111000; } /* Initialize master SPI transaction structure */ masterTransaction.count = 24; masterTransaction.txBuf = (Ptr)testData; masterTransaction.rxBuf = (Ptr)masterRxBuffer; /* Initiate SPI transfer */ transferOK = SPI_transfer(masterSpi, &masterTransaction);
Thanks,
Glenn.