Other Parts Discussed in Thread: HALCOGEN
Hi,
I'm testing communication between TMS570LS1244 on Lauchpad TMS570LS12x and AD7705 on my board over SPI1. It doesn't work. Let's call it test 2.
Before test 2, I have tested SPI1 and SPI3 commnunication on Lauchpad. It worked. Let's call it test 1.
I probed the clk pin of SPI1 (as master) for test 1 and test 2, shown as below. It looks like clk in test 2 is not correct.
The connection of test 2 is shown as below.
Here are the photos of test 1 and test 2.
Here is the code for test 2.
int main(void) { /* USER CODE BEGIN (3) */ uint16 TX_Data_Master[4] = { 0x20, 0x0C, 0x10, 0x40}; uint16 TX_Request_Data = 0x38; uint16 RX_Data_Master = 0; spiDAT1_t dataconfig1_t; /* the only pin that is programmed here from the 68HC11 is the /CS and this is why the PC2 bit of PORTC is made as an output */ char a=0; int i; uint32 ready=0; // DDRC = 0x04; /* PC2 is an output the rest of the port bits are inputs */ // PORTC | = 0x04; /* make the /CS line high */ dataconfig1_t.CS_HOLD = FALSE; dataconfig1_t.WDEL = TRUE; dataconfig1_t.DFSEL = SPI_FMT_0; dataconfig1_t.CSNR = 0xFE; gioInit(); spiInit(); hetInit(); //Writetoreg(0x20); /* Active Channel is Ain1(+)/Ain1(-), next operation as write to the clock register */ spiTransmitData(spiREG1, &dataconfig1_t, 1, &TX_Data_Master[0]); //Writetoreg(0x0C); /* master clock enabled, 4.9512MHz Clock, set output rate to 50Hz*/ spiTransmitData(spiREG1, &dataconfig1_t, 1, &TX_Data_Master[1]); //Writetoreg(0x10); /* Active Channel is Ain1(+)/Ain1(-), next operation as write to the setup register */ spiTransmitData(spiREG1, &dataconfig1_t, 1, &TX_Data_Master[2]); //Writetoreg(0x40); /* gain = 1, bipolar mode, buffer off, clear FSYNC and perform a Self Calibration*/ spiTransmitData(spiREG1, &dataconfig1_t, 1, &TX_Data_Master[3]); // while(PORTC & 0x10); /* wait for /DRDY to go low */ //for(a=0;a<NUM_SAMPLES;a++) while(1) { // connectRTD(a%4); //Writetoreg(0x38); /*set the next operation for 16 bit read from the data register */ spiTransmitData(spiREG1, &dataconfig1_t, 1, &TX_Request_Data); while(0==ready) { ready=gioGetBit(mibspiPORT3, PIN_CS3); } ready=0; //Read(NUM_SAMPLES,2); spiReceiveData(spiREG1, &dataconfig1_t, 1, &RX_Data_Master); // disconnectRTD(a%4); if(RX_Data_Master==65535) RX_Data_Master=0; for(i=0;i<DELAY_VALUE;i++); gioToggleBit(gioPORTB, 1); a++; } /* USER CODE END */ return 0; }
Please help me to find out my mistake or something I missed.
Best Regards
Datïan