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.

ADS7138-Q1: ADS7138QRTERQ1

Part Number: ADS7138-Q1

Tool/software:

Hi  Team,

We need firmware support for the part number:ADS7138QRTERQ1

how to select the Each channel and read the ADC data in ADS7138QRTERQ1 using STM32 EVK .Please advise  or Provide sample firmware .

Regards,

Ajay S

  • Hi Ajay,

    Unfortunately we don't have any code examples targeting this device and platform to share as of now, other than a register definition header file. For our current code example offerings, please check out our GitHub page.

    https://github.com/TexasInstruments/precision-adc-examples/

    Regards,
    Joel

  • We are using the two ADs7138-q1 both are connected in parallel , now I need to read the AIN0 ADC pin in both Ic's,

    how to select the AIN0 ADC channel in Both IC one by one and read the adc data correctly,

    Now I am trying to read directly through I2C using IC  Address,

    here, I attached the  my code also   ,Kindly ,check and advise.       

      uint16_t Read_ADC(I2C_HandleTypeDef *hi2c, uint16_t device_address)

    {

        uint8_t data[10];

        uint16_t adc_value = 0;

    #if 1

       if (HAL_I2C_Master_Receive(hi2c, device_address, data, 2, HAL_MAX_DELAY) != HAL_OK) {

           Error_Handler();

        }

     

    #endif  // Print raw I2C data to UART

             char uart_msg[50];

            // snprintf(uart_msg, sizeof(uart_msg), "Raw ADC Data: 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\r\n", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9]);

             snprintf(uart_msg, sizeof(uart_msg), "Raw ADC Data: 0x%02X 0x%02X\r\n", data[0], data[1]);

             HAL_UART_Transmit(&huart6, (uint8_t*)uart_msg, strlen(uart_msg), HAL_MAX_DELAY);

     

        // Combine MSB and LSB

        adc_value = (data[0] << 8)| data[1];

        //adc_value = adc_value1*3.3/65535;

        return adc_value;

    }

     

    // Convert ADC value to voltage

    float ADC_to_Voltage(uint16_t adc_value) {

        float reference_voltage = 3.3f;

        float resolution = 65536.0f; // 16-bit resolution

        return (adc_value * reference_voltage) / resolution;

    }

     

    // Function to Print ADC Voltages over UART

    void Print_ADC_Voltages(float adc1_voltage, float adc2_voltage) {

        char uart_msg[50];

        snprintf(uart_msg, sizeof(uart_msg), "ADC1 Voltage: %.3f V, ADC2 Voltage: %.3f V\r\n", adc1_voltage, adc2_voltage);

        HAL_UART_Transmit(&huart6, (uint8_t*)uart_msg, strlen(uart_msg), HAL_MAX_DELAY);

    }

  • Hi Ajay,

    It would be hard for me to verify the operation of this code without the controller and hardware setup in hand, but at a glance it looks okay. If you happen to run into any issues, it would be easier for me to debug with something like a logic analyzer capture rather than the source code. Please let me know if I can provide further assistance in this way.

    Regards,
    Joel