These are chat archives for esp8266/Arduino

10th
Dec 2015
Tony
@toxuin
Dec 10 2015 05:47
@Links2004 didn’t have a chance to test SPIFFS update over http yet. Final exam tomorrow… ^_^
Markus
@Links2004
Dec 10 2015 09:04
@igrr what do Error: Invalid X509 ASN.1 file (X509 not ok) mean for WiFiClientSecure?
my chrome is connecting (its a self signed certificate)
Ivan Grokhotkov
@igrr
Dec 10 2015 09:05
did you convert PEM format to DER?
WiFIClientSecure can only load DER at the moment
Markus
@Links2004
Dec 10 2015 09:07
i not load anything, i try to connect to a https / wss server (nodejs)
Ivan Grokhotkov
@igrr
Dec 10 2015 09:07
oh
so the server is sending a certificate, and on the ESP side it can not be read for some reason...
Markus
@Links2004
Dec 10 2015 09:07
I run openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 99999 -nodes for the cert on the server.
the server code:
#!/usr/bin/env node
var WebSocketServer = require('websocket').server;
//var http = require('http');
var http = require('https');
var fs = require('fs');

var options = {
  key: fs.readFileSync('key.pem'),
  cert: fs.readFileSync('cert.pem')
};

var server = http.createServer(options, function(request, response) {
    console.log((new Date()) + ' Received request for ' + request.url);
    response.writeHead(404);
    response.end();
});
server.listen(8011, function() {
    console.log((new Date()) + ' Server is listening on port 8011');
});

wsServer = new WebSocketServer({
    httpServer: server,
    // You should not use autoAcceptConnections for production 
    // applications, as it defeats all standard cross-origin protection 
    // facilities built into the protocol and the browser.  You should 
    // *always* verify the connection's origin and decide whether or not 
    // to accept it. 
    autoAcceptConnections: false
});

function originIsAllowed(origin) {
  // put logic here to detect whether the specified origin is allowed. 
  return true;
}

wsServer.on('request', function(request) {

    if (!originIsAllowed(request.origin)) {
      // Make sure we only accept requests from an allowed origin 
      request.reject();
      console.log((new Date()) + ' Connection from origin ' + request.origin + ' rejected.');
      return;
    }

    var connection = request.accept('arduino', request.origin);
    console.log((new Date()) + ' Connection accepted.');
    connection.sendUTF("Connection accepted.");

    connection.on('message', function(message) {
        if (message.type === 'utf8') {
            console.log('Received Message: ' + message.utf8Data);
            connection.sendUTF(message.utf8Data);
        }
        else if (message.type === 'binary') {
            console.log('Received Binary Message of ' + message.binaryData.length + ' bytes');
            connection.sendBytes(message.binaryData);
        }
    });

    connection.on('close', function(reasonCode, description) {
        console.log((new Date()) + ' Peer ' + connection.remoteAddress + ' disconnected.');
    });

    //connection.sendUTF("Hallo Client!");
});
Markus
@Links2004
Dec 10 2015 09:22
@igrr found a work around, if i create a cert with "10000" days life time it is working.
Ivan Grokhotkov
@igrr
Dec 10 2015 09:34
:) i guess it must be using uint16_t somewhere.
10000 days should be enough i think.
Endre Karlson
@ekarlso
Dec 10 2015 10:01
@igrr lol, ware you saying you potentially found the issue for the TLS stuff somewhere ?
Hassanbenlebsir
@Hassanbenlebsir
Dec 10 2015 10:12
what temperatures can the esp handle
Markus
@Links2004
Dec 10 2015 10:14
@igrr if I try to connect with WiFiClientSecure to an non SSL server I get a Soft WDT reset
Endre Karlson
@ekarlso
Dec 10 2015 10:14
@igrr isn't that the correct behaviour then ? :o:
siedi
@siedi
Dec 10 2015 12:13
Q: I'm using the IRremoteESP8266 lib to receive IR signals (which itself uses interrupts to receive the signals on a pin), my loop does some other action (triggering leds and stuff) without any call to delay (just one yield). Seems like the ESP has troubles retrieving the right signals from the IR PIN then, most often they are wrong. When I add a delay > 100 in the loop it becomes more reliable. Any explanation for that? Instead of the delay (which I want to prevent otherwise my led animation lags ) is there a better call (tried yield & stuff).
siedi
@siedi
Dec 10 2015 12:19
A: it is related to the neopixelbus, which of course stops the interrupts for a moment
have to reduce the refresh rate
Helio Machado
@crushedice2000
Dec 10 2015 13:29
How can I put my ESP8266 in hidden AP mode?
Helio Machado
@crushedice2000
Dec 10 2015 14:33
@Links2004: What about skipping channel parameter? Im n00b to C/++
Would I use softAP("a", "12345678",,1)?
Markus
@Links2004
Dec 10 2015 14:35
softAP("a", "12345678",0 ,1)
but better set a channel
Helio Machado
@crushedice2000
Dec 10 2015 14:38
@Links2004: What means 0? Auto channel?
Markus
@Links2004
Dec 10 2015 14:39
default channel what shut be 1.
but 1 is overloaded the most time, since for the most WiFi devices this is default ;)
Steve Nelson
@zenmanenergy
Dec 10 2015 14:49
@Links2004 I just tried your updater.cpp changes, it’s no longer timing out, but it doesn’t seem to write the binary to flash. At least it doesn’t brick the device the way it was for me yesterday.
Markus
@Links2004
Dec 10 2015 14:51
so it report update ok but no update is there?
Steve Nelson
@zenmanenergy
Dec 10 2015 14:51
here’s the output when it crashes: http://pastebin.com/NiRhXQwS
no. it doesn’t report ok.
i’m going to try and trace down where it’s failing.
Did you only modify Updater.cpp? or were there other files that I missed? That was the only one I saw in the post.
Markus
@Links2004
Dec 10 2015 14:53
all changes are in this commit:
Links2004/Arduino@0389657
and yes only Updater.cpp
Steve Nelson
@zenmanenergy
Dec 10 2015 14:54
ok cool. i’ll see if I can pinpoint where mine is crashing.
Markus
@Links2004
Dec 10 2015 14:56
the ptr is in the "hard coded" part of the ESP
its the range of the str functions
https://github.com/esp8266/Arduino/blob/master/tools/sdk/ld/eagle.rom.addr.v6.ld#L316-L317
Helio Machado
@crushedice2000
Dec 10 2015 15:07
@Links2004: I'm not a wifi expert, what would be a good channel? 7?
Markus
@Links2004
Dec 10 2015 15:08
you can select any between 1 and 13, 1 ist the most used one,
7 is ok.
Steve Nelson
@zenmanenergy
Dec 10 2015 15:32
@Links2004 in general I don’t know what the F I’m talking about, so this may be a stupid thought, but my gut is telling me that something is funny about the _startAddress on line 97. What seems wrong to me is that the start address is the same value as ESP.getFreeSketchSpace()
Markus
@Links2004
Dec 10 2015 15:33
line 97: _startAddress = updateStartAddress;
Steve Nelson
@zenmanenergy
Dec 10 2015 15:33
yeah. that one
when I output that value it’s the same as ESP.getfreeSketchSpace() then _currentAddress is incremented upwards
Steve Nelson
@zenmanenergy
Dec 10 2015 15:34
it seems to me it should be something like _startAddress = totalSpaceAvailable-ESP.getfreeSketchspache()
or something
Markus
@Links2004
Dec 10 2015 15:34
there is no getfreeSketchSpace?
Steve Nelson
@zenmanenergy
Dec 10 2015 15:36
139 in esp8266httpupdate.cpp DEBUG_HTTP_UPDATE("[httpUpdate] - free Space: %d\n", ESP.getFreeSketchSpace());
that value
Markus
@Links2004
Dec 10 2015 15:36
This message was deleted
that return you the space between the end of the old (current running) sketch and the begin of the SPIFFS
I see not whats wrong there.
the new sketch will be loaded in this free space between old sketch and spiffs.
on the next reboot it will be copied by "eboot" over the old sketch.
Steve Nelson
@zenmanenergy
Dec 10 2015 15:39
something feels funny, one sec, i’m trying to compose a thought in my head.
Markus
@Links2004
Dec 10 2015 15:41
oO i want to edit it...
Steve Nelson
@zenmanenergy
Dec 10 2015 15:43
for simple math… let’s say the total available size is 3,000,000 and the available space is 2,600,000 and the new sketch is 500,000 if we start at 2,600,000 it will end at 3,100,000 which is above our available 3,000,000… I would expect it to start at (3,000,000 - 2,600,000) = 400,000 so it would end at 400,000+500,000 = 900,000 which is below our available 3,000,000
this stuff is VERY new to me. so forgive me if my thought is stupid! I’m used to simpler programming with databases. :-)
Markus
@Links2004
Dec 10 2015 15:44
that is exactly what the code is doing?
Steve Nelson
@zenmanenergy
Dec 10 2015 15:44
when I output _currentAddress it’s starting at 2,600,000 not 400,000
Markus
@Links2004
Dec 10 2015 15:44
 //size of current sketch rounded to a sector
    uint32_t currentSketchSize = (ESP.getSketchSize() + FLASH_SECTOR_SIZE - 1) & (~(FLASH_SECTOR_SIZE - 1)); 
    //address of the end of the space available for sketch and update
    uint32_t updateEndAddress = (uint32_t)&_SPIFFS_start - 0x40200000;
    //size of the update rounded to a sector
    uint32_t roundedSize = (size + FLASH_SECTOR_SIZE - 1) & (~(FLASH_SECTOR_SIZE - 1));
    //address where we will start writing the update
    updateStartAddress = updateEndAddress - roundedSize;
Helio Machado
@crushedice2000
Dec 10 2015 15:44
Also, another question: How can I parse a multiline JSON file?
Steve Nelson
@zenmanenergy
Dec 10 2015 15:45
when I do this
bool UpdaterClass::_writeBuffer(){
  yield();
  DEBUG_UPDATER.print("_currentAddress:");
      DEBUG_UPDATER.println(_currentAddress);
Markus
@Links2004
Dec 10 2015 15:45
Steve Nelson
@zenmanenergy
Dec 10 2015 15:45
it starts at 2,600,000
here’s some output:
[httpUpdate] Header read fin.
[httpUpdate] Server header:
[httpUpdate] - code: 200
[httpUpdate] - len: 270640
[httpUpdate] ESP8266 info:
[httpUpdate] - free Space: 2871296
[httpUpdate] - current Sketch Size: 270664
[httpUpdate] runUpdate flash...
_startAddress:2871296
[httpUpdate] md5.c_str() ()
remaining()270640
_currentAddress:2871296
remaining()266544
_currentAddress:2875392
remaining()262448
_currentAddress:2879488
remaining()258352
look at that first _currentAddress value
Markus
@Links2004
Dec 10 2015 15:48
the code work like this:
blob
hope this make it a little bit more clear
blob
Steve Nelson
@zenmanenergy
Dec 10 2015 15:51
yes it does make perfect. although my gut is telling me that what’s actually happening is the yellow bar is starting farther over to the right and is overlapping into the blue.
how did you make that chart so quick?
Markus
@Links2004
Dec 10 2015 15:51
excel ;)
Steve Nelson
@zenmanenergy
Dec 10 2015 15:52
ha. you must excel at excel
Ivan Grokhotkov
@igrr
Dec 10 2015 15:54
Oh wow these pictures must go into the docs
Steve Nelson
@zenmanenergy
Dec 10 2015 15:55
i know how to test my theory...
Markus
@Links2004
Dec 10 2015 15:55

this line here:
shut prevent the overlapping:
https://github.com/Links2004/Arduino/blob/0389657614e954ef19ab585cd198c0e59a107dfc/cores/esp8266/Updater.cpp#L77

In the raw case it woth overlap the OTA will still work but every OTA run will destroy the SPIFFS,
but If is understand the code right its not possible.

@igrr will upload it
Steve Nelson
@zenmanenergy
Dec 10 2015 15:55
_currentAddress = _currentAddress -100000;
size_t UpdaterClass::writeStream(Stream &data) {
//data.setTimeout(30000);
size_t written = 0;
size_t toRead = 0;
if(hasError() || !isRunning())
return 0;
_currentAddress = _currentAddress -100000;
by subjecting a little from currentAddress it should demonstrate that it’s overlapping.
by subtracting not subjecting
Markus
@Links2004
Dec 10 2015 15:58
with this change you will may override the current sketch during runtime that will sure crash your ESP.
Helio Machado
@crushedice2000
Dec 10 2015 15:59
@Links2004: Yes, I'm using it already, but I don't know how to pass a SPIFFS (multiline) file to it for parse.
Steve Nelson
@zenmanenergy
Dec 10 2015 15:59
actually it’s getting past the error before, now i’m getting the timeout again on the very last write.
Steve Nelson
@zenmanenergy
Dec 10 2015 16:06
@Links2004 I think there is something here… if I subtract 1,000,000 it gets through the while(remaining()) loop. I figured if i subtracted too much it would start overwriting the current sketch, so I subtracted 3,000,000 and as expected it didn’t get through the first iteration of the loop when it crashed. i think there is a math error somewhere.
Markus
@Links2004
Dec 10 2015 16:10
as fare I can see its all uint32_t, will do some debugs on my side, but the problem is the update is working for me....
Steve Nelson
@zenmanenergy
Dec 10 2015 16:12
well, that is troubling that it is working for you! i’ve tried it on two devices.
Markus
@Links2004
Dec 10 2015 16:13
i update all my devices like that and it works. they have 4MB chips, what size have yours?
Steve Nelson
@zenmanenergy
Dec 10 2015 16:14
i have one with a 4mb chip (nodemcu 1.0) and a 1mb chip (cloud-ai)
Helio Machado
@crushedice2000
Dec 10 2015 16:21
@Links2004: Never thought to open the Examples menu... Thanks!
Markus
@Links2004
Dec 10 2015 16:24
@zenmanenergy
my addresses
[begin] roundedSize:       0x00042000 (270336)
[begin] updateEndAddress:  0x00100000 (1048576)
[begin] currentSketchSize: 0x00042000 (270336)
[begin] _startAddress:     0x000BE000 (778240)
[begin] _currentAddress:   0x000BE000 (778240)
[begin] _size:             0x00041CD0 (269520)
Steve Nelson
@zenmanenergy
Dec 10 2015 16:24
yeah, that looks correct.
the updateEnd is the beginning of SPIFFS right?
Markus
@Links2004
Dec 10 2015 16:25
yes
Steve Nelson
@zenmanenergy
Dec 10 2015 16:25
ok
Markus
@Links2004
Dec 10 2015 16:25
Links2004/Arduino@49536c7
can you do the same?
Steve Nelson
@zenmanenergy
Dec 10 2015 16:27

connected
[httpUpdate] Header read fin.
[httpUpdate] Server header:
[httpUpdate] - code: 200
[httpUpdate] - len: 208208
[httpUpdate] ESP8266 info:
[httpUpdate] - free Space: 2875392
[httpUpdate] - current Sketch Size: 270108
[httpUpdate] runUpdate flash...
[httpUpdate] md5.c_str() ()

Exception (28):
epc1=0x4000bf80 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00032d50 depc=0x00000000

ctx: cont
sp: 3fff1280 end: 3fff1bb0 offset: 01a0

stack>>>
3fff1420: 3fff1c04 0000001b 3fff148b 402064dc
3fff1430: 4020fca6 00000000 00000000 3fff3538

try to change it to:
if(md5.length() && (md5.c_str() != NULL)) {
Steve Nelson
@zenmanenergy
Dec 10 2015 16:31
oooh that got further!
Markus
@Links2004
Dec 10 2015 16:31
ok then the string class has a bad problem need to check that.....
Steve Nelson
@zenmanenergy
Dec 10 2015 16:32
holy crap. i think that worked!
i think I may have messed something up with that file yesterday.
Steve Nelson
@zenmanenergy
Dec 10 2015 16:40
It worked with one of my binaries, but not others
no wait, i take that back. it worked with this second one now.
i had to reboot it manually
any idea why it would boot twice like this:

[httpUpdate] Header read fin.
[httpUpdate] Server header:
[httpUpdate] - code: 200
[httpUpdate] - len: 215456
[httpUpdate] ESP8266 info:
[httpUpdate] - free Space: 2875392
[httpUpdate] - current Sketch Size: 270044
[httpUpdate] runUpdate flash...
[httpUpdate] Update ok

ets Jan 8 2013,rst cause:2, boot mode:(1,7)

ets Jan 8 2013,rst cause:4, boot mode:(1,7)

Steve Nelson
@zenmanenergy
Dec 10 2015 16:47
the md5.length() is null
[httpUpdate] md5.length() (<null>)
[httpUpdate] md5.c_str() ()
Markus
@Links2004
Dec 10 2015 16:56
@zenmanenergy the reboot problem is known (#1017)
Steve Nelson
@zenmanenergy
Dec 10 2015 16:56
ok.
Markus
@Links2004
Dec 10 2015 16:56
null means NULL ptr?
or 0
Steve Nelson
@zenmanenergy
Dec 10 2015 16:56
DEBUG_HTTP_UPDATE("[httpUpdate] md5.length() (%s)\n", md5.length());
DEBUG_HTTP_UPDATE("[httpUpdate] md5.c_str() (%s)\n", md5.c_str());
Markus
@Links2004
Dec 10 2015 16:58
DEBUG_HTTP_UPDATE("[httpUpdate] md5.length() (%s)\n", md5.length());
need to be
DEBUG_HTTP_UPDATE("[httpUpdate] md5.length() (%d)\n", md5.length());
length is a int not a char *
Steve Nelson
@zenmanenergy
Dec 10 2015 16:58
oh
when i changed it to a %d it’s now displaying a length of 0. I guess either apache is not sending an md5 or maybe something’s funny in the http client?
but!!!
this is SUPER great. because it IS working!
Markus
@Links2004
Dec 10 2015 17:01
apache itself does not send a MD5, you need a script (PHP for example) to do this.
Steve Nelson
@zenmanenergy
Dec 10 2015 17:01
it just requires a manual reboot. but i can live with that.
Markus
@Links2004
Dec 10 2015 17:01
the manual reboot is only once after this it shut work.
Steve Nelson
@zenmanenergy
Dec 10 2015 17:01
oh. well that answers that. this test I was pointing directly to the .bin file. i’ll switch a php script and test it
is it possibly still in boot loader mode? could we manually change gpio0?
Markus
@Links2004
Dec 10 2015 17:02
can you retest with the latest git without any modifications?
Steve Nelson
@zenmanenergy
Dec 10 2015 17:02
yes.
wait, which ones, your latest branch? can you send me a link?
Markus
@Links2004
Dec 10 2015 17:03
yes its reset to boot loader mode, the pins are ignored for some reason.
Steve Nelson
@zenmanenergy
Dec 10 2015 17:04
I was testing with the stable master when it crashed. your updates fixed it. you want me to roll back to the non-working version?
oh. is your update already pushed?
Markus
@Links2004
Dec 10 2015 17:05
yes i have pushed it ;)
Steve Nelson
@zenmanenergy
Dec 10 2015 17:06
oh gotcha. sorry, git still baffles the living hell out of me. it’s like freakin’ magic.
Steve Nelson
@zenmanenergy
Dec 10 2015 17:40
@Links2004 I just pulled the latest code. It’s working! You. are. a. GOD!
There is a boolean flag in the handleUpdate method for rebooting, but it appears to always be true.
Markus
@Links2004
Dec 10 2015 17:42
not for the updateSpiffs
Steve Nelson
@zenmanenergy
Dec 10 2015 17:43
It may be more beneficial to allow the parent script to do the reboot. That way if the calling script needs to finish something up, like: webServer.send(200, "text/html", "success”); before the reboot, it can do that.
Markus
@Links2004
Dec 10 2015 17:44
possible, will be the 7th parameter for update ;)
Steve Nelson
@zenmanenergy
Dec 10 2015 17:44
haha
in the updateSpiff() method it has the reboot set to false
Steve Nelson
@zenmanenergy
Dec 10 2015 18:02
what causes the watch dog timer to force a reboot? Is something taking too long?
Markus
@Links2004
Dec 10 2015 18:03
yup, that the normal reason for a WDT to fire.
Steve Nelson
@zenmanenergy
Dec 10 2015 18:04
where is the wdt code? i see a couple methods in esp.cpp?
and in user_interface.h although I don’t see a cpp for that one.
Markus
@Links2004
Dec 10 2015 18:05
there a two WDT, one is hw (has no code), one is sw (inside the SDK but closed src)
so we have no code.
Steve Nelson
@zenmanenergy
Dec 10 2015 18:05
ok.
Markus
@Links2004
Dec 10 2015 18:05
we only have a API for the sw one. inside the h.
Steve Nelson
@zenmanenergy
Dec 10 2015 18:16
when does the updater move the sketch over the old one? is that after the reboot?
is it possible that process is what is causing the wdt?
Markus
@Links2004
Dec 10 2015 18:17
the first code that run is "eboot" a "bootloader" that @igrr has written, it copy the code and start it.
I never have seen a WDT in this code.
Steve Nelson
@zenmanenergy
Dec 10 2015 18:18
it’s occuring for me after the esp. restart() call. it does a restart, then pauses a moment, then does a second wdt restart
Markus
@Links2004
Dec 10 2015 18:18
try to print something in the first lines in the setup.
 Serial.begin(115200);
Serial.println("boot");
Serial.flush();
Steve Nelson
@zenmanenergy
Dec 10 2015 18:18
ok.
i just wrote a little script that prints a line in setup then reboots. that seems to work fine. so esp.restart() clearly is working for me. just not after I do the sketch update.
Steve Nelson
@zenmanenergy
Dec 10 2015 18:28
oh, i see the eboot section, it’s called in the Update.end() method.
so that is happening before the restart. so that wouldn’t cause a WDT issue
Markus
@Links2004
Dec 10 2015 18:38
this section writes the commands in rtc eeprom.
after reboot eboot will execute them.
eboot is the first code that is running after reboot / boot.
https://github.com/esp8266/Arduino/blob/master/bootloaders/eboot/eboot.c#L113
Steve Nelson
@zenmanenergy
Dec 10 2015 18:43
Is there some way to get the serial monitor to work in that code? when I call Serial.println(“test”); it doesn’t work. is that executed before the arduino setup() function?
Markus
@Links2004
Dec 10 2015 18:45
this code has no arduino like API its bare registers and hard coded functions.
try to open the serial terminal at start with 74480 you shut see the messages of the bootloader and after this from eboot.
Steve Nelson
@zenmanenergy
Dec 10 2015 18:46
ok
Steve Nelson
@zenmanenergy
Dec 10 2015 18:51
wait are you saying to use a baud rate of 74480, right? i can’t seem to manually set that in cool term.
Markus
@Links2004
Dec 10 2015 18:52
then us hterm or realterm
Steve Nelson
@zenmanenergy
Dec 10 2015 18:52
ok
Steve Nelson
@zenmanenergy
Dec 10 2015 19:00
i’m now able to see the characters on port 74480, how do i output them in the .c file? do I still use Serial.println() or is a totally different object/method?
Markus
@Links2004
Dec 10 2015 19:01
you can not output at this level from the IDE.
you need to recompile eboot to do so.
output example:
https://github.com/esp8266/Arduino/blob/master/bootloaders/eboot/eboot.c#L128
Steve Nelson
@zenmanenergy
Dec 10 2015 19:02
dang. ok. that is quickly going way over my paygrade!
do I have to seperately compile these .c files before the IDE compiles? or will the IDE compile them?
Markus
@Links2004
Dec 10 2015 19:07
you need to use the makefile, the IDE only us a precompiled bin and never do compile eboot.
what do you get at 74480 baud?
Steve Nelson
@zenmanenergy
Dec 10 2015 19:07
a bunch of garbage
ok, the makefile. i guess i need to go read the manual on that.
éùn mpùnñk ¢@r…ÄP±µ±Kít¥dr×-@éù.©Ñª¡Ko8a êɱT±­±©©ÄPµåµù±…¢ünzAl )ém~±T[ár§(±Õ¢ü/Ñáéùn mpùnñk ¢@r…ÄP±µ±Kít¥dr×-@éù.©Ñª¡Ko8a êɱT±­±©©ÄPµåµù±…¢ünzAl )ém~±T[ár§(±Õ¢ü/Ñáéùn mpùnñk ¢@*r…
I do appreciate that it says “pùnñk” over and over.
it’s calling me names. how rude.
Markus
@Links2004
Dec 10 2015 19:10

normal it look like this:

load 0x4010f000, len 1264, room 16                 
tail 0                                       
chksum 0x42                           
csum 0x42

this shows that the bootloader loads eboot

Steve Nelson
@zenmanenergy
Dec 10 2015 19:11
well if I set it to 115200 it shows that
Markus
@Links2004
Dec 10 2015 19:12
oO normal its at 74480
beikeland
@beikeland
Dec 10 2015 19:13
i think maybe the bootloader runs at 115200 after a softboot, after having been flashed? I'm pretty sure i've seen that output at 115200 as weel
Steve Nelson
@zenmanenergy
Dec 10 2015 19:13
i set Serial.begin(115200) in my setup() are you saying that without that line it defaults to 74480?
Markus
@Links2004
Dec 10 2015 19:14
the bootloader runs before setup, what you do there does not mater to the bootloader.
beikeland
@beikeland
Dec 10 2015 19:15
Are 76000 and 74480 "close enough" or does eboot have another baudrate than the bootloaders that ship with the boards?
Markus
@Links2004
Dec 10 2015 19:16
the eboot us the same as bootloader.
"close enough" is a question to the tolerance of the USB converter, can be different based on the model.
Aditya Tannu
@AdySan
Dec 10 2015 19:17
@zenmanenergy @Links2004 you cna set cutom baund rates in CoolTerm http://forums.the-meiers.org/viewtopic.php?f=4&t=479
beikeland
@beikeland
Dec 10 2015 19:19
RealTerm is my go-to terminal on windows, while we're on the subject. Cool thing is you can create shortcuts with command line parameters for just about anything.
Markus
@Links2004
Dec 10 2015 19:20
yes using realterm to, and you can start it with command line in the mode you need,
is on of my make targets in eclipse ;)
beikeland
@beikeland
Dec 10 2015 19:20
That reminds me, is there a neat way to add commands to the arduino workflow when its uploading? I'd like to issue a command before and after flashing, so i can execute realterm and tell it to disconnect form the serial port, and reconnect automatically after?
Markus
@Links2004
Dec 10 2015 19:22
when you modify the platform.txt yes, have read somthing about pre and post Target commands.
beikeland
@beikeland
Dec 10 2015 19:22
(Saw something about specifying FIRST as a parameter, and it would then send command to an running instance and terminate, havent played with it yet
Steve Nelson
@zenmanenergy
Dec 10 2015 19:22
thanks @AdySan I found that exact page about 5 minutes ago! it worked…. well now i can select the baud rate that is. it’s giving me garbage text at th emoment, but that’s a step in the right direction
beikeland
@beikeland
Dec 10 2015 19:23
if its unclear, then garbage = wrong baud rate
Martin Ayotte
@martinayotte
Dec 10 2015 19:26
Some USB Serial doesn't support 74480
beikeland
@beikeland
Dec 10 2015 19:27
@Links2004 thanks, hooks doesn't cover uploading unfortunately. But it does list the avrdude command path, maybe I can switch it with a batch file and rig something
Steve Nelson
@zenmanenergy
Dec 10 2015 19:27
holy shit. i think i fixed it.
i moved the ets_wdt_disable(); up 1 line in eboot.c and it’s not crashing with the wdt after i update
Markus
@Links2004
Dec 10 2015 19:29
@igrr can you take a look at this eboot wdt porblem?
Steve Nelson
@zenmanenergy
Dec 10 2015 19:30
I was just taking a wild guess since I haven’t been able to output anything. that was on line 127 of eboot.c
Steve Nelson
@zenmanenergy
Dec 10 2015 19:43
nope. it didn’t solve it. i guess that one time was a fluke
Helio Machado
@crushedice2000
Dec 10 2015 21:51

December 10th of 2015 - 22:51 CET

I've fried and fired my NodeMCU :cry:

I can't figure out what happened, really.
I connected my NodeMCU to my iMac (Late 2013) to make some tests.
These tests consist in toggling a pin in the controller of a 220V AC to 78V DC switching power supply.
Helio Machado
@crushedice2000
Dec 10 2015 21:57
I only connected a pin from the switching power supply to the NodeMCU (no ground).
Then I seen a bright spark, some smoke smell... and my iMac reporting a USB over consumption....
Is a miracle, but all the four USB ports of the iMac are working after the accident. :smile:

Moral of the fable:

Helio Machado
@crushedice2000
Dec 10 2015 22:04
You never should mix the mains connection with a micro controller.
Steve Nelson
@zenmanenergy
Dec 10 2015 22:04
oh my.
have you looked into using a solid state relay?
Helio Machado
@crushedice2000
Dec 10 2015 22:05
@zenmanenergy: Yes, I was doing so with a IRF1404.
Steve Nelson
@zenmanenergy
Dec 10 2015 22:05
oh gotcha. yeah that’ll work
Helio Machado
@crushedice2000
Dec 10 2015 22:06
@zenmanenergy: The problem was that IRF1404 working at 78V DC needs more than 3.3V to trigger the gate...
and all the optoisolators I can buy blows at 70V DC
@zenmanenergy: I'm PWMing a LED downlight :-(
those fotek ones work at 3.3.v
Martin Ayotte
@martinayotte
Dec 10 2015 22:22
The IRF1404 is not a SSR, it is a simple MOSFET. SSRs are optically isolated.
d-anders
@d-anders
Dec 10 2015 22:50
the fotek ones work well, but are for ac
Helio Machado
@crushedice2000
Dec 10 2015 23:06
@zenmanenergy: This is for AC. Does it work on DC?
@martinayotte: I know that the MOSFET is not a SSR (I'm silly, but not stupid :smile_cat: ). However, all the optoisolators I can buy locally (4n28) have a maximum rating of 70V and the LED power supply works at 78V. The result is blowing the optoisolator after a few seconds. I finally decided to use the NodeMCU without optoisolator and... :boom:
Michael Graff
@skandragon
Dec 10 2015 23:25
Do you need 70 VDC to trigger the IRF1404?
Martin Ayotte
@martinayotte
Dec 10 2015 23:41
There are some other optocouplers with higher voltage rating, such SFH640 or H11D1 rated to about 300V