ESP8266 Developer Zone The Official ESP8266 Forum 2015-12-29T08:58:05+08:00 https://bbs.espressif.com:443/feed.php?f=66&t=1487 2015-12-29T08:58:05+08:00 2015-12-29T08:58:05+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1487&p=5174#p5174 <![CDATA[Re: system_adc_read 读取错误的问题]]> Statistics: Posted by Lucifer3502 — Tue Dec 29, 2015 8:58 am


]]>
2015-12-25T11:45:23+08:00 2015-12-25T11:45:23+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1487&p=5152#p5152 <![CDATA[Re: system_adc_read 读取错误的问题]]>
请参考如下使用

Code:

portENTER_CRITICAL();
val=system_adc_read();
portEXIT_CRITICAL();


感谢您对 ESP8266 的关注!

Statistics: Posted by ESP_Faye — Fri Dec 25, 2015 11:45 am


]]>
2015-12-18T14:30:42+08:00 2015-12-18T14:30:42+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1487&p=5084#p5084 <![CDATA[Re: system_adc_read 读取错误的问题]]>
我们已经测试并且复现到您提的问题。目前正在查证中。

后续解决问题并且通过测试后,会更新相关库文件给您。

感谢您对 ESP8266 的关注!

Statistics: Posted by ESP_Faye — Fri Dec 18, 2015 2:30 pm


]]>
2015-12-18T09:06:11+08:00 2015-12-18T09:06:11+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1487&p=5080#p5080 <![CDATA[Re: system_adc_read 读取错误的问题]]>
不知道这个问题确认的怎么样了,问题是否存在,还是我的使用有问题?

如果确实有问题,那么你们是在下个版本sdk中修复还是发布一个补丁?

Statistics: Posted by Lucifer3502 — Fri Dec 18, 2015 9:06 am


]]>
2015-12-14T09:56:10+08:00 2015-12-14T09:56:10+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1487&p=5023#p5023 <![CDATA[Re: system_adc_read 读取错误的问题]]>
您提到的问题,我们正在查证中,有任何更新将及时反馈给您。

感谢您对 ESP8266 的关注!

Statistics: Posted by ESP_Faye — Mon Dec 14, 2015 9:56 am


]]>
2015-12-12T08:02:06+08:00 2015-12-12T08:02:06+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1487&p=5015#p5015 <![CDATA[Re: system_adc_read 读取错误的问题]]>
#include "esp_common.h"

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#include "lwip/sockets.h"
#include "lwip/dns.h"
#include "lwip/netdb.h"
#include "uart.h"


void ICACHE_FLASH_ATTR
adc_task(void *pvParameters)
{
while(1)
{
unsigned short read_adc;
/*返回值单位:1/1024 V*/
read_adc = system_adc_read();
printf("READ ADC: %d\r\n", read_adc);
vTaskDelay(1000 / portTICK_RATE_MS);
printf("TM:%u: SM:%u, WIFI STATE: %u\n", system_get_time(), system_get_free_heap_size(), wifi_station_get_connect_status());
}
}

/******************************************************************************
* FunctionName : user_init
* Description : entry of user application, init user function here
* Parameters : none
* Returns : none
*******************************************************************************/
void ICACHE_FLASH_ATTR
user_init(void)
{
uart_init_new();
printf("SDK version:%s\n", system_get_sdk_version());

/* need to set opmode before you set config */
wifi_set_opmode(STATION_MODE);

struct station_config *config = (struct station_config *)malloc(sizeof(struct station_config));
memset(config, 0, sizeof(struct station_config));

sprintf(config->ssid, "Netcore");
sprintf(config->password, "");

/* need to sure that you are in station mode first,
* otherwise it will be failed. */
wifi_station_set_config(config);
//wifi_station_set_auto_connect(1);

free(config);

xTaskCreate(adc_task, "adc_task", 256, NULL, 2, NULL);
}




出现问题的log如下:

reconnect
TM:1316648810: SM:56792, WIFI STATE: 3
READ ADC: 206
TM:1317648811: SM:56792, WIFI STATE: 3
READ ADC: 206
scandone
no Netcore found, reconnect after 1s
reconnect
TM:1318648816: SM:56792, WIFI STATE: 3
READ ADC: 206
TM:1319648810: SM:56792, WIFI STATE: 3
READ ADC: 1024
scandone
no Netcore found, reconnect after 1s
reconnect
TM:1320648811: SM:56792, WIFI STATE: 3
READ ADC: 1024
TM:1321648810: SM:56792, WIFI STATE: 3
READ ADC: 1024

Statistics: Posted by Lucifer3502 — Sat Dec 12, 2015 8:02 am


]]>
2015-12-10T16:18:54+08:00 2015-12-10T16:18:54+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1487&p=4990#p4990 <![CDATA[Re: system_adc_read 读取错误的问题]]> Statistics: Posted by Lucifer3502 — Thu Dec 10, 2015 4:18 pm


]]>
2015-12-10T16:16:05+08:00 2015-12-10T16:16:05+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1487&p=4989#p4989 <![CDATA[Re: system_adc_read 读取错误的问题]]>
代码中就是在一个线程中的while循环中,加个一个子任务。这个子任务每一秒钟执行一次,子任务一开始就是读取adc的值。
unsigned int temp = 0;
unsigned short read_adc;
/*返回值单位:1/1024 V*/
read_adc = system_adc_read();

Statistics: Posted by Lucifer3502 — Thu Dec 10, 2015 4:16 pm


]]>
2015-12-10T10:19:32+08:00 2015-12-10T10:19:32+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1487&p=4980#p4980 <![CDATA[Re: system_adc_read 读取错误的问题]]>
请问您指的“断开路由器的情况下” 是什么意思?
是指使用 wifi_station_disconnect 断开路由器?还是指 ESP8266 原本连接着路由器,您将路由器断电了?
能否提供您的测试代码,以供查证。

Statistics: Posted by ESP_Faye — Thu Dec 10, 2015 10:19 am


]]>
2015-12-10T08:54:20+08:00 2015-12-10T08:54:20+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1487&p=4978#p4978 <![CDATA[Re: system_adc_read 读取错误的问题]]> Statistics: Posted by Lucifer3502 — Thu Dec 10, 2015 8:54 am


]]>
2015-12-05T14:04:05+08:00 2015-12-05T14:04:05+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1487&p=4912#p4912 <![CDATA[system_adc_read 读取错误的问题]]> 使用RTOS_SDK_V1.0.4版本,每秒钟读取adc值,主要是用来读取热敏电阻的两端的电压值,根据电压来计算环境温度。

测试方法:
1. 在能连接路由器的情况下,每秒钟调用一次system_adc_read读取值,是正常的,长运暂时没有发现问题。

2. 在断开路由器的情况下,当模组长运很长一段时间后,(个人长运挂了8个多小时),每次调用system_adc_read接口,都返回1024,该值不会变化。模块断电重启后就恢复正常了。 测试很多次,都是这样的现象。

这是不是一个很严重的bug?

Statistics: Posted by Lucifer3502 — Sat Dec 05, 2015 2:04 pm


]]>