Skip to content

ad7689 can not read adc with internal-ref #2991

@czjczjczjczjczjczj

Description

@czjczjczjczjczjczj
read code is:
    /*
 * 1: write CFG for sample N and read old data (sample N-2)
 * 2: if CFG was not changed since sample N-1 then we'll get good data
 *    at the next xfer, so we bail out now, otherwise we write something
 *    and we read garbage (sample N-1 configuration).
 */
for (i = 0; i < 2; i++) {
	ret = ad7949_spi_write_cfg(ad7949_adc,
				   FIELD_PREP(AD7949_CFG_MASK_INX, channel),
				   AD7949_CFG_MASK_INX);
	if (ret)
		return ret;
	if (channel == ad7949_adc->current_channel)
		break;
}

/* 3: write something and read actual data */
if (ad7949_adc->spi->bits_per_word == 8)
	ret = spi_read(ad7949_adc->spi, &ad7949_adc->buf8b, 2);  // at this whill send 0xff to ad7689 and ad7689 will set to external-ref 
else
	ret = spi_read(ad7949_adc->spi, &ad7949_adc->buffer, 2); // at this whill send 0xff to ad7689 and ad7689 will set to external-ref 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions