Hello,
For a new project we will need to use the MibSPI (or SPI) of the TMS570LS1224, and at this moment we don’t know if our approach is correct. System features should be the following:
-FreeRtos.
-TMS570 is a slave. We will test it with another TMS570 working as master.
-5 Pin Mode.
-Variable size (received data and transmitted data).
From the slave point of view, the approach is the following:
-Vim channel 12 enabled (MIBSPI HIGH).
-MiBSPI1 Global: Master and internal disabled.
-Data format: Charlen 1 byte (minimum size).
-TG0: Buffer 4, Cs_0, Length ???? (bigger than the biggest packet?), one shot.
-Port:SOMI0 as output,SIMO0 as input, CLK as input, ENA as SPI and Output,CS0 as SPI and input, CS1234 GIO.
Code:
-Power on:
mibspiInit();
mibspiEnableGroupNotification(mibspiREG1, 0, 1);
-Notification.c ( RX_Data is char buffer, RX_SPI_flag is volatile)
void mibspiGroupNotification(mibspiBASE_t *mibspi, uint32 group)
{
mibspiGetData(mibspiREG1, group, RX_Data);
RX_SPI_Flag=1;
}
-In a task:
if(RX_SPI_Flag==1){
RX_SPI_Flag=0;
//to change size
mibspiREG1->TGCTRL[0] &= 0x7FFF0000;
mibspiREG1->TGCTRL[1] |= (SIZE-1) << 8;
mibspiSetData(mibspiREG1, 0, &TX_Data[0]); //copy data to TXRAM
mibspiTransfer(mibspiREG1, 0); //set TGENA bit to enable transfer
//Block? Maybe now I should change again the TG size to maximum, or use another TG
/* while(!(mibspiIsTransferComplete(mibspiREG1, 0)));
*/
}
From the master point of view, the approach is the following:
-MiBSPI1 Global: Master and internal enabled.
-Data format: Charlen 1 byte (minimum size).
-TG0: Buffer 4, Cs_0, length as desidedr, one shot.
-Port:SIMO0 as output,SOMI0 as input, CLK as output, ENA as SPI and Input,CS0 as SPI and output, CS1234 GIO.
Code:
-Power on:
mibspiInit();
-Task:
mibspiSetData(mibspiREG1,1,TG1_TX_DATA);
mibspiTransfer(mibspiREG1,1);
while(!(mibspiIsTransferComplete(mibspiREG1,1))); //block until ENA is activated?
mibspiGetData(mibspiREG1,1,TG1_RX_DATA);
Questions:
-Is the approach mostly correct?
-What should be the length of the transfer group to receive variable length?
-Will I receive an interrupt if the transfer group is not complete? At what moment? (CS HIGH?)
-Should I use two different TG for TX and RX? One with maximum length and the other with the desired length.
-Should I enable again the TG after change the size?
-From the master point of view, does the while block the system until ENA is activated?
Thanks in advance,
Aizkibel Salcedo