Hello Community.
I try to build a digital communication between a ADC TLC1514 and a PIC24 development board.
I want to use the ADC for a repeat Conversation of the analog input channel 0. Therefore I have a p2p connection from the ADC to the µC.
Connections: ADC -> connected to……
SDO -> SDI µC
SDI -> SDO µC
SCLK -> SCLK µC
EOC/INT -> pin at µC
VCC -> 5V dc
CS -> pin at µC
REFP -> positive 4 v DC reverence Voltage
REFM -> GND of the reverence Voltage
FS -> pin at µC
PWDN -> connected to VCC
GND -> GND
CSTART -> connected to VCC
In my case, I want to start the conversation triggered by FS and CS.
At the beginning I configure the ADC like it’s told in the datasheet:
- Wake up the ADC with 0xA000.
- Send the CFR write command with the configuration bits , 0xA000 + configuration data.
- Select the analog input channel 0 by sending 0x0000.
- Now I want to receive the configuration by sending the read CFR command 0x9000.
- I compare the send configuration with my received configuration, just to make sure that the ADC is correct adjusted.
Now the problem:
The ADC won’t send data through his SDO output pin, so i stuck in my while(1).
Does anybody know what i doing wrong?
English isn’t my native language, but I hope you can understand my problem.
Best regards Christian
Code:
void configADC(void)
{
cmd = 0x0022;
SPI2_CS1 = 0; // select the adc
writeSPI2(0xA000); // Wake up the adc
SPI2_CS1 = 1; // deselect the adc
cmdw = WRITE_CFR | cmd; // form write cmd + config
while(1)
{
SPI2_CS1 = 0;
SPI2_FS = 1;
SPI2_FS = 0;
writeSPI2(cmdw);
SPI2_CS1 = 1;
SPI2_CS1 = 0;
SPI2_FS = 1;
SPI2_FS = 0;
writeSPI2(A0);
SPI2_CS1 = 1;
SPI2_CS1 = 0;
SPI2_FS = 1;
SPI2_FS = 0;
cfr = writeSPI2(READ_CFR);
SPI2_CS1 = 1;
if (cfr ==cmd)
break;
}
}
The SPI configuration of the µC is correct. I can detect the SDO (µC) and SCL (µC) with a scope.
This conversation is showed in the datasheet at page 15.