adc measurement of channel P03 wrong

⚠️
嗨,...感谢您来论坛。令人兴奋的消息!我们现在正在迁至我们的新论坛平台,将提供更好的功能,并包含在主对话框网站中。所有帖子和帐户都已迁移。我们现在只接受新论坛上的流量 - 请发布任何新线程https://www.dialog-seminile.com/support.。我们将在未来几天修复错误/优化搜索和标记。
11个帖子/ 0新
最后一篇
戴维德
离线
最后一次露面:2 years 4 months ago
加入:2017-11-17 08:35
adc measurement of channel P03 wrong

Hello Support,

i have a problem with the adc Channel P03.
The measurements of the adc Channels P00, P01, P02 work fine, but with the Channel P03 i always get one wrong value.
我使用的电路板是DA14580的DK-Basic-套件。

这是我的代码:
// ADC配置
#define GPIO_ADC1_PORT GPIO_PORT_0
#define gpio_adc1_pin gpio_pin_1.
#define gpio_adc0_port gpio_port_0.
#define gpio_adc0_pin gpio_pin_0.
#define GPIO_ADC2_PORT GPIO_PORT_0
#define GPIO_ADC2_PIN GPIO_PIN_2
#define gpio_adc3_port gpio_port_0.
#define GPIO_ADC3_PIN GPIO_PIN_3

保留_GPIO(ADC_PIN1,GPIO_ADC1_PORT,GPIO_ADC1_PIN,PID_ADC);
RESERVE_GPIO(ADC_PIN0, GPIO_ADC0_PORT, GPIO_ADC0_PIN, PID_ADC);
RESERVE_GPIO(ADC_PIN2, GPIO_ADC2_PORT, GPIO_ADC2_PIN, PID_ADC);
保留_gpio(adc_pin3,gpio_adc3_port,gpio_adc3_pin,pid_adc);

GPIO_ConfigurePin(GPIO_ADC1_PORT,GPIO_ADC1_PIN, INPUT, PID_ADC, false);
GPIO_ConfigurePin(GPIO_ADC0_PORT,GPIO_ADC0_PIN, INPUT, PID_ADC, false);
GPIO_ConfigurePin(GPIO_ADC2_PORT,GPIO_ADC2_PIN, INPUT, PID_ADC, false);
gpio_configurepin(gpio_adc3_port,gpio_adc3_pin,输入,pid_adc,false);

//function of adc sample
UINT16_T ADC_READ_P03_CHANNEL(void)
{

uint16_t adc_sample, adc_sample2;

adc_init(GP_ADC_SE, 0, GP_ADC_ATTN3X);

ADC_ENABLE_CHANNEL(ADC_CHANNEL_P03);

adc_sample = adc_get_sample();

adc_init(GP_ADC_SE, 0, GP_ADC_ATTN3X);

ADC_ENABLE_CHANNEL(ADC_CHANNEL_P03);

adc_sample2 = adc_get_sample();
adc_sample = (adc_sample2 + adc_sample);
adc_disable();

返回ADC_SAMPLE.
}

问候
David

Keywords:
ADC
Device:
lc_dialogg.ydF4y2Ba
离线
最后一次露面:3 weeks 4 days ago
职员
加入:2016-09-19 23:20
Hi David,

Hi David,

I have tried the same implementation on my side and I am getting the appropriate values on a Basic DK. All I did differently was to print the values read and also I am calling this function during theapp_validate_sleep回调要重复测试函数。

也许您可以在引导配置期间尝试调用ADC,或者可能会添加一些延迟adc_init就像它已经完成adc_get_vbat_sample.。看看你是否获得了更好的结果。

Note: Also, I have noticed in your code that you returning the samples added but not divided by 2. Just wanted to raise this if that is not what you intended to do.

如果您仍然有问题,请告诉我,可能会更有洞察力。

最好的,
lc_dialogg.ydF4y2Ba

戴维德
离线
最后一次露面:2 years 4 months ago
加入:2017-11-17 08:35
感谢您及时的回复

感谢您及时的回复。

I tried everything and it didn't work.
如果我在p03上测量1v或3v,则ADC显示了一个无关,但它始终围绕相同的范围。我检查引脚的电压,没有信号,我得到0V,因此没有偏移量。
The other channels work with my implementation,, so i think the conversation or the configuration of channel P03 is wrong.

I changed the code of the ble pheripheral example.
Is there any Configuration on this Pin, that i don't know?

谢谢你的建议。
You're right that i don't divide after the addition, but i has no affect of the wrong Channel.

问候
David

lc_dialogg.ydF4y2Ba
离线
最后一次露面:3 weeks 4 days ago
职员
加入:2016-09-19 23:20
Hi David,

Hi David,

I will look for more possible issues here. However, could you try and use theextent_peripheral_template.项目并测试此实施。该项目没有任何可能干扰和优先事项的不必要的操作。

此外,您如何调用此功能。是在启动期间或之后的某个点重复调用函数。

最好的,
lc_dialogg.

戴维德
离线
最后一次露面:2 years 4 months ago
加入:2017-11-17 08:35
Hi LC,

Hi LC,

我修改了bie pheripheral例子dc measurement and send it to the Computer via BLE. I use the function app_adcvall_timer_cb_handler like in the example to send the value every second.

我用空相干模板上的所有通道测试了ADC,另外使用带有UART作为输出的改进的电池示例。
它总是相同的结果。
Channel P00, P01, P02 shows the right value ( 1V, 2V, 3V), but Channel P03 shows alway the same one value (in binary format: 1110001100). The value varies about the last two bits. so the measurement on P03 occurs.
I also checked the contact from the pin P03 to the chip, everything okay.

该频道是否有可能在芯片内部有任何损坏?

Best regards,
David

lc_dialogg.ydF4y2Ba
离线
最后一次露面:3 weeks 4 days ago
职员
加入:2016-09-19 23:20
Hi David,

Hi David,

这很奇怪,只有频道P03显示奇怪的行为。我们在580年上没有见过ADC的任何此类问题。过去有一些百分比的准确性问题,但没有这样做。说过,我想确认与实施有关的事情。
1. Is this pin P03 being used for any other purpose. The primary would be the CS Pin for Flash memory. This might cause some disturbance on the pin as it is loaded.
2.您可以在不同的DEV套件上测试这一点。这是为了排除任何硬件相关问题。
3.您可以使用3x衰减模式与ADC进行测试禁用and check if there results are improved.

它不清楚是什么导致这一点,但是,我会随时向您发布,因为我探讨了这个问题。

最好的,
lc_dialogg.ydF4y2Ba

戴维德
离线
最后一次露面:2 years 4 months ago
加入:2017-11-17 08:35
Hi LC-Dialog,

Hi LC-Dialog,

我买了同样的事情,但我检查了所有GPIO预留和配置的其他目的。我找不到任何东西。
2. If there is no solution i will by another 14580 chip and test this first.

3.没有3x衰减通道P03,我获得最高值(1111111111),3x衰减我得到大约3,2V(1110001100,1110001101,1110001011)。我创建的信号并不重要。
我还使用示波器检查了PIN,也连接到芯片。没有偏移。不是作为输出的值。

Is there a possibility that you can get this 3,2V with software or any GPIO configuration?
否则我认为芯片有内部损坏。

Thanks
David

lc_dialogg.ydF4y2Ba
离线
最后一次露面:3 weeks 4 days ago
职员
加入:2016-09-19 23:20
Hi David,

Hi David,

I am curious if you had a chance to try out the ADC implementation on a different kit?

此外,由于有时,即使在其他频道上未接收到其他频道,ADC也可能受到干扰,即使它们不用于ADC目的,也可能会受到任何活动。例如,如果存在任何UART活动等,则在通道3用于ADC的通道3时,ADC读数可能存在一些不一致的。请确保正常处理以避免这种情况。

Coming back to the original question, there is still no explanation as to why you are getting only certain fixed incorrect values on the Channel 3 alone.

Regariding your question: Is there a possibility that you can get this 3,2V with software or any GPIO configuration?
如果您要询问将ADC通道3映射到任何其他GPIO,我担应不担担,因为ADC的4个通道以硬件连接到端口0的下4个引脚。

最好的,
lc_dialogg.ydF4y2Ba

戴维德
离线
最后一次露面:2 years 4 months ago
加入:2017-11-17 08:35
嗨lc_dialog,

嗨lc_dialog,

i will change the chip on my board in a few days.
I checked everything of software settings and i also tested a few hardware settings.
我发现频道的值是VDD3V3。我需要更长时间的时间,因为我总是用USB使用调试器。
在电池或电压发生器的使用后,该值就像电源电压。
I let you know if the problem is solved after changing the chip.

问候,

David

戴维德
离线
最后一次露面:2 years 4 months ago
加入:2017-11-17 08:35
嗨lc_dialog,

嗨lc_dialog,

after changing the Da14580-chip the Channel P03 works. So it was a hardware problem.
Now all four channels work perfect. I don't know the reason of this damage but it's annoying that it takes so long.

Do you know the reference voltage and accuracy of the adc?
I did a few measurements and if i want to convert the value of the adc i calculate with 3.6V. But if i calculate with 3.7V as reference voltage, the converted value is more accurate to the voltage on the adc pins. I think the implemented software is correct.

问候,
David

lc_dialogg.ydF4y2Ba
离线
最后一次露面:3 weeks 4 days ago
职员
加入:2016-09-19 23:20
Hi David,

Hi David,

That is good to know the issue is resolved. Though the hardware damages are pretty rare and can happen due to many reasons like storing outside longer after opening the package, ESDs in production etc.,

关于精度,在DA14580已知问题文件中存在非常好的参考,用于ADC测量和预防措施。有关任何澄清,请查看该文件并接触我们。

最好的,
lc_dialogg.ydF4y2Ba