Hi Would you kindly heip
Problem 1: After ADC initialization, ADC module does not work. Read register ADC_SC1 to observe that the ADCH value is 11111, which means that ADC module is disabled, and it is useless to write repeatedly.While other registers ADC_SC2 and ADC_SC3 are normal, why fail to write register ADC_SC1?
Question 2: Power pins VDD and VDDA/VREFH are directly connected together, and frequent power-on and power-off will cause the phenomenon of problem 1. Is it caused by this reason?
问题1:ADC初始化后,ADC模块不工作,读寄存器ADC_SC1观察,其中的ADCH值是11111,也就是说ADC模块禁能,再重复写也没用。而其他寄存器ADC_SC2,ADC_SC3正常,为什么写寄存器ADC_SC1失败,
问题2:电源引脚VDD与VDDA/VREFH,直接连在一起使用,频繁上下电,是否会导致问题一的现象,是否是由于这个原因引起的?
您好,我已经按照您说的实行了。
还是没有解决问题,故障还是偶尔出现在刚上电的时刻。也就是说,上电时存在ADC模块启动不正常的现象,且通过ADC初始化,不能消除。
当发现ADC不能触发和转换时,ADC_SC1中的ADCH = 0x1F。
程序中ADC初始化时已经将ADC_SC4[AFDEP]写入 000,且每次触发通道转换时,先向ADC_SC1写入0x1F,再写入要触发的通道号。
在故障出现后,通过清除SIM_SCGC的第29位,关闭 ADC 时钟,然后再打开,重新设置ADC模块的相关寄存器。ADC模块仍不能回复正常工作。
什么原因能导致这个MCU 的ADC在上电时出现故障?且故障永远无法消除,必须通过重新上电或MCU复位,才有可能消除。
我们能进行电话沟通吗?
我的电话和微信是:13287679213,感激不尽。
Hi,
I've done what you said.
The fault still exists,
and the fault still occasionally appears at the moment of power on,and it cannot be eliminated through ADC initialization.
ADC_SC1 ADCH = 0x1F,when it is found that the ADC cannot trigger and convert. then ADC_SC1 can not be written, ADC_SC1 still keeps
0x1F.
ADC_SC4[AFDEP] has been written to 000 when the ADC is initialized in the program, and each time the channel conversion is triggered, 0x1F is written to ADC_SC1 first, and then the channel number to be triggered.
After a fault occurs, turning off the ADC clock by clearing bit 29 of SIM_SCGC, then turning it on again, by clearing bit 29 of SIM_SCGC, Rewrite the relevant registers of the ADC module, The fault always exists.
What causes the ADC of this MCU fail during power-on? And the fault can never be eliminated, except re-powered or MCU reset.
Can we talk on the phone ?My phone number is 13287679213,So is wechat. Very grateful!!!
Hi,
You have enable ADC gated clock by setting the bit 29 of SIM_SCGC register before you write ADC registers.
Secondly, you have to connect a crystal on the XTAL/EXTAL pins, which is ADC clock.
Hope it can help you
BR
XiangJun Rong
Hi Pls help ,thanks
The ADC initialization has set bit 29 of the SIM_SCGC register, which also uses a 10M external crystal oscillator.
The following symptoms occasionally occur during power-on: The ADC does not work in single conversion mode and is read
Register observation, ADC_SC2, ADC_SC3 write value is normal,
The ADC_SC1 register cannot be written, resulting in the ADC cannot be triggered, where the ADCH value is 11111, and repeated writes cannot be written.Don't know why?
Register ADC_SC1 failed,
Is the power pin VDD used directly with VDDA/VREFH, or does the power-on slope affect the ADC?
ADC初始化已经设置寄存器SIM_SCGC的第29位,也使用了10M的外部晶振。
上电是时偶尔出现以下现象:单次转换模式下ADC不工作,读取
寄存器观察,ADC_SC2,ADC_SC3写入值正常,
而寄存器ADC_SC1无法写入,导致ADC不能触发,其中的ADCH值是11111,重复写也无法写入。不知道什么原因?
寄存器ADC_SC1失败,
电源引脚VDD与VDDA/VREFH,直接连在一起使用,或者上电斜率是否会影响ADC?
Hi,
Okay, I see that you has set bit 29 of the SIM_SCGC register, which also uses a 10M external crystal oscillator. You have connected the VDD, VDDA/VREFH, it is okay.
I do not know if you use software triggering mode or hardware mode.
If you use software mode and use polling mode to check if the ADC sampling is complete, this is the code:
uint16_t sample[100];
uint16_t i;
void main()
{
i=0;
ADC_SC2=0x00; //use software triggering mode
while(1)
{
//write the channel to ADC_SC1 register
ADC_SC1=0x01; //start-up ADC channel1 conversion
while(!(ADC_SC1&0x80)) {}
sample[i]=ADC_R;
if(i<100)
{
i++;
}
else
{
i=0;
__asm("nop"); //set a break point here
}
}
}
Pls have a try
Hope it can help you
BR
XiangJun Rong
Thanks for your strong support!!
Hi,
Okay, I see your issue.
If you fail to write the ADC_SC1, pls write the ADC_SC1 with ADCH 11111 and set the ADC_SC4[AFDEP] 000 in binary.
Pls have a try
BR
XiangJun Rong
硬件的模拟电压可上电时还没稳定好。会导致ADC模块不能使用吗?我的
If the voltage of the hardware is not stable when it is powered on, Will the power supply cause this fault?
您好,我已经按照您说的实行了。
还是没有解决问题,故障还是偶尔出现在刚上电的时刻。也就是说,上电时存在ADC模块启动不正常的现象,且通过ADC初始化,不能消除。
当发现ADC不能触发和转换时,ADC_SC1中的ADCH = 0x1F。
程序中ADC初始化时已经将ADC_SC4[AFDEP]写入 000,且每次触发通道转换时,先向ADC_SC1写入0x1F,再写入要触发的通道号。
在故障出现后,通过清除SIM_SCGC的第29位,关闭 ADC 时钟,然后再打开,重新设置ADC模块的相关寄存器。ADC模块仍不能回复正常工作。
什么原因能导致这个MCU 的ADC在上电时出现故障?且故障永远无法消除,必须通过重新上电或MCU复位,才有可能消除。
我们能进行电话沟通吗?
我的电话和微信是:13287679213,感激不尽。
Hi,
I've done what you said.
The fault still exists,
and the fault still occasionally appears at the moment of power on,and it cannot be eliminated through ADC initialization.
ADC_SC1 ADCH = 0x1F,when it is found that the ADC cannot trigger and convert. then ADC_SC1 can not be written, ADC_SC1 still keeps
0x1F.
ADC_SC4[AFDEP] has been written to 000 when the ADC is initialized in the program, and each time the channel conversion is triggered, 0x1F is written to ADC_SC1 first, and then the channel number to be triggered.
After a fault occurs, turning off the ADC clock by clearing bit 29 of SIM_SCGC, then turning it on again, by clearing bit 29 of SIM_SCGC, Rewrite the relevant registers of the ADC module, The fault always exists.
What causes the ADC of this MCU fail during power-on? And the fault can never be eliminated, except re-powered or MCU reset.
Can we talk on the phone ?My phone number is 13287679213,So is wechat. Very grateful!!!
Hi,
我检查了 KEA family的勘误表, 它没有提及ADC这个问题,我也没有好的方法。
作为一个workaround,当这个问题发生时,你可以产生system reset.
SCB-AIRCR|=0x04;
Hope it can help you
BR
XiangJun Rong