Hi,
- How can I turn ON/turn OFF a GPIO.
-
How can make the same application to run on DSP2? Is setting the platform to "ti.platforms.evmDRA7XX:dsp2" is enough? Do we need to make any changes in the XDC Script?
{
SPI_Params spiParams; /* SPI params structure */
SPI_Handle spiHandle = NULL;
SPI_Transaction spiTransaction;
bool status;
char txBuf[3] = {0x00, 0x00};
char rxBuf[2] = {0x00, 0x00};
appPrint("\n spi_test task started");
/* Default SPI configuration parameters */
SPI_Params_init(&spiParams);
spiParams.transferMode = SPI_MODE_BLOCKING;
spiParams.transferTimeout = SPI_WAIT_FOREVER;
spiParams.mode = SPI_MASTER;
spiParams.frameFormat = SPI_POL1_PHA0;
spiParams.bitRate = 500000;
spiParams.dataSize = 8;
spiParams.transferCallbackFxn = NULL;
/* Open SPI instance */
spiHandle = SPI_open(BOARD_SPI_INSTANCE, &spiParams);
if (spiHandle)
{
appPrint("\n SPI Handle created");
}
/* Configure common parameters with SPI transaction */
spiTransaction.count = 3;
spiTransaction.txBuf = (uint8_t *)&txBuf[0];
spiTransaction.rxBuf = (uint8_t *)&rxBuf[0];
/* Execute SPI Transaction */
txBuf[0] = 0x50; // 0x50 = 01010000 = WREG;
txBuf[1] = 0x00; //2nd (empty) command byte
txBuf[2] = 0x00; //pass the value to the register
while (spiHandle)
{
status = SPI_transfer(spiHandle, &spiTransaction);
Task_sleep(100);
if (status == false)
{
SPI_close(spiHandle);
appPrint("\n ERROR: SPI_transfer failed");
goto SPI_TEST_EXIT;
}
}
Task_sleep(10);
appPrint("\n spi_test task ended");
SPI_TEST_EXIT:
appPrint("\nSPI task ended");
Task_exit();
}
Regards,
Arun