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.

ads8317通过spi采集数据问

Other Parts Discussed in Thread: ADS8317

VDD位5.0v

-IN位接地

+IN为输入电压

Vref为2.5v,

我给+IN5.0v电压时候,读出来为32767,为7FFF

我给+IN2.5V电压,读出来为16474(数值有一些波动,不是很稳定)

+IN短接,读出来为151

下面是我spi_read的程序,我通过给到的芯片手册

static int ads8317_adc_conversion(struct ads8317 *adc, u32 channel)
{
	int ret;
	printk("into %s\n",__func__);
	printk("into %s,channel:%d\n",__func__,channel);
//	adc->buffer = 0;
//	printk(" adc->buffer:%x\n",adc->buffer);
	
	struct spi_transfer	t = {
			.rx_buf		= &adc->buffer,
			.len		= 3,
		};	
	struct spi_message	m; 
	spi_message_init(&m);
	spi_message_add_tail(&t, &m);
	ret = spi_sync(adc->spi, &m);
	if(ret)
		return ret;
		udelay(2);
	printk(" adc->buffer0:%x\n",adc->buffer[0]);
	printk(" adc->buffer1:%x\n",adc->buffer[1]);
	printk(" adc->buffer2:%x\n",adc->buffer[2]);
	
	return ((((adc->buffer[0] << 16) | (adc->buffer[1] << 8) | adc->buffer[2])>>2)&0xffff);
	
}
我想问两个问题
1我的位转换是否有问题?
2在ads8317芯片手册中的20页关于table1的表哥能否给出详细的解释,我不是很看的懂