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.

ADS 8345 interface with LM3s6965 Help!

Other Parts Discussed in Thread: ADS8344EVM

Hello! I'm working with 2 channels  of the  ADC8345EVM (16bits )  and when I show the  channel 1 value on OLED display  it´s change with channel 0.

The other question is  that  the value show it's wrong. (0V=57680 and 5V=25312)

What's wrong?

Thanks for help!

Look the code beelow;

//**********************************************************************************************************************************************

void config_adc_ssi(unsigned long ulFrequency)
{
 SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);  
 SSIDisable(SSI0_BASE);
 GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_5 | GPIO_PIN_4 |GPIO_PIN_3);
 GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3,
                     GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
 SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(),SSI_FRF_MOTO_MODE_3 , SSI_MODE_MASTER,1000000, 16);
 GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_6);
 GPIOPadConfigSet(GPIO_PORTD_BASE, GPIO_PIN_6, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
 SSIEnable(SSI0_BASE);
}

void start_read_adc(unsigned long channel)
{
 SSIDisable(SSI0_BASE);      
 GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_5 | GPIO_PIN_4 |GPIO_PIN_3);
 SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(),SSI_FRF_MOTO_MODE_3 , SSI_MODE_MASTER,1000000, 16);
 GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_6, 0);
 SSIEnable(SSI0_BASE);         
 SSIDataPut(SSI0_BASE,channel);
 while(SSIBusy(SSI0_BASE))
 {
 }
}
void stop_read_adc(void)
{
  unsigned long ulTemp;
 GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_6, GPIO_PIN_6);
 while(SSIDataGetNonBlocking(SSI0_BASE, &ulTemp) != 0)
 {
  }
}

int
main(void)
{
  SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);
  RIT128x96x4Init(1000000);
  config_adc_ssi(1000000);
  while(1)
  {
   // read  channel 0 and show on OLED display
   start_read_adc(0x87);
   SSIDataGetNonBlocking(SSI0_BASE, &read_value);
   stop_read_adc();
   RIT128x96x4Enable(1000000);
   usprintf(szBuffer,"%010d",read_value);
   RIT128x96x4StringDraw(szBuffer,40, 24, 15);
   RIT128x96x4StringDraw("Ch_0:", 1, 24, 15);
   usprintf(szBuffer,"%010d",0);
   RIT128x96x4Disable();
   SysCtlDelay(1000);
   // read  channel 1 and show on OLED display
   start_read_adc(0xC7);
   SSIDataGetNonBlocking(SSI0_BASE, &read_value);
   stop_read_adc();
   RIT128x96x4Enable(1000000);
   usprintf(szBuffer,"%010d",read_value);
   RIT128x96x4StringDraw(szBuffer,40, 33, 15);
   RIT128x96x4StringDraw("Ch_1:", 1, 33, 15);
   usprintf(szBuffer,"%010d",0);
   RIT128x96x4Disable();
   SysCtlDelay(1000);
   }//while
}//main

//**********************************************************************************************************************************************

 

  • Hello Hercules,

    Issues related to ADCs wrong readings are very difficult to identify from code alone because they could be related to hardware setup, supplies, digital signal timing, etc.

    Thus, to better understand the issue, could you send us the system schematic and scope screenshots of /CS, DIN, DOUT, and SCLK?

    For privacy, the schematic can send by a conversation. To start a conversation, go to my profile and click “Start a conversation”.

    Thank you.
    Rafael

  • Thanks for the reply!

    Don't worry about it! I'm using the Evaluation Module EK-LM3S6965 and ADS8344EVM. I nedded  connect some cables, they are; CS, DIN, DOUT, CLK, and GND. It's easy! The configuration  of  ADC hardware  is  like this; 

    W1        2-3

    W2        Open

    W3        1-2 (+5v)

    W4        2-3  (GND)

    W5         2-3 (External Reference=5V)

    W6         1-2 (NC)

    W7         2-3 

    W8         1-2 ( Chip select by software) 

    ____________________________________

    All connections  are ok!

    I  can take some pictures, than I send to you. If you need! I have  four channels  oscilloscope, I think interesting to you check the signals.

    By the way, I'm sorry, my inghish is not very well, I'm from Brazil and I'm learning yet.

    Thank you Rafael.

    Hercules Vidal