Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN, TMS5701224
i have tms570ls1224 development board.
i want to configure SPI3 through halcogen .please guide me.
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.
Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN, TMS5701224
i have tms570ls1224 development board.
i want to configure SPI3 through halcogen .please guide me.
Hello,
The spiInit() shows that word length for SPIFMT0 is 16. The LTC6x datasheet says that 2-byte command and 2-byte PEC are used.
1. cmd is defined as char
cmd[0] = 0x07;
cmd[1] = 0x14;
cmd_pec = pec15_calc(2, cmd);
cmd[2] = (uint8_t)(cmd_pec >> 8);
cmd[3] = (uint8_t)(cmd_pec);
2. in spi_write_array()
uint16_t data[]
so the SPI master TX the following data to LTC6x:
0x0007, 0x0014, 0x00??(PEC0), and 0x00??(PEC1)
From LTC6x side, it treats 0x00 as CMD0, and 0x07 as CMD1, ..which are not the correct commands for polling the ADC status.
BTW, I am not familiar to LTC6x device, and can not to debug your code related to LTC6x protocol.
Hi,
1-> So where should i chaged in spiInit() so that LTC6x side, treats 0x07 as CMD0, and 0x14 as CMD1 ?
2-> and
in spi_write_array() i have converted uint16_t data[] to uint8_t data[]
void spi_write_array(uint8_t len, // Option: Number of bytes to be written on the SPI port
uint8_t data[] //Array of bytes to be written on the SPI port
)
{
spiDAT1_t dataconfig1_t;
dataconfig1_t.CS_HOLD = false;
dataconfig1_t.WDEL = false;
dataconfig1_t.DFSEL = SPI_FMT_0 ;
dataconfig1_t.CSNR = SPI_CS_2 ;
p=len;
//while(HAL_SPI_GetState(&hspi6)!=HAL_SPI_STATE_READY);
cs_low();
// HAL_SPI_Transmit(&hspi1,data,len,5000);
//for(p=0;p<len;p++)
//data1[p]=data[p];
spiSendData(spiREG3,&dataconfig1_t,len,data);
delay_ms(10);
//delay_sec(1);
cs_high();
}
Hello Gautam,
I am sorry that I am not able to write code to meet the communication protocol defined by LTC6x part.
1. In HALCoGen, set the CHARLEN to be 8 bits instead of 16 bits
2. Change the data type in SPI APIs from uint16 to uint8
for example:
spiTransmitData(spiBASE_t *spi, spiDAT1_t *dataconfig_t, uint32 blocksize, uint8 * srcbuff);
3. the follow the protocol defined in LTC6x datasheet to send commands and receive data.
Hello Wang,
I have already changed CHARLEN to be 8 bits.
spiTransmitData(spiBASE_t *spi, spiDAT1_t *dataconfig_t, uint32 blocksize, uint8 * srcbuff);
And what should i put in blocksize ?
I can understand you are not writing or debug my code but can you give some similar example how to send 0x09 ?