-
https://github.com/espruino/EspruinoDocs/blob/master/devices/DHT22.js#L45
replace 6 with 30 and test again
-
I set the timeout to 30us and it works !
quoting the datasheet:
Data-bus's free status is high voltage level. When communication between MCU and DHT22 begin, program of MCU will transform data-bus's voltage level from high to low level and this process must beyond at least 1ms to ensure DHT22 could detect MCU's signal, then MCU will wait
20-40us
for DHT22's response. -
by default PICO does 100KHz and ESP8266 does about 100KHz (80MHz) and 250kHz (160MHZ)
@Frida please try again on PICO and use setup option bitrate:50000 and without Wait()
Do not use bitrate option on ESP, I will reboot ......
-
and the problem went away. Now we have a new problem of lwip:
https://github.com/espruino/Espruino/blob/master/README_Building.md#for-esp8266
-
-
-
I guess you use the WEBIDE and upload your code, so the time between writeTo and readFrom is different.
To make it equivalent put your code in a function and use setTimeout() to call it.
eg:
I2C1.setup({ sda: D4, SCL: D5 }); function i2c_do(i2c,addr, w,r){ i2c.writeTo(addr, w); i2c.readFrom(addr,r); } setTimeout(function(){i2c_do(I2C1,0x11,0,2);},1000);
-
ups - ok - adding that missing #define and C back to D
Now it compiles without errors
attached the version including your changes and printf()
Frida - Thanks for sharing your work !
-
-
using printf - remove \ infront of #define - line was not displayed correct without
// insert after last [#include](https://forum.espruino.com/search/?q=%23include) extern int os_printf_plus(const char *format, ...) __attribute__((format(printf, 1, 2))); \#define printf os_printf_plus ....... error: i2c_master_stop(); //jsError("> I2C streching too long\n"); printf("> I2C streching too long\n"); return -1; }
compile output:
targets/esp8266/i2c_master.c: In function 'i2c_master_readByte': targets/esp8266/i2c_master.c:330:9: error: implicit declaration of function 'i2c_master_getDD' [-Werror=implicit-function-declaration] while ( i2c_master_getDD()==0 && count--) { // PB 36000/1000*4=144 ^ targets/esp8266/i2c_master.c: At top level:
-
-
please try
#include "jsutils.h"
./src/jsutils.h
void jsError(const char *fmt, ...);NO - lots of compile errors ......
-
There are some implementation for clock stretching, eg: core_esp8266_si2c.c
and Frida posted, that she has implemented clock stretching http://forum.espruino.com/comments/12973407/
-
@Frida - wow, can you please share the clock stretching code ?
-
@Wilberforce added board and pins - thanks for that hint
-
Monochrome 128x32 I2C OLED graphic display, adafruit PRODUCT ID: 931
o comes with integrated 4.7k pull-ups
o module SSD1306
o ESP8266-12E&F
o D4 - SDA and D5 - SCL
works without problems
-
-
@tve - thanks
....- does not support clock stretching (a method by which slaves can slow down the master)
....
will check this with a logic analyzer
- does not support clock stretching (a method by which slaves can slow down the master)
-
-
Tried i2cdetect code with a OLED attached at address 0x3c and limit scan to 0x30-0x3f
Get fussy read results for adr <> 0x3c and lots of
ERROR: No ACK
o no error for 0x3c - read value 65
o no catch was triggered>echo(0); 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: 10: 20: ERROR: No ACK 30:136 ERROR: No ACK 31:168 ERROR: No ACK 32:248 ERROR: No ACK 33:24 ERROR: No ACK 34:184 ERROR: No ACK 35:56 ERROR: No ACK 36:72 ERROR: No ACK 37:56 ERROR: No ACK 38:248 ERROR: No ACK 39:72 ERROR: No ACK 3a:40 ERROR: No ACK 3b:200 3c:65 ERROR: No ACK 3d:88 ERROR: No ACK 3e:136 ERROR: No ACK 3f:24 30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40: 50: 60: 70: =undefined
-
-
@Ollie This is no official release - just a travis build with the latest commit - so you are on you own !
espruino_esp8266_user1.bin 29-Apr-2016 10:17 450K
and this is it :
____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v85 Copyright 2016 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate Flash map 4MB:512/512, manuf 0xe0 chip 0x4016 >process.memory(); ={ "free": 1678, "usage": 22, "total": 1700, "history": 0 } >require("ESP8266").getState() ={ "sdkVersion": "1.5.0", "cpuFrequency": 160, "freeHeap": 10160, "maxCon": 10, "flashMap": "4MB:512/512", "flashKB": 4096, "flashChip": "0xe0 0x4016" } >
-
from 1200 to 1400 jsvars on the ESP8266
some ESPs at my side are running with 1v85.MaBe_master_db6edcd ( latest pull )
with 1700 vars, 10.000 heap, GRAPHICS and CRYPTO(in plain text unfortunately)
crypto is now included
but it won't survive a reboot.
use Wifi.save()
a bug in the code or the hardware misbehaving ....
Will run some test on 1v85 to clarify that AP is working as needed.
@ceremcem try to type
reset()
even without prompt or erase flash and flash again