This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TI RTOS Update SPI FrameFormat after SPI_Open()

Other Parts Discussed in Thread: ADS1262

Hello,

I am communicating with ADS1262 device via SPI using the following settings:

spiParams.frameFormat = SPI_POL0_PHA1;

I would like to add another spi device to my system: 

If I understand the datasheet, this device has different frameFormat settings:

spiParams.frameFormat = SPI_POL0_PHA0;

I would like to use the same SPI task for both device communication. Is it possible to update/change the frameFormat settings after SPI_open() ?  Or I need to close and reopen SPI session with different frameformat settings?

Here is my SPI_Task fx:

/// --------------------------------------------------------------------------
/// SPICommunication handler Task
void SPICOMM_Task()
{

	SPI_Handle spiHandle;
	SPI_Params spiParams;
	SPI_Transaction spiTransaction;

	SPI_Params_init(&spiParams);
	spiParams.frameFormat = SPI_POL0_PHA1;
	spiParams.transferMode = SPI_MODE_BLOCKING;
	spiParams.transferCallbackFxn = NULL;


	spiHandle = SPI_open(Board_SPI0, &spiParams);
	if (spiHandle == NULL)
	{
		System_abort("Error initializing SPI\n");
		System_flush();
	}


	SPICOMM_QueueElement_t qelem, *qelemPtr;
	qelemPtr = &qelem;

	while(1)
	{
		Semaphore_pend(SPICOMM_Semaphore_Request,BIOS_WAIT_FOREVER);
		qelemPtr = Queue_get(SPICOMM_Queue);

		spiTransaction.txBuf = qelemPtr->writeBuffer; //(Ptr)request.writeBuffer;
		spiTransaction.rxBuf = qelemPtr->readBuffer; //(Ptr)request.readBuffer;
		spiTransaction.count = qelemPtr->count; //request.count;

		GPIO_write(qelemPtr->SPI_CS,false);

		if(!(SPI_transfer(spiHandle,&spiTransaction)))
		{
			GPIO_write(Board_LED1,true);
			System_printf("SPI Bus Write Failed!\r\n");
			System_flush();
		}

		GPIO_write(qelemPtr->SPI_CS,true);

		if(qelemPtr->isWaitForResponse)
			Semaphore_post(SPICOMM_Semaphore_Response);
	}

}