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.

Linux/ADS124S08: Linux Driver Related Query

Part Number: ADS124S08

Tool/software: Linux

Hi Guys,

I am using iMX6 DualLite Processor with the above described ADC(ADS124S08) over SPI bus and below are the driver link which I have used: 

git.ti.com/.../

Observation:

  1. Chip select pin and clock pin signals are as expected when I read raw value using sysfs entry. 
  2. While I am reading raw data it always shows a 16777151 value for all the Channels.
  3. I have not changed anything in the driver and seen in the driver that IOMUX Register Configurations are written only when I would do hardware trigger and enable buffer, is this correct?

Also, suggest How would I able to read the raw values of the channel. 

Below are the Queries regarding reading ADC raw data.

  1. Why the driver doesn't show in_voltage_scale entry in the sys entry while other entries like in_volatgeX_raw appear?
  2. While I am reading raw data it always shows a 16777151 value for all the Channels. Why raw values give always the same values?
  3. Why I am not able to enable buffer for hardware trigger? kernel print: "Buffer not started: buffer parameter update failed".
  4. Sometimes, DRDY pin remains high only and hence I wouldn't able to read data.
  5. Above TI driver link is correct? If no then please suggest the driver.

Thank You 

  • Hi Aakash,

    Welcome to the E2E forum! Unfortunately I can given only give minimal support for Linux drivers (as I have no Linux box). The link you posted is the link for the driver that was created late last year and is the most appropriate place to start. Have you tried to contact the code author directly?

    I don't know if the code was thoroughly vetted. I would suggest that you review the ADS124S08 datasheet as to how it is supposed to work and communicate. I would suggest that you start simply at first making sure you can do simple commands such as writing registers. I would also verify that the communication is working as expected by using an oscilloscope or logic analyzer.

    If you never see DRDY toggling, then the START command was not issued. The ADS124S08 has two modes of operation. One is single-shot (or single conversion) mode. When the START command is issued, the device will take one conversion and then stop. The second mode is continuous conversions. When using this mode, sending the START command will start a continuous stream of conversions until the STOP command is issued. The mode of operation is set by writing the appropriate register setting.

    The following commands appear to work as expected:
    ads124s_write_cmd(struct iio_dev *indio_dev, u8 command)
    ads124s_write_reg(struct iio_dev *indio_dev, u8 reg, u8 data)
    ads124s_reset(struct iio_dev *indio_dev)
    ads124s_read(struct iio_dev *indio_dev, unsigned int chan) //except chan is not used, but the command reads the last conversion result for the mux channels selected.

    It is not clear to me if the other functions are working as expected. You should be able to write registers and issue commands. I don't see a function for reading the register data. It would be a combination of the contents of the ads124s_write_reg() and the ads124s_read() functions. You would need to write the RREG command followed by a NULL to capture the register data.

    The result you received is basically a few codes below zero. The conversion result is binary 2's complement as a 24-bit value. You would need to sign-extend to 32-bits for 32-bit integers. I assume that the reason you keep seeing the same value is there was one completed conversion and that same value is being read out over and over again.

    What you need to do is set the registers one at a time appropriately using the ads124s_write_reg() function. This would include setting the input mux. Once the registers are set appropriately, you would need to send the START command using the ads124s_write_cmd() function. When DRDY makes the transition from high to low state, issue the ads124s_read() function.

    Best regards,
    Bob B
  • Hi Aakash,

    I was made aware that there is a patch available.  This patch will be available in the 5.1 kernel.  Apparently there are some fixes so you may want to look at this patch:

    https://lore.kernel.org/patchwork/patch/1031440/

    Best regards,

    Bob B

    https://lore.kernel.org/patchwork/patch/1031440/