⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
11 posts / 0 new
Last post
大卫W
Offline
Last seen:2 years 7 months ago
Joined:2017-11-17 08:35
ADC测量通道P03错误

你好支持,

我对ADC通道P03有问题。
ADC通道P00,P01,P02的测量工作正常,但是通过通道P03,我总是得到一个错误的值。
The board i use is the DK-Basic-Kit with Da14580.

Here is my code:
//ADC configuration
#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.

RESERVE_GPIO(ADC_PIN1, GPIO_ADC1_PORT, GPIO_ADC1_PIN, PID_ADC);
保留_GPIO(ADC_PIN0,GPIO_ADC0_PORT,GPIO_ADC0_PIN,PID_ADC);
保留_GPIO(ADC_PIN2,GPIO_ADC2_PORT,GPIO_ADC2_PIN,PID_ADC);
RESERVE_GPIO(ADC_PIN3, GPIO_ADC3_PORT, GPIO_ADC3_PIN, PID_ADC);

gpio_configurepin(gpio_adc1_port,gpio_adc1_pin,输入,pid_adc,false);
gpio_configurepin(gpio_adc0_port,gpio_adc0_pin,输入,pid_adc,false);
gpio_configurepin(gpio_adc2_port,gpio_adc2_pin,输入,pid_adc,false);
GPIO_ConfigurePin(GPIO_ADC3_PORT,GPIO_ADC3_PIN, INPUT, PID_ADC, false);

// ADC样本的功能
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();

return adc_sample
}

Regards
大卫

关键词:
ADC
设备:
lc_dialog
Offline
Last seen:1个月1周前
Staff
Joined:2016-09-19 23:20
嗨大卫,

嗨大卫,

我在我身边尝试过同样的实施,我正在获得基本DK上的适当价值观。我所做的就是打印读取的值以及我在呼叫此功能app_validate_sleep.callback to test the function repeatedly.

Maybe you can try callibrating the ADC during the bootup config step or may be add some delay after theADC_INIT.like it was done inadc_get_vbat_sample. See if you get better results.

注意:另外,我已经注意到您的代码中,您返回添加的样本但不划分2.只想提出这个,如果这不是您打算做的事情。

Please let me know if you are still having the issue and may be some more insights into the problem.

Best,
lc_dialog

大卫W
Offline
Last seen:2 years 7 months ago
Joined:2017-11-17 08:35
谢谢for the quick response

感谢您及时的回复。

我尝试了一切,它不起作用。
It doesn't matter if i take a measurement of 1V or 3V on P03, The adc shows one random value, but its always about the same range. I check the voltage of the pin without signal and i get 0V, so there is no offset.
其他频道与我的实现一起工作,所以我认为频道p03的对话或配置是错误的。

我更改了BLE Pheripheral示例的代码。
这个引脚有没有配置,我不知道?

Thank you for that advise.
你是对的,我不会在添加后划分,但我对错误的频道没有影响。

Regards
大卫

lc_dialog
Offline
Last seen:1个月1周前
Staff
Joined:2016-09-19 23:20
嗨大卫,

嗨大卫,

我可以在这里寻找更多可能的问题。但是,你能尝试使用吗?Empty_Peripheral_Templateproject and test this implementation. This project is free from all the unnecessary operations that might sometimes interfere and take priority.

还有,你是怎么调用这个函数。是function being called repeatedly or just once at some point during or after bootup.

Best,
lc_dialogg

大卫W
Offline
Last seen:2 years 7 months ago
Joined:2017-11-17 08:35
嗨LC,

嗨LC,

我修改了BLE Pherianizal示例以取出ADC测量并通过BLE将其发送到计算机。我使用函数app_adcvall_timer_cb_handler如示例中发送了每秒值。

I tested the adc with all channels on the empty pheripheral template & additionally with a modified battery example with Uart as output.
Its always the same result.
通道P00,P01,P02显示右值(1V,2V,3V),但通道P03显示相同的一个值(以二进制格式:1110001100)。该值差异达到最后两位。所以p03上的测量发生。
我还检查了PIN P03到芯片的联系人,一切都好。

Is it possible that this channel has any damage in the inside of the chip?

此致,
大卫

lc_dialog
Offline
Last seen:1个月1周前
Staff
Joined:2016-09-19 23:20
嗨大卫,

嗨大卫,

This is very strange that only the Channel P03 is showing wierd behavior. We haven't seen any such issue on the ADC on our 580. There were some percentage accuracy issue noticed in the past but nothing like this. Having said that, I would like to confirm a couple of things related to the implementation.,
1.该引脚P03是否用于任何其他目的。主要是闪存的CS引脚。这可能会导致销上的一些干扰。
2. Can you test this on a different Dev Kit. This is to rule out any hardware related issue.
3. Can you test with the ADC with 3x attenuation modedisabled并检查是否有提高结果。

It is not clear what is causing this exactly but, I will keep you posted as I explore into this issue.

Best,
lc_dialog

大卫W
Offline
Last seen:2 years 7 months ago
Joined:2017-11-17 08:35
嗨LC对话框,

嗨LC对话框,

1. I tought the same thing, but i checked all GPIO reservations and configuration for other purpose. I can't find anything.
2.如果没有解决方案,我将在另一个14580芯片上进行测试并首先测试。

3. Without 3x attenuation on channel P03 i get the highest value(1111111111), with 3x attenuation i get about 3,2V (1110001100 , 1110001101, 1110001011) . It doesn't matter what signal i create.
I also checked the pin with my oscilloscope and also the connection to the chip. No offset. Not the value getting as output.

您是否可以使用软件或任何GPIO配置获得3,2V?
Otherwise i think the chip has an internal damage.

谢谢
大卫

lc_dialog
Offline
Last seen:1个月1周前
Staff
Joined:2016-09-19 23:20
嗨大卫,

嗨大卫,

如果您有机会在不同的套件上尝试ADC实现,我很好奇?

Also, as it comes to be sometimes, the ADC might be disturbed if there is any activity going on over the other channels even though they are not being used for ADC purpose. Say if there is any UART activity etc., on channels 0/1/2 when the channel 3 is being used for ADC there might be some inconsistencies in the ADC readings. Please make sure that the timing is handled properly to avoid this scenario.

返回原始问题,仍然没有解释为什么您只在频道3上只能确定频道3上的某些固定的错误值。

重新加权问题:是否有可能使用软件或任何GPIO配置获得3,2V?
If you are asking about mapping the ADC channel 3 to any other GPIO, I am afraid that is not possible as the 4 channels of the ADC are connected in hardware to the lower 4 pins of the Port 0.

Best,
lc_dialog

大卫W
Offline
Last seen:2 years 7 months ago
Joined:2017-11-17 08:35
Hi LC_Dialog,

Hi LC_Dialog,

我会在几天内更换我的董事会的芯片。
我检查了软件设置的所有内容,我还测试了一些硬件设置。
I found out that the value of the channel is VDD3V3. I takes a longer time because i always use the debugger with usb.
Aftert the usage of the battery or a voltage generator, the value is like the supply voltage.
如果在更换芯片后,我会通知您是否解决了问题。

问候,

大卫

大卫W
Offline
Last seen:2 years 7 months ago
Joined:2017-11-17 08:35
Hi LC_Dialog,

Hi LC_Dialog,

在更改DA14580芯片后,通道P03工作。所以这是一个硬件问题。
现在所有四个渠道都工作完美。我不知道这种伤害的原因,但它很烦人,这需要很长时间。

您是否知道ADC的参考电压和准确性?
我做了一些测量,如果我想转换ADC I的值,我用3.6V计算了ADC。但是如果我用3.7V计算为参考电压,则转换值更加准确于ADC引脚上的电压。我认为实施的软件是正确的。

问候,
大卫

lc_dialog
Offline
Last seen:1个月1周前
Staff
Joined:2016-09-19 23:20
嗨大卫,

嗨大卫,

很高兴知道问题得到解决。虽然硬件损坏非常罕见,但由于在打开包装,生产中的eSDS等后,可能会出现在更长时间内的原因,

Regarding the accuracay, there is a very good reference in the DA14580 Known Issues document for the ADC measurements and precautions. Please review the document and reach us back regarding any clarifications.

Best,
lc_dialog