-
A story on Hackaday with regard to flashing Arduino on watches: https://hackaday.com/2019/08/23/ota-flash-tool-makes-fitness-tracker-hacking-more-accessible/
-
-
Oh, @Gordon do you happen to know which capacitor I should look at?
-
Baudrate is set to 115200. I always do a power cycle after flashing, so that should qualify as a reset, correct?
Tonight I will try to power it from an external supply and see if I can connect.
Thank you for the hints @Gordon
-
I am having a similar problem with a NodeMCU. I tried the line in (post 8) that helped the topic starter, but to no avail.
- Flashing seems to go fine (see bottom of this post)
- I can sometimes access the Espruino prompt in Putty (1 out of 3 or 4 tries)
- I never see a prompt in Espruino
When I click the connect button in Espruino and choose the COM port, then I see the following in the IDE:
- an orange box with text "Disconnected"
- a line with some garbage text "0 űÁ"
- a red box with text "Unable to retrieve board information. Connection error?"
- a green box with text "Connected to CO4 (no response from board)"
Here is my line that I use for flashing:
esptool.py.exe --port COM4 --baud 115200 write_flash --flash_size=detect -fm dio 0 .\espruino_1v99_esp8266_4mb_combined_4096.bin
And here are the flash results:
esptool.py v2.5.1 Serial port COM4 Connecting.... Detecting chip type... ESP8266 Chip is ESP8266EX Features: WiFi MAC: 18:fe:34:e1:a4:16 Uploading stub... Running stub... Stub running... Configuring flash size... Auto-detected Flash size: 4MB Flash params set to 0x0240 Compressed 4194304 bytes to 353773... Wrote 4194304 bytes (353773 compressed) at 0x00000000 in 31.7 seconds (effective 1058.0 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin...
I can upload any Arduino sketch that I have to this module (NodeMCU from Amica), and they all work as expected. So, I think the module is fine. I don't have any others to try right now.
Any help is appreciated
- Flashing seems to go fine (see bottom of this post)
-
When I get this error in the IDE, connecting with Putty results in an: Putty Fatal Error: Error reading from serial device.
In the putty dialog I see this:
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:2364
load:0x40078000,len:0
load:0x40078000,len:10880
entry 0x40078c4c -
-
I am not yet sure how long a while is. I connected the ESP32 probably on Thursday and left the IDE open, computer was powered on at all times. When I wanted to connect the IDE to the port yesterday (Tuesday) evening (around 8 pm) I got the messages.
I disconnected and reconnected the device yesterday and was able to connect through the IDE. This morning I found that my computer had rebooted. I tried to connect again from the IDE and saw the same messages. It seems that only a power cycle of the ESP32 allows me to connect successfully.
I will keep an eye on this and report back when I have more information.
Thank you @Wilberforce
-
Something else I notice is that the IDE doesn't find board information if the ESP32 has been connected for a while to my PC through the serial port.
When connecting Espruino to the COM port, I see:
Unable to retrieve board information. Connection error?
Connected to COM7 (no response from board)Below is a log from the console, including the part where I disconnected and reconnected the ESP32 from/to the port:
We have chrome.serial - not using 'serialport' module serial_audio:
Audio Sample rate : 48000 serial_audio: Audio Serial Baud 9600 Bit
time 5 GET chrome.storage.sync =
{"AUTO_SAVE_CODE":true,"BAUD_RATE":"115200","BLOCKLY_EXTENSIONS":"|bluetooth|robot|","BLOCKLY_LANGUAGE":"en","BLOCKLY_TO_JS":false,"BOARD_JSON_URL":"http://www.espruino.com/json","CODE":"/*
Use code below to configure a new device. Steps:\n\n- edit theHostname
below\n- flash code to device (nodemcu, esp8266)\n- type
'startConnect' in console window \n\n*/\nvar
wifi=require(\"Wifi\");\nvar theHostname=\"temp-sensor-server\";
\n\nvar startConnect = function() {\n\tconsole.log('start connect
called');\n\t//
wifi.setHostname(theHostname);\n\twifi.connect(\"Carthago8_nomap\",
{\n\t\tpassword: \"tarigan01\"\n\t}, \n\tfunction()
{\n\n\t\tconsole.log('connected to wifi');\n\n\t\tvar ipInfo =
wifi.getIP();\n\t\tprint(\"Current IP address is: \" +
\n\t\t\tipInfo.ip + ':' +\n\t\t\tipInfo.netmask);\n\n\t\t//
Wifi.stopAP();\n\t\t// wifi.setConfig({ powersave:
\"none\"});\n\t\twifi.save();\n
});\n\n};","COMPILATION":true,"COMPILATION_URL":"https://www.espruino.com/service/compiler","DISABLE_CODE_HINTS":false,"ENABLE_Testing":false,"ENV_ON_CONNECT":true,"FONT_SIZE":12,"MINIFICATION_DeadCode":true,"MINIFICATION_LEVEL":"","MINIFICATION_Literal":true,"MINIFICATION_Mangle":true,"MINIFICATION_Unreachable":true,"MINIFICATION_Unused":true,"MODULE_AS_FUNCTION":false,"MODULE_EXTENSIONS":".min.js|.js","MODULE_MINIFICATION_LEVEL":"ESPRIMA","MODULE_PROXY_ENABLED":false,"MODULE_PROXY_PORT":"","MODULE_PROXY_URL":"","MODULE_URL":"http://www.espruino.com/modules","NPM_MODULES":false,"OFFLINE_DATA":"","OFFLINE_DATA_DOWNLOAD":"","OFFLINE_DATA_UPLOAD":"","OFFLINE_ENABLED":false,"RESET_BEFORE_SEND":true,"SAVE_ON_SEND":0,"SERIAL_AUDIO":"0","SERIAL_TCPIP":"192.168.4.1;192.168.1.83","SERIAL_THROTTLE_SEND":false,"SET_TIME_ON_WRITE":false,"SHOW_CODE_LINK_ICON":false,"SHOW_WEBCAM_ICON":0,"STORE_LINE_NUMBERS":true,"Sound_Error":"","Sound_Info":"","Sound_Success":"","Sound_Warning":"","Speak_Error":false,"Speak_Info":false,"Speak_Success":false,"Speak_Warning":false,"UI_MODE":"Normal","WEBCAM_CONSTRAINTS":0,"WEB_BLUETOOTH":true,"projectEntry":"AD0522314CB4FED925ADFF1139C05435:EspruinoSandbox"}
Initialising SettingsConsole Initialising Utils Initialising Config
Initialising Notifications Initialising Status Initialising App
Initialising File Initialising Code Initialising Serial- Initialising Serial Chrome Serial
- Initialising Serial Chrome Socket
- Initialising Serial Web Audio
- Initialising Serial Web Bluetooth Initialising Terminal Initialising CodeWriter Initialising Modules Initialising Env
Initialising Flasher Initialising EditorBlockly Initialising
EditorJavaScript Initialising Send Initialising MenuPortSelector
Initialising MenuSettings Initialising MenuFlasher Initialising
SettingsAbout Initialising SettingsFlasher Initialising BoardJSON
Initialising VersionChecker Initialising Compiler Initialising
Assembler Initialising GetGitHub Initialising Unicode Initialising
Minify Initialising SaveOnSend Initialising SetTime Initialising
Tutorial Initialising Webcam Initialising FontSize Initialising UiMode
Initialising URLHandler Initialising CodeLink Initialising Project
Initialising Testing Initialising Notification_Sound Initialising Tern
Initialising Debugger Initialising Tour Initialising SettingsProfile
Initialising HelpLinks Initialising Offline Loaded code from storage.
GET chrome.storage.local.OFFLINE_DATA = 0 bytes No navigator.bluetooth - Web Bluetooth not enabled
>>> Connecting... Set Slow Write = true [object Object] Connected [object Object] ERROR: RECEIVE ERROR:
{"connectionId":1,"error":"overrun"} Disconnect callback... WARNING:
[notify_warn] Disconnected
>>> Disconnected Got "\r\n" No Prompt found, got "\n" - issuing Ctrl-C to try and break out Still no prompt - issuing another Ctrl-C WARNING:
No result found for "process.env" - just got "" ERROR: [notify_error]
Unable to retrieve board information. Connection Error? Device found
{"bitrate":115200,"bufferSize":4096,"connectionId":1,"ctsFlowControl":false,"dataBits":"eight","name":"","parityBit":"no","paused":false,"persistent":false,"receiveTimeout":0,"sendTimeout":0,"stopBits":"one"}
[success] Connected to COM7 (No response from board)
>>> Connected to COM7 (No response from board)
>>> Connecting... Set Slow Write = true [object Object] Connected [object Object] Got "" No Prompt found, got undefined - issuing Ctrl-C
to try and break out Splitting for Ctrl-C, delay 250 Still no prompt -
issuing another Ctrl-C Splitting for Ctrl-C, delay 250
>>> Sending...
---> "\u0010print(\"<\",\"<<\",JSON.stringify(process.env),\">>\",\">\")\n"
>>> Sent Got "\u001b[?7l\r\n ____ _ \r\n| |_ ___ ___ _ ||___ ___ \r\n| |_ -| . | _| | | | | . |\r\n||_| || |_|||_||\r\n || espruino.com\r\n 2v00 (c) 2018 G.Williams\r\n\r\nEspruino is Open Source. Our work is
supported\r\nonly by sales of official boards and
donations:\r\nhttp://espruino.com/Donate\r\n\r\nWARNING:
setsockopt(SO_REUSPORT) failed\r\n\r\n>< <<
{\"VERSION\":\"2v00\",\"GIT_COMMIT\":\"ff35517\",\"BOARD\":\"ESP32\",\"FLASH\":0,\"RAM\":524288,\"SERIAL\":\"240ac404-37a8\",\"CONSOLE\":\"Serial1\",\"MODULES\":\"Flash,Storage,heatshrink,fs,net,dgram,tls,http,NetworkJS,Wifi,TelnetServer,crypto,neopixel\",\"EXPTR\":1073483756}
>> >\r\n>" [notify_info] Found ESP32, 2v00 Loading http://www.espruino.com/json/ESP32.json Board JSON loaded Set Slow
Write = true FIRMWARE: Current 2v00, Available 2v00 Device found
{"bitrate":115200,"bufferSize":4096,"connectionId":2,"ctsFlowControl":false,"dataBits":"eight","name":"","parityBit":"no","paused":false,"persistent":false,"receiveTimeout":0,"sendTimeout":0,"stopBits":"one"}
[success] Connected to COM7
>>> Connected to COM7
- Initialising Serial Chrome Serial
-
Okay, I understand. Thank you @opichals
-
-
I just found the latest version of Espruino (herehttps://www.espruino.com/binaries/espruino_2v00_esp32/) and flashed it to a ESP32 DoIt NodeMCU.
When I connect the IDE I see a warning: setsockopt(SO_REUSPORT) failed. Is that expected?
I try to connect it to my router and see that the following is not working:
- setHostname
- setConfig
For both functions I see a "Uncaught error: function not found!" Is it correct that these are not yet supported? If so, is there any documentation on what is supported or not. I searched, but couldn't find it. Both functions don't seem to work on the previous version too!
Thank you!
Edit: found this page that says that setHostname is not supported yet.
- setHostname
-
Thank you @Gordon!
Hmmm, maybe this way is over my head then...
I have an Espruino, so I might try to go that way first but the idea was to build this into an iTead S20 smartswitch so I think that the other options (555 timer or an array with 40khz pulses) would better suit me.
Any pointers on how to generate such an array or do you have a link to the page where you found the above image @Gordon?
Much appreciated!
-
Thank you for your suggestions @MaBe and @Wilberforce.
First I tried to fix the pulse times from the receiver to 1 decimal, but that didn't work.
Next I wanted went the Pronto-way. I found codes for my TV, but run into a problem with the Pronto module:
>var p=require("pronto") WARNING: Module "pronto" not found =undefined >
I found the pronto module on the Espruino site and took the function to decode the hex-string and used it to send to to my TV with digitalPulse... To no avail.
Has anyone ever got this to work with a NodeMCU?
-
I have a TSOP31236 connected to a NodeMCU:
- Ground to NodeMCU Gnd pin
- VCC to NodeMCU 3.3V pin
- Data to NodeMCU D1 pin
I am using the following code to record IR codes from the remote from my TV:
// https://www.espruino.com/Pico+Infrared pinMode(NodeMCU.D1,"input_pullup"); // Keep somewhere to put the signal times var times = []; // now watch the input setWatch(function(e) { // work out how long the pulse was, in milliseconds var pulseLen = 1000 * (e.time - e.lastTime); // then save it, if it was less than 1 second if (pulseLen < 1000) times.push(pulseLen); else times = []; }, NodeMCU.D1, {repeat:true});
I press the Standbye-key on the remote and when I type console.log(times) I see the contents of the times-array:
[ 2.69600000001, 0.853, 0.48300000003, 0.84700000002, 0.47899999992, 0.40800000010, 0.47899999992, 0.40800000010, 1.36699999995, 1.29399999991, 0.48100000003, 0.406, 0.48100000003, 0.406, 0.48200000003, 0.405, 0.48199999991, 0.40500000011, 0.48300000003, 0.40499999988, 0.48200000003, 0.40499999988, 0.48300000003, 0.40400000011, 0.48299999991, 0.40400000011, 0.48299999991, 0.404, 0.48399999991, 0.404, 0.48300000003, 0.40400000011, 0.92199999983, 0.41000000010, 0.48800000001, 0.84199999992, 0.48400000002, 0.404, 0.48400000002, 83.35299999998, 2.703, 0.84700000002, 0.51, 0.82, 0.48499999991, 0.402, 0.48599999990, 0.40100000012, 1.37300000005, 1.28699999993, 0.48799999990, 0.4, 0.48800000001, 0.39900000001, 0.48800000001, 0.39899999990, 0.47800000004, 0.40900000010, 0.48899999990, 0.39900000001, 0.48800000001, 0.39900000001, 0.48900000001, 0.39799999990, 0.47900000004, 0.40800000010, 0.47899999992, 0.408, 0.48, 0.408, 0.47900000004, 0.40799999987, 0.92900000004, 0.403, 0.48400000002, 0.84700000002, 0.47900000004, 0.40699999988, 0.48 ]
So, the receiving part seems to work.
Now from this page I found that you can send the times-array to an IR transmitter led. I have connected an IR led to pin NodeMCU.D2 and NodeMCU ground and use the following command to submit the times-array to my TV:
pinMode(NodeMCU.D2, "output") digitalPulse(LED1,1,times);
Nothing seems to happen, at least the TV doesn't switch off or on. When I exchange the IR led with a normal led I see that there are pulses sent out. Any idea what could be wrong or does anyone have working code with Espruino on an ESP8266?
- Ground to NodeMCU Gnd pin
-
-
-
-
Are you 100% sure that your connection details (see your 1st code share in your first post) are correct? I understand that what you posted here is mocked up, but check in your actual code.
I would suggest to try this code (a bit simpler than yours):
var wifi = require("Wifi"); wifi.connect("ssid", {password:"password"}, function(){ console.log("connected"); });
Then wait for "connected" message.
Also, make sure you do a wifi.save() to make sure that wifi settings are saved for after a power cycle.
-
@Wilberforce, he said he could connect with esp-open-rtos, so it would be weird if he would need an antenna now.
@citizen12123 How are you powering the board? Maybe your power source isn't able to supply enough current?
-
Thank you @allObjects. I understand that I have no option to modify code for the Wifi to make the hidden SSID a possibility? One of the firmware maintainers has to do this?
-
Finally found some time to pick this up again. Sending the sample in http://www.espruino.com/modules/ESP8266WiFi_0v25.js doesn't work. I understand that this was created for the Espruino on ESP8266. Correct?
I am using a NodeMCU and it breaks on A2 and A3 (not defined). I converted the original line from the example to:
Serial2.setup(115200, { rx: NodeMCU.D9, tx : NodeMCU.D10 });
where it was:
Serial2.setup(115200, { rx: A3, tx : A2 });
The sample stops at
Connecting to ESP8266 =undefined Connecting to WiFi Connected >Uncaught Error: CIPSTART failed (Timeout) at line 1 col 72 ...'CIPSTART failed (Timeout)'); ^ in function called from system
The sample code I used is:
Serial2.setup(115200, { rx: NodeMCU.D9, tx : NodeMCU.D10 }); console.log("Connecting to ESP8266"); var wifi = require("mywifi").connect(Serial2, function() { wifi.reset(function() { console.log("Connecting to WiFi"); wifi.connect("my own ssid","password", function() { console.log("Connected"); require("http").get("http://www.espruino.com", function(res) { console.log("Response: ",res); res.on('data', function(d) { console.log("--->"+d); }); }); }); }); });
It seems to break on the get() of http://www.espruino.com. Any ideas?
Edit: I created an Espruino IDE project for this in a folder on a local drive.
-
@Gordon I was going to do the change for ESP8266+Espruino, so I guess I need to be at ESP8266WiFi_0v25 module. Can you explain why I don't see that the require("Wifi") doesn't seem to generate any traffic to the modules folder on http://www.espruino.com?
-
@ClearMemory041063 I tried to use espruino.com/modules/EspruinoWiFi.js as source in a project in the Espruino WebIDE but I never got it to work. It seems that it is using pins A13 and A14 which are not supported on an ESP8266.
When I used Fiddler to see where exactly a module is being loaded when I do a require("Wifi") I saw nothing being loaded from Internet. When you load another module, for example through a require("DS18B20), there is network traffic to http://www.espruino.com/modules//DS18B20.min.js
So, I am not sure how to do this.
If anyone can help me getting started, I would appreciate it very much!
Did you ever get around this?
I am looking at the PineTime that is also equiped with a nRF52832