ESP8266 Developer Zone The Official ESP8266 Forum 2016-03-02T16:31:52+08:00 https://bbs.espressif.com:443/feed.php?f=6&t=1815 2016-03-02T16:31:52+08:00 2016-03-02T16:31:52+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1815&p=5917#p5917 <![CDATA[Re: ADC strange issue]]>

@ESP_Alfred thanks very much for running the tests. I will rerun mine tonight with the volt meter disconnected and see what I get. I have also done some more testing on the issue where calling ADC read corrupts the memory and the esp goes into a continual crash. (BTW - let me know if you want me to open a seperate thread on this). I *think* it has something to do with the flash size. I have been using 1M (Esp 23f) without any problems. When I started using the ADC read it would kill the esp. The only way to get it back was to erase it with esptool and reflash the standard bin files you deliver BUT this will only work if flash size is 4M. Even doing this with a flash size of 1M fails. Using 4M flash size last night I was able to use ADC read with no issue and reflashed several times without issue.

It is almost as if the calll corrupts the flash somewhere after the 1M zone . I am fairly sure I can reproduce this at will so if you need me to run any tests to get to the bottom of the bug let me know. (Eg I read about String causing heap corruption due to using free instead is sys_free. Maybe ADC read does a similar thing

Thanks again both.
Lee.

Statistics: Posted by leenowell — Wed Mar 02, 2016 4:31 pm


]]>
2016-03-02T13:26:21+08:00 2016-03-02T13:26:21+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1815&p=5903#p5903 <![CDATA[Re: ADC strange issue]]>
leenowell wrote:
Thanks, I will try them tonight. I saw a couple of posts talking about a heap corruption issue (mainly relating to String) so wonder if this is related?

In terms of the test, do you want me to flash these files and then upload my code?

@Jimmy - I was able to run your test last night as it was limping along. I set up the voltage divider with gnd---- 1k ---- (A) ----- 2.4k ----- vcc

Measuring at (A) gave me much more stable results and ball park what I would expect from my measured voltage. So... Looks like you were right thanks.

This gives me a bit of a headache as the thermistor I am using is a meat probe and all I can find seem to be 100k at room temp. Does anyone know what the safe minimum current that the ADC requires ?

Thanks

Lee.


hi, Lee
This is my test environment : +3.3v ------ 450k resistor ------ (A)------ 90k thermistor ------- GND
we test the point (A) without voltmeter, the value within the range of ±8. The attachment file is the original test data.

It might also be noted that the point (A) couldn't connect to other load include the voltmeter, if not ,the range of ADC value will become ±110. The attachment file is the original test data.

We have some other advice for your case:
1. May be add a capacitor between the pin ADC and GND.
2. Averaging the testing values of repeated measurements.
3. You could bring the chip into modem sleep mode, reference the API "wifi_fpm_do_sleep". then "system_adc_read".
test1.xls

Statistics: Posted by ESP_Alfred — Wed Mar 02, 2016 1:26 pm


]]>
2016-03-02T05:51:26+08:00 2016-03-02T05:51:26+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1815&p=5890#p5890 <![CDATA[Re: ADC strange issue]]> What you could to to solve your problem with the high impedance voltage divider resistors is to use a ]voltage follower (See:https://en.wikipedia.org/wiki/Operational_amplifier_applications#Voltage_follower_.28unity_buffer_amplifier.29) . It's just one simple OP-amp, could be as small as an SOT23-5 . Make sure to use one that handles positive-only supply, has high input impedance,is unity-gain stable (And if needed low temperature coefficient and other parameters relevant to your design). A part that MIGHT work for your application (from what we've been told so far) is Micrchips MCP6031http://www.microchip.com/wwwproducts/en/MCP6031. That and a decoupling capacitor could be enough to solve your problem (If the chosen OP-amp doesn't handle capacitive loads well a 10-100 Ohms resistor in series with the OP-amp output is a good idea). Throw in a couple of more resistors and you can adjust the temperatur voltage divider to optimally match the 0-1 v input range of the ADC.

Kind regards
Jimmy



leenowell wrote:
Thanks, I will try them tonight. I saw a couple of posts talking about a heap corruption issue (mainly relating to String) so wonder if this is related?

In terms of the test, do you want me to flash these files and then upload my code?

@Jimmy - I was able to run your test last night as it was limping along. I set up the voltage divider with gnd---- 1k ---- (A) ----- 2.4k ----- vcc

Measuring at (A) gave me much more stable results and ball park what I would expect from my measured voltage. So... Looks like you were right thanks.

This gives me a bit of a headache as the thermistor I am using is a meat probe and all I can find seem to be 100k at room temp. Does anyone know what the safe minimum current that the ADC requires ?

Thanks

Lee.

Statistics: Posted by Triacon — Wed Mar 02, 2016 5:51 am


]]>
2016-02-29T16:22:59+08:00 2016-02-29T16:22:59+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1815&p=5861#p5861 <![CDATA[Re: ADC strange issue]]>
In terms of the test, do you want me to flash these files and then upload my code?

@Jimmy - I was able to run your test last night as it was limping along. I set up the voltage divider with gnd---- 1k ---- (A) ----- 2.4k ----- vcc

Measuring at (A) gave me much more stable results and ball park what I would expect from my measured voltage. So... Looks like you were right thanks.

This gives me a bit of a headache as the thermistor I am using is a meat probe and all I can find seem to be 100k at room temp. Does anyone know what the safe minimum current that the ADC requires ?

Thanks

Lee.

Statistics: Posted by leenowell — Mon Feb 29, 2016 4:22 pm


]]>
2016-02-29T15:24:56+08:00 2016-02-29T15:24:56+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1815&p=5860#p5860 <![CDATA[Re: ADC strange issue]]>
Attached is the test bin files that based on our official SDK_V1.3.0.

We havn't reproduced your problems.

Please test again with the firmware that attached.

More informations, please let us know.

Thanks.
bin download.rar

Statistics: Posted by Espressif_Kelly — Mon Feb 29, 2016 3:24 pm


]]>
2016-02-29T03:50:43+08:00 2016-02-29T03:50:43+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1815&p=5855#p5855 <![CDATA[Re: ADC strange issue]]>

Code:

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld
system param error
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


@Jimmy - I set up the test with much lower resistors as promised but unable to read ADC due to the above :(

thanks

Lee.

Statistics: Posted by leenowell — Mon Feb 29, 2016 3:50 am


]]>
2016-02-29T03:30:16+08:00 2016-02-29T03:30:16+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1815&p=5854#p5854 <![CDATA[Re: ADC strange issue]]>
There is definitely something very strange going on. As you could see from the output I attached earlier, it keep randomly crashing with an exception. Following this test, I tried to do some further analysis by moving to remove the ardunio libs and only use the SDK. The board became completely bricked and would immediately crash on boot and keep doing this continuously.

I have now spent all weekend trying to get it up and running again. After a lot of trial and error, I managed to recover it by erasing the flash using esptool.py and then reloading new firmware posted by someone else who had the same problem. I then uploaded some code which simply printed out debug statements on setup and in the loop. This worked fine with no crash (only run for a minute or so). I then added one line which was to read the ADC, uploaded it and it went back into the bricked state.

Based on this and my initial experience, it seems that reading the ADC seems to corrupt the memory somehow. I have repeated my "fix" above (including removing the ADC read line) but unfortunately have not got it working again.

All very odd. Any thoughts/ test to perform to get to the bottom of this?

thanks

Lee

Statistics: Posted by leenowell — Mon Feb 29, 2016 3:30 am


]]>
2016-02-27T16:14:36+08:00 2016-02-27T16:14:36+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1815&p=5840#p5840 <![CDATA[Re: ADC strange issue]]>
As promised please find attached a tar with code, output and version number which exhibits the behaviour. There is a README.txt file which details the cut down test as well as version number (which I believe is 1.3.0_15_08_10p1).

@Jimmy - thanks very much for your reply. A couple of thoughts
1. in terms of the resistance, good thought. I will set up a new circuit with much smaller resistors and post the results. I will have to use fixed resistors though
2. Your capacitance point is interesting. I have a delay of 5 seconds between reads so think we should be fine? However, in my real situation I want to wake out of deep sleep, read temperature then send it to a server. Would I need to have a delay to ensure the ADC is charged?

thanks all for your help

Lee.
leeplaytest.tar

Statistics: Posted by leenowell — Sat Feb 27, 2016 4:14 pm


]]>
2016-02-27T06:15:58+08:00 2016-02-27T06:15:58+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1815&p=5839#p5839 <![CDATA[Re: ADC strange issue]]> My guess would be that your sensors resistance is to high and can't supply the ADC with the current needed during sampling to fully charge the sampling capacitor. Resistors of at least a factor 10 lower resistance should help. Other things that help is lowering the sample speed if possible as this gives the sampling capacitor longer time to charge (Not sure if that is possible or enough on the ESP8266). Or If you can have some pause between measurements you can add your own capacitor between GND and (A) and let it charge up and then start the ADC sampling (Don't forget to take into account that your effectively creating a low pass filter so mind the R to C ratio).
Good luck.
Kind regards
Jimmy

Statistics: Posted by Triacon — Sat Feb 27, 2016 6:15 am


]]>
2016-02-26T17:18:12+08:00 2016-02-26T17:18:12+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1815&p=5835#p5835 <![CDATA[Re: ADC strange issue]]>
Please help provide the following information.

1.SDK version

2.Reference Codes and Log Output

You can also send e-mail to our feedback@espressif.com for further communication.

Thanks.

Statistics: Posted by Espressif_Kelly — Fri Feb 26, 2016 5:18 pm


]]>
2016-02-25T01:06:02+08:00 2016-02-25T01:06:02+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1815&p=5821#p5821 <![CDATA[ADC strange issue]]>
Firstly sorry if this appears as a duplicate. I posted it earlier but it seems to have disappeared....

I have an ESP12F which I am looking to use as a thermometer. The wiring is essentially

+3.35v ------ 400k resistor ------ (A)------ 100k thermistor ------- GND

With point (A) connected to the ADC pin and the power supplied by a ftd1232. Looking at the voltage across (A) and GND I get a steady approximately 0.726v (+/- 0.003) however when reading the ADC value using system_adc_read I get values varying from around 740 to 650 and sometimes over 800.

Anyone any idea what could be causing this level of variation?

thanks

Lee.

Statistics: Posted by leenowell — Thu Feb 25, 2016 1:06 am


]]>