These are chat archives for esp8266/Arduino

28th
Dec 2015
Chris Elsworth
@celsworth
Dec 28 2015 00:10
I'm trying to work out why the CS pin from my ENC28J60 (ethernet) module is high :( when I connect it to CS (GPIO15) on my nodemcu the thing doesn't boot, cos GPIO15 has to be low to boot :/
unless I misunderstand what CS is for on this module
Stavros Korokithakis
@skorokithakis
Dec 28 2015 00:12
looks like it's an input
Chris Elsworth
@celsworth
Dec 28 2015 00:22
actually looks like a waste of time, I need a w5100 not an enc28j60 anyway. I have a w5100 shield but thats 5v I think :/
Stavros Korokithakis
@skorokithakis
Dec 28 2015 00:23
oh :/
Chris Elsworth
@celsworth
Dec 28 2015 00:23
hm.. or is it
Stavros Korokithakis
@skorokithakis
Dec 28 2015 00:24
why do you need ethernet?
Chris Elsworth
@celsworth
Dec 28 2015 00:26
wifi doesn't reach into a place I want to put one of these :(
also going to mess with powering it via poe
Stavros Korokithakis
@skorokithakis
Dec 28 2015 00:26
oh, poe is pretty nice
brutzler
@brutzler
Dec 28 2015 00:26
you have a lib for ENC28J60?
Stavros Korokithakis
@skorokithakis
Dec 28 2015 00:26
you don't even have to do actual poe
there's an adapter that you can push arbitrary voltage over
Chris Elsworth
@celsworth
Dec 28 2015 00:27
no @brutzler, just noticed there isn't one
there's W5100 in the core though
brutzler
@brutzler
Dec 28 2015 00:27
thought so, only for W5100
wanted to use this too, but in last instance i installed an additional AP...LOL
Chris Elsworth
@celsworth
Dec 28 2015 00:32
I did think about that ;)
a thread on the esp8266 forum says someone got a w5100 shield working with the 8266, nice.. maybe I'll just try it
maybe it'll work ok with 3.3v :)
guess I can't damage something designed for 5v by trying it with 3.3v right?
brutzler
@brutzler
Dec 28 2015 00:35
Yep
maybe 3,3Vhigh-level is ok for 5V-modul
Stavros Korokithakis
@skorokithakis
Dec 28 2015 00:50
does anybody know of a very simple lowpass filter in the time domain?
Markus
@Links2004
Dec 28 2015 00:54
@celsworth i ported w5100, the src is in the core
Chris Elsworth
@celsworth
Dec 28 2015 00:58
yep, thats what I'm going to use soon :)
msticninja
@msticninja
Dec 28 2015 01:03
Been trying to resolve a compile issue with esp8266/Arduino and the library "Sensirion"(http://playground.arduino.cc/Code/Sensirion#Sensirion). Compile fails with no known conversion in Sensirion.h, line 76. Compiles fine with standard arduino boardtype selected, but not with the Ada Huzzah ESP8266 boardtype. Anybody have any tips?
Markus
@Links2004
Dec 28 2015 01:04
@skorokithakis http://www.schwietering.com/jayduino/filtuino/ digitaler analog software filter
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:04
@Links2004 ooh fantastic, thanks!
Markus
@Links2004
Dec 28 2015 01:08
@msticninja please the full error, i think its the problem is not the .h
msticninja
@msticninja
Dec 28 2015 01:11

codeArduino: 1.6.5 (Windows 8.1), TD: 1.25, Board: "Adafruit HUZZAH ESP8266, 80 MHz, Serial, 115200, 4M (3M SPIFFS)"

In file included from NonBlocking.pde:15:0:
NonBlocking.pde: In function 'void setup()':
C:\Users\eric\Documents\Arduino\libraries\Sensirion/Sensirion.h:32:51: error: no matching function for call to 'Sensirion::meas(const uint8_t&, unsigned int*, const bool&)'

define measTemp(result) meas(TEMP, result, BLOCK)

                                               ^

NonBlocking.pde:64:19: note: in expansion of macro 'measTemp'
C:\Users\eric\Documents\Arduino\libraries\Sensirion/Sensirion.h:32:51: note: candidate is:

define measTemp(result) meas(TEMP, result, BLOCK)

                                               ^

NonBlocking.pde:64:19: note: in expansion of macro 'measTemp'
C:\Users\eric\Documents\Arduino\libraries\Sensirion/Sensirion.h:76:13: note: uint8_t Sensirion::meas(uint8_t, uint16_t, bool)
uint8_t meas(uint8_t cmd, uint16_t
result, bool block);
^
C:\Users\eric\Documents\Arduino\libraries\Sensirion/Sensirion.h:76:13: note: no known conversion for argument 2 from 'unsigned int' to 'uint16_t {aka short unsigned int}'
C:\Users\eric\Documents\Arduino\libraries\Sensirion/Sensirion.h:33:51: error: no matching function for call to 'Sensirion::meas(const uint8_t&, unsigned int
, const bool&)'

define measHumi(result) meas(HUMI, result, BLOCK)

                                               ^

NonBlocking.pde:67:19: note: in expansion of macro 'measHumi'
C:\Users\eric\Documents\Arduino\libraries\Sensirion/Sensirion.h:33:51: note: candidate is:

define measHumi(result) meas(HUMI, result, BLOCK)

                                               ^

NonBlocking.pde:67:19: note: in expansion of macro 'measHumi'
C:\Users\eric\Documents\Arduino\libraries\Sensirion/Sensirion.h:76:13: note: uint8_t Sensirion::meas(uint8_t, uint16_t, bool)
uint8_t meas(uint8_t cmd, uint16_t
result, bool block);
^
C:\Users\eric\Documents\Arduino\libraries\Sensirion/Sensirion.h:76:13: note: no known conversion for argument 2 from 'unsigned int' to 'uint16_t {aka short unsigned int}'
NonBlocking.pde: In function 'void loop()':
NonBlocking:81: error: no matching function for call to 'Sensirion::meas(const uint8_t&, unsigned int
, const bool&)'
NonBlocking.pde:81:50: note: candidate is:
In file included from NonBlocking.pde:15:0:
C:\Users\eric\Documents\Arduino\libraries\Sensirion/Sensirion.h:76:13: note: uint8_t Sensirion::meas(uint8_t, uint16_t, bool)
uint8_t meas(uint8_t cmd, uint16_t
result, bool block);
^
C:\Users\eric\Documents\Arduino\libraries\Sensirion/Sensirion.h:76:13: note: no known conversion for argument 2 from 'unsigned int' to 'uint16_t {aka short unsigned int}'
NonBlocking:91: error: no matching function for call to 'Sensirion::meas(const uint8_t&, unsigned int
, const bool&)'
NonBlocking.pde:91:52: note: candidate is:
In file included from NonBlocking.pde:15:0:
C:\Users\eric\Documents\Arduino\libraries\Sensirion/Sensirion.h:76:13: note: uint8_t Sensirion::meas(uint8_t, uint16_t, bool)
uint8_t meas(uint8_t cmd, uint16_t
result, bool block);
^
C:\Users\eric\Documents\Arduino\libraries\Sensirion/Sensirion.h:76:13: note: no known conversion for argument 2 from 'unsigned int' to 'uint16_t {aka short unsigned int}'
no matching function for call to 'Sensirion::meas(const uint8_t&, unsigned int
, const bool&)'
/code

sorry, screwed up the markdown, meant to put that in code brackets
Markus
@Links2004
Dec 28 2015 01:12
you can edit so no problem :)
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:12
oh you have a huzzah?
how do you like it?
msticninja
@msticninja
Dec 28 2015 01:13
I like it quite a bit, honestly. A bit hard to work through the arduino IDE, but I really don't like lua. :)
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:14
do you have any other breakout boards?
i hate how expensive it is :(
Markus
@Links2004
Dec 28 2015 01:15
change unsigned int rawData; to uint16_t rawData;
for AVR unsigned int = uint16_t on ESP unsigned int = uint32_t
msticninja
@msticninja
Dec 28 2015 01:16
None that are esp8266 based, but $9.99 for the huzzah is pretty fair, considering the 5V tolerant RX and the extra regulator, etc
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:17
doesn't the wemos d1 mini have that too?
oh hm, possibly not
i don't know, i think my upper limit for putting breakout boards in projects is $5
msticninja
@msticninja
Dec 28 2015 01:18
@Links2004 I don't see any declarations as an unsigned int. Sensirion.cpp defines it as uint16_t
Markus
@Links2004
Dec 28 2015 01:18
yes but in you sketch is somewhere unsigned int
msticninja
@msticninja
Dec 28 2015 01:19
grrr, found it.
Spent the whole night last night looking for that exact problem in the library. But it was in the darn example sketch itself...
@Links2004 Thanks , can't believe I didn't check the example sketch itself.
Markus
@Links2004
Dec 28 2015 01:21
thats why i hate macros, the error points you always to the wrong piece of code.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:23
@msticninja why do you need a 5v tolerant RX if it has a usb programmer on it?
msticninja
@msticninja
Dec 28 2015 01:23
@skorokithakis As I get older, I've upped my breakout board price limit. I don't have the patience these days to make a PCB for the whole project, so i spend a bit more on the breakouts and just design a PCB for connection the the breakout.
No programmer on this huzzah. FTDI programmer or serial-to-usb required.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:24
sure, but if you can get a breakout for half the price, even better
yeah, i mean the wemos
you don't need a 5v-tolerant rx since it includes a programmer
msticninja
@msticninja
Dec 28 2015 01:24
Ah, gotcha.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:25
if you aren't using OTA, you should, it's very handy
msticninja
@msticninja
Dec 28 2015 01:25
I like to browse my local shop, and they tend to have adafruit, sparkfun, and seeed studio stuff.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:25
ah
that's nice, all my orders take a month to arrive
msticninja
@msticninja
Dec 28 2015 01:25
So the wemos will probably be something I stock up on when I get the urge to internet shop.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:26
right
msticninja
@msticninja
Dec 28 2015 01:26
Yeah, we got pretty lucky here when one of our stores started carrying everything arduino and Pi related.
I hate shipping wait. :)
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:26
me too :(
how much more expensive are they in the shop?
msticninja
@msticninja
Dec 28 2015 01:27
OTA is interesting, but I haven't bothered to get to know it.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:27
it's really simple, you just paste a few lines and platformio can just upload automatically
msticninja
@msticninja
Dec 28 2015 01:28
A lot of the stuff is MSRP, so Adafruit and Sparkfun are the same price as online.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:28
that's pretty great
msticninja
@msticninja
Dec 28 2015 01:28
I don't think Seeed gives them retailer discount though, so seeed is a bit marked up.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:28
i guess seeed already has low margins anyway
msticninja
@msticninja
Dec 28 2015 01:28
Yup, just gotta pay tax. Still beats shipping.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:29
well, shipping is free on most of these :P
but yep
msticninja
@msticninja
Dec 28 2015 01:30
I also haven't bothered with platformIO yet either. I keep meaning to, but 90% of the stuff I do is vanilla arduino, so i just tend to use the arduino IDE.
Markus
@Links2004
Dec 28 2015 01:30
the IDE has OTA build in too.
msticninja
@msticninja
Dec 28 2015 01:31
seeed has margins so low, I just bought a 4.3" tft from them, and they are making me email them for the docs and example code.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 01:31
platformio is great
@Links2004 i know, i just prefer the command line :P
Markus
@Links2004
Dec 28 2015 01:31
me too, no arduino IDE in user here, all eclipse and makefiles.
msticninja
@msticninja
Dec 28 2015 01:32
I will have to check out the OTA in IDE. I've used the SPIFFS addon, which works well.
Markus
@Links2004
Dec 28 2015 01:32
SPIFFS upload is much faster over OTA then over Serial.
msticninja
@msticninja
Dec 28 2015 01:32
I'm sure. It's pretty painful even at 256000kbs.
sorry, bps
Markus
@Links2004
Dec 28 2015 01:33
with 921600 it still slow like hell when you upload 3MiB ;)
msticninja
@msticninja
Dec 28 2015 01:34
I enjoy command line for building ARM, but I started AVR using arduinos so now it's habit, and increases the work I have to do most of the time, but whatevs.
Markus
@Links2004
Dec 28 2015 01:35
and 921600 most time not work when you have more then 1-3cm from USB to the ESP.
msticninja
@msticninja
Dec 28 2015 01:35
I never managed to upload at 921600...
cheap converters ;)
Markus
@Links2004
Dec 28 2015 01:36
most time i upload the first time with 460800 and then OTA and debug at serial1 at 921600.
msticninja
@msticninja
Dec 28 2015 01:59
nice, sht11 and i2c 4line lcd both working now. Just need to figure out how to run a SSD1963 display controller...
msticninja
@msticninja
Dec 28 2015 02:09
Can't believe I have to wait for Sainsmart to email me docs and examples. That can't be cheaper than just providing a download link.
Helio Machado
@0x2b3bfa0
Dec 28 2015 08:45
I never managed to upload at 921600...
I only can upload at 115200 with a fake FTDI
Also only lowering the block size. (80 seconds for a normal sketch).
brutzler
@brutzler
Dec 28 2015 09:21
115200 is the only stable at my NodeMCUs. On higher speeds it can work or not. But OTA is working fine:-)
The only "problem" is, that I need an additional terminal-program, because for OTA the Arduino-IDE is switched away from COMx
brutzler
@brutzler
Dec 28 2015 10:06
BTW: Terminalprogram: Actually I am using HTerm. Would like to have one with timestamp in the line. With Hterm, I only have a timestamp at the bottom, when i move the mouse over the received data-line. Somebody knows a better one?
bidyutper
@bidyutper
Dec 28 2015 10:35
how to send command from one esp to multiple tcp server running esp
bidyutper
@bidyutper
Dec 28 2015 10:41
help me...
Stavros Korokithakis
@skorokithakis
Dec 28 2015 13:02
@bidyutper mqtt
Stavros Korokithakis
@skorokithakis
Dec 28 2015 15:11
does anyone have any sample code or documentation for how i can add a timer interrupt?
Stavros Korokithakis
@skorokithakis
Dec 28 2015 15:13
ah, yep, thanks!
does that do microsecond accuracy?
Chris Elsworth
@celsworth
Dec 28 2015 15:14
no, millisecond I think
Stavros Korokithakis
@skorokithakis
Dec 28 2015 15:14
aw
that won't do
Chris Elsworth
@celsworth
Dec 28 2015 15:14
if you want microsecond I think you need timer1_attach which is native SDK, don't think its exposed in arduino yet
no reason it can't be though I guess, just nobody has done it
Mario Mikočević
@mozgy
Dec 28 2015 15:14
@skorokithakis I'm using Ticker in my sketches ..
Stavros Korokithakis
@skorokithakis
Dec 28 2015 15:15
@mozgy what's the accuracy, do you know?
i need something firing every half ms
Mario Mikočević
@mozgy
Dec 28 2015 15:15
not microseconds :(
Stavros Korokithakis
@skorokithakis
Dec 28 2015 15:15
:(
Mario Mikočević
@mozgy
Dec 28 2015 15:16
I need it like every 5 or more minutes :)
Chris Elsworth
@celsworth
Dec 28 2015 15:16
can you not just check micros() in your loop() and fire it yourself?
or do you need this done while you may be busy doing other things
Stavros Korokithakis
@skorokithakis
Dec 28 2015 15:16
i'm trying to receive some RF waveforms
so i had an idea to check every 500ms
rather than timing the edges
Sven Eliasson
@comino
Dec 28 2015 15:17
500ms or µs ?
Stavros Korokithakis
@skorokithakis
Dec 28 2015 15:17
sorry, usec
i'll just sample every 500usec and check whether the edge is what i expect it to be
that way noise won't affect me unless it falls right in the middle of the waveform
maybe that's silly
Chris Elsworth
@celsworth
Dec 28 2015 15:18
well, a purist would say you should oversample :)
by as much as 10 - 20 times
Stavros Korokithakis
@skorokithakis
Dec 28 2015 15:18
that's true
and check whether the majority of samples is what i expect
Chris Elsworth
@celsworth
Dec 28 2015 15:18
right
Stavros Korokithakis
@skorokithakis
Dec 28 2015 15:18
that's a much better idea
thanks
i would have to synchronize it, too
hmm
damnit, this code is getting too complicated for me
i could easily write it in Python, but C...
Chris Elsworth
@celsworth
Dec 28 2015 15:19
the 8266 doesn't have many hardware timers (3) and one of them won't do usec
and some of them might be used by arduino core already depending what other libs you have in use
ie the servo lib uses timer1 iirc
Stavros Korokithakis
@skorokithakis
Dec 28 2015 15:20
hm
Chris Elsworth
@celsworth
Dec 28 2015 15:20
so to cut a long story short you have to use them quite sparingly :)
hm actually there might even be only one interrupt timer, sdk docs are hard to read
Stavros Korokithakis
@skorokithakis
Dec 28 2015 15:23
i'll just loop and sample, thanks man
the problem is that this receiver code has to have quite a bit of logic to it
count the samples, figure out when the edge has changed to resync, etc etc
Chris Elsworth
@celsworth
Dec 28 2015 15:24
you just need it to run faster than 0.5us and it should be ok :)
Stavros Korokithakis
@skorokithakis
Dec 28 2015 15:25
oh, it runs faster, that's no problem
it's just a lot of code for just a simple remote switch
FWeinb
@FWeinb
Dec 28 2015 15:37
The datasheet(Page 8) of the ESP8266 is stating that the esp8266 should have hardware I2C but I can't find any information about that, all examples I can find are using bit banging.
I also found the user guid for using i2c.
Me No Dev
@me-no-dev
Dec 28 2015 15:49
@FWeinb that is also software. There is no known hardware I2C in the ESP
@skorokithakis timer0 and timer1 are both implemented in Arduino
Arduino.h contains the function declarations
timer0 uses ccompare and timer1 uses well... timer1 :)
timer0 is used in Servo, timer1 is used for PWM
Stavros Korokithakis
@skorokithakis
Dec 28 2015 15:51
oh, nice
Me No Dev
@me-no-dev
Dec 28 2015 15:51
those are hardware interrupts like the pin interrupt we discussed yesterday
Stavros Korokithakis
@skorokithakis
Dec 28 2015 15:53
right
do you know their accuracy?
Me No Dev
@me-no-dev
Dec 28 2015 15:54
timer1 in really accurate
have not used timer0 yet @Makuna can help you there if is arround
FWeinb
@FWeinb
Dec 28 2015 15:54
@me-no-dev Thanks. So we can get to around 700kHz in 160mHz clock mode, judging by this.
Me No Dev
@me-no-dev
Dec 28 2015 15:55
yes, I have run those through the scope
FWeinb
@FWeinb
Dec 28 2015 15:56
I could not get that working though. Setting 160mHz via the IDE isn't working for me. (I am using a nodeMCU 1.0 dev board)
Me No Dev
@me-no-dev
Dec 28 2015 15:56
what version of the core?
bidyutper
@bidyutper
Dec 28 2015 15:57
@skorokithakis thx for info...but little knowledge about mqtt....i m a newbie to esp thing...can u help me with tht...
FWeinb
@FWeinb
Dec 28 2015 15:57
I am using 2.0.0 in the Arduino IDE 1.6.5
Me No Dev
@me-no-dev
Dec 28 2015 15:58
no clues really... last time I checked was some SDK revisions ago and it was showing proper freqs
will check again later and get some images
what are you getting?
FWeinb
@FWeinb
Dec 28 2015 15:59
Thanks. There is an issue about this esp8266/Arduino#1286
Around 400kHz. Even if I am selecting 160mHz in the menu.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 16:01
@bidyutper check the mqtt sample here: http://github.com/Imroy/pubsubclient
it's very easy
Me No Dev
@me-no-dev
Dec 28 2015 16:04
Chris Elsworth
@celsworth
Dec 28 2015 16:04
I saw someone else raising a ticket about 160MHz not working as well
oh it was 1286 :)
Me No Dev
@me-no-dev
Dec 28 2015 16:06
what he offered as fix could only be needed if it's not called by what I linked above
bidyutper
@bidyutper
Dec 28 2015 16:06
@skorokithakis k....let me study about mqtt...see wheather it helps me or not in regards to my project which I m currently workin on....i let u know...thx
Stavros Korokithakis
@skorokithakis
Dec 28 2015 16:09
npnp
bidyutper
@bidyutper
Dec 28 2015 16:11
@skorokithakis can i invite u in private
FWeinb
@FWeinb
Dec 28 2015 16:15
@me-no-dev Okay just tried it again. No issue, I must have missed something yesterday.
Me No Dev
@me-no-dev
Dec 28 2015 16:17
ok :)
Stavros Korokithakis
@skorokithakis
Dec 28 2015 16:34
@bidyutper sure
although it's better here so other people can help as well
bidyutper
@bidyutper
Dec 28 2015 16:42
@skorokithakis kk
Markus
@Links2004
Dec 28 2015 16:45
@/all I start a rework of ESP8266WiFiClass any wishes for new functions, may I can add them.
Chris Elsworth
@celsworth
Dec 28 2015 17:07
what do you have planned so far?
Markus
@Links2004
Dec 28 2015 17:12
  • reordering of functions
  • review of the code ( have already seen some thinks )
  • rework of the mode management
  • add API too get the WiFi events from SDK in sketch
  • may change some return types from int to the enum type (need to check if this break thinks)
  • rework WiFi scan there are many casts inside form and to void*
Chris Elsworth
@celsworth
Dec 28 2015 17:24
I like the sound of the events :)
maybe expose more sdk functions too, the transmit power in particular? I think I had to "extern C" that one to use it
Michael Miller
@Makuna
Dec 28 2015 17:28
@skorokithakis the accuracy is as good as the chips crystal, as they are based off the chips cycle counter. There is a delay as it does take a few cycles to store state and call the isr, but they will be consistent from most isr calls. Since pin io is slower (8mhz) thaN the timer, I have never experienced anything larger that would show. Does this answer your question?
Chris Elsworth
@celsworth
Dec 28 2015 17:33
that 8MHz figure is interesting, is there a source for that?
and is that register manipulation speed?
Michael Miller
@Makuna
Dec 28 2015 17:37
@skorokithakis @celsworth note, the esp12e does not have three timers, it only has one true timer (the others mentioned in the docs are not present). Timer 0 is a very simple one, it will trigger only when you change the value, so in your isr you have to set the next time you want it to fire by setting the value to getcyclecount() + cycles you want to wait. The servo routines demonstrate this but they are abstracted so they will work with either timer0 or timer1,
Chris Elsworth
@celsworth
Dec 28 2015 17:38
ah, thanks :)
I wonder if this core might benefit from a timer abstraction that uses timer1
similar to how it sets up user callbacks for gpios while only actually having one ISR itself
Ticker is ok, but only if you can make do with ms frequency
Michael Miller
@Makuna
Dec 28 2015 17:40
@celsworth I don't know the actual mechanics under the hood of the chip, but I believe they are using the other hidden timers to poll io and update pins at this slower rate. When bit banging it can get annoying as if you run fast enough, you can actually see the edges and hickups.
Michael Miller
@Makuna
Dec 28 2015 17:48
@celsworth current thinking is that it is rare to need these accuracies, except for bit banging io. I think at which point the protocol is the wrapper. We if over wrap the timers, we introduce delay and inaccuracy which could hurt an implementation of bit banging. Also note, we can't truely turn off IRQS like the atmel, you will run into problems with wifi if you do. This is due to some sdk change that came in during this last July that pretty much screwed my NeoPixel code and thus Adafruit also. I had to use the serial hardware support to get it to work and still there are reports of issues with longer strings.
FWeinb
@FWeinb
Dec 28 2015 18:35
@Links2004 Add a way to set the Mac Address (see esp8266/Arduino#413)
Markus
@Links2004
Dec 28 2015 18:36
@FWeinb not possible inside the class its needed to be called in __run_user_rf_pre_init.
FWeinb
@FWeinb
Dec 28 2015 18:38
Maybe provide a hook to pass in a function that is called on __run_user_rf_pre_init
Stavros Korokithakis
@skorokithakis
Dec 28 2015 18:39
@Makuna that answers my questions, thank you
@ivankravets trying out 2.6.3 atm
Markus
@Links2004
Dec 28 2015 18:40
@FWeinb __run_user_rf_pre_init is called before setup and loop, so a function call to the WiFiclass will not get any info,
since the "user" says later in the setup what mac he want its to late.
Ivan Kravets
@ivankravets
Dec 28 2015 18:41
@skorokithakis what do you mean?
FWeinb
@FWeinb
Dec 28 2015 18:41
@Links2004 Oh, to bad.
Markus
@Links2004
Dec 28 2015 18:42
@FWeinb yes the only possible way is like it is noted down in #413.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 18:43
@ivankravets i just installed platformio 2.6.3
Mario Mikočević
@mozgy
Dec 28 2015 18:49
@Links2004 why ESP8266WebServer something craps out and stops responding ?
Markus
@Links2004
Dec 28 2015 18:50
the WebServer can only handle one connection at one time, can be problematical with modern browsers,
@me-no-dev work on a new version that does not have this gap.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 18:51
this code makes the watchdog restart the esp, any ideas why? https://www.pastery.net/rddhmd/
Mario Mikočević
@mozgy
Dec 28 2015 18:51
aemh, so it might be browser overloading connections ..
but I really doubt it its the case here in my problem
Markus
@Links2004
Dec 28 2015 18:53
@skorokithakis try to enable debug: https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.h#L28
@mozgy yes the incoming connection backlog is full and then it looks like the EPS is not responding, (it only has a size of 1)
Mario Mikočević
@mozgy
Dec 28 2015 18:54
@Links2004 in my case it stops if there is no connection for some time
Markus
@Links2004
Dec 28 2015 18:55
may the SDK goes to modem Sleep then the reaction of new connections is really slow.
try:
WiFi.setSleepMode(WIFI_NONE_SLEEP);
Stavros Korokithakis
@skorokithakis
Dec 28 2015 18:55
@Links2004 ah, thanks
Mario Mikočević
@mozgy
Dec 28 2015 18:55
if for example I make simple crontab get each 2 minutes it works for a very long time
FWeinb
@FWeinb
Dec 28 2015 18:56
Don't know if the WiFiClass would be the right place for it but the ability to create a basic ICMP request would be great.
Mario Mikočević
@mozgy
Dec 28 2015 18:56
it craps out completely, not just slow .. :(
Markus
@Links2004
Dec 28 2015 18:57
@FWeinb i think ping requests shut be a own class like for TCP and UDP
FWeinb
@FWeinb
Dec 28 2015 18:58
@Links2004 That sound better. If I read the code correctly the SDK dose have all parts to do a ICMP request. There would just be the need for a high level wrapper.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 18:59
does anybody know of a performant, single-binary http server?
Markus
@Links2004
Dec 28 2015 18:59
yes the SDK has the function.
Chris Elsworth
@celsworth
Dec 28 2015 19:00
@skorokithakis for linux? boa, nginx, thttpd
there are reams of them to be honest, take your pick :)
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:00
eh none of those are single-binary, i want to do "httpserver" and have it serve the current dir in daemon-mode with minimal config
Chris Elsworth
@celsworth
Dec 28 2015 19:01
boa fits that bill
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:01
thttpd is the one i used to use years ago, i think!
Mario Mikočević
@mozgy
Dec 28 2015 19:01
@Links2004 where is that declared ? or new git ?
Chris Elsworth
@celsworth
Dec 28 2015 19:01
single-binary is a bit vague anyway, everything is single binary..
apache is a single binary ;)
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:01
haha
i mean something that won't install a service or look for any config files
i want to drop it in my ~/bin/ and just invoke it
Chris Elsworth
@celsworth
Dec 28 2015 19:02
how about a python based http server?
Markus
@Links2004
Dec 28 2015 19:02
WiFi.setSleepMode(WIFI_NONE_SLEEP); is in the current git Version.
for 2.0.0:
extern "C" {
#include <user_interface.h>
}


void setup() {
..........
 wifi_set_sleep_type(NONE_SLEEP_T);
}
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:02
i tried that, it seems to be hanging sometimes
Mario Mikočević
@mozgy
Dec 28 2015 19:02
ty
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:02
i'm just trying to test the esp's wifi range
so i want to do a walkaround while trying to http retrieve a file
Chris Elsworth
@celsworth
Dec 28 2015 19:03
@skorokithakis python -m SimpleHTTPServer 8000
that does exactly what you want, I think
FWeinb
@FWeinb
Dec 28 2015 19:03
@skorokithakis Some more HTTP Server one liners: https://gist.github.com/willurd/5720255
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:03
yeah, i tried it, but it seems to hang every now and then
boa is looking for its config
Chris Elsworth
@celsworth
Dec 28 2015 19:04
oh, thought you could just use commandline options
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:05
i'm trying, it still complains about its config file
Chris Elsworth
@celsworth
Dec 28 2015 19:06
yeah maybe thats no good then
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:06
yeah :/
thttpd, same
or i can't figure out the command line
Mario Mikočević
@mozgy
Dec 28 2015 19:06
scandone
f 0, sleep disable
scandone
let's see now ..
Martin Ayotte
@martinayotte
Dec 28 2015 19:09
@skorokithakis , you can write your own in python using derived class from HTTPServer.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:10
@martinayotte i'm looking for something super simple, just something that won't hang when the esp requests a file
Mario Mikočević
@mozgy
Dec 28 2015 19:11
@Links2004 onto your request - could ESP8266WiFiClass.reconnect() have any usefulness ?
Martin Ayotte
@martinayotte
Dec 28 2015 19:11
I've used the HTTPServer class in several projects and never got any hanging problems. Still, there is always some latencies with any HTTP servers, this is due to the nature of the protocol.
Markus
@Links2004
Dec 28 2015 19:12
@mozgy the SDK auto reconnects if it the connection get lost.
Mario Mikočević
@mozgy
Dec 28 2015 19:12
@Links2004 I ment forcibly reconnecting
Markus
@Links2004
Dec 28 2015 19:13
you want to call
        wifi_station_disconnect();
        wifi_station_connect();
Mario Mikočević
@mozgy
Dec 28 2015 19:14
if it's that simple
Chris Elsworth
@celsworth
Dec 28 2015 19:14
but isn't the point to add more wrapper functions to avoid having to use sdk :)
Mario Mikočević
@mozgy
Dec 28 2015 19:14
@martinayotte I'm only using #include <ESP8266WebServer.h>
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:15
can i just easily send a udp packet with the esp?
Chris Elsworth
@celsworth
Dec 28 2015 19:15
yes
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:15
that'd be much better
how can i do that?
Chris Elsworth
@celsworth
Dec 28 2015 19:15
in fact i prefer spitting out udp where possible
Markus
@Links2004
Dec 28 2015 19:15
yes will add it ;) want only show what the function will do.
Mario Mikočević
@mozgy
Dec 28 2015 19:15
KISS
Chris Elsworth
@celsworth
Dec 28 2015 19:15
@skorokithakis something like
WifiUDP udp;
udp.beginPacket(remoteIp, remotePort);
udp.println("hi!");
udp.endPacket();
meh..
hadn't finished!
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:16
haha
Markus
@Links2004
Dec 28 2015 19:16
@celsworth you can edit
blob
Chris Elsworth
@celsworth
Dec 28 2015 19:18
edited it, I think thats the basics anyway :) and the ip is just a byte array like normal
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:19
oh, thanks
damn, i hate byte arrays
Markus
@Links2004
Dec 28 2015 19:20
Links2004/Arduino@6f00503
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:20
byte remoteIp[4] = {192, 168, 10, 149};
like that?
ah, great, thank you
error: 'WifiUDP' was not declared in this
aw
Markus
@Links2004
Dec 28 2015 19:22
#include <WiFiUdp.h>
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:22
that's there :/
took it out of the body, got this:
error: 'WifiUDP' does not name a type
Markus
@Links2004
Dec 28 2015 19:23
strange, can you post the full code?
Mario Mikočević
@mozgy
Dec 28 2015 19:23
@Links2004 nice, even bool result
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:23
sure
Markus
@Links2004
Dec 28 2015 19:25
@skorokithakis code looking normal.
Ivan Kravets
@ivankravets
Dec 28 2015 19:26
Hey, looks like I need help
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:26
hm
where is the logic?
@Links2004 do you have any ideas?
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:28
@ivankravets i think this is a platformio bug
Ivan Kravets
@ivankravets
Dec 28 2015 19:28
@skorokithakis with what?
Markus
@Links2004
Dec 28 2015 19:28
@ivankravets its ok, the flash is mapped with an offset of 0x40200000 into the memory.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:29
@ivankravets i can't build this: https://www.pastery.net/xyuphx/
although i may be missing something very obvious
main.ino: In function 'void send()':
main.ino:34:1: error: 'WifiUDP' was not declared in this scope
main.ino:34:9: error: expected ';' before 'udp'
main.ino:36:1: error: 'udp' was not declared in this scope
scons: *** [.pioenvs/esp12e/src/tmp_ino_to.o] Error 1
Ivan Kravets
@ivankravets
Dec 28 2015 19:31
@Links2004 are they the same params??
_SPIFFS_start = 0x40500000 != 4M1M.build.spiffs_start=0x300000
Markus
@Links2004
Dec 28 2015 19:32
0x40500000 - 0x40200000 = 0x300000 ?
the flash is mapped with an offset of 0x40200000 into the memory.
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:33
ugh, it's taking SO LONG to write a simple pinger
Ivan Kravets
@ivankravets
Dec 28 2015 19:34
@Links2004 is it correct layout?
/* Flash Split for 4M chips */
/* sketch 1019KB */
/* empty  2048KB */
/* spiffs 1004KB */
/* eeprom 20KB */
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:34
turns out it's WiFiUDP, not WifiUDP
Markus
@Links2004
Dec 28 2015 19:36
@ivankravets 0x300000 = 3145728 so the SPIFFS starts at 3MB and goes to EEPROM size of 1004KB.
looking good to me.
Ivan Kravets
@ivankravets
Dec 28 2015 19:39
@Links2004 @skorokithakis I mean that in LD script START address is defined with the one value, but another value is used to write via esptool
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:40
the code above leads to this crash: https://www.pastery.net/afgfsf/
Markus
@Links2004
Dec 28 2015 19:41
@ivankravets that is normal,
the linker has the "cpu" point of view, the flash is mapped in the internal address stating at 0x40200000.
for the Uart bootloader address 0x00 is the start of the flash.
the address point to the same, but the "view point" is different.
Ivan Kravets
@ivankravets
Dec 28 2015 19:43

for the Uart bootloader address 0x00 is the start of the flash.

it's what I ask

thanks
Mario Mikočević
@mozgy
Dec 28 2015 19:45
question - I have a binary file in SPIFFS and I want it to send it to some http server, any example how to do it ?
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:47
@mozgy straight-up http upload with write()?
by the way, i was trying to make an rf transmitter/receiver for the ESP to communicate over a long range
but it turns out its wifi is way better
Markus
@Links2004
Dec 28 2015 19:47
currently not, the basics are there.
the HTTPClient can send a stream as post to the server.
https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.h#L137
if you use the SPIFFS as stream src it shut work.
Mario Mikočević
@mozgy
Dec 28 2015 19:48
well, looking at that file, POST payload is String ..
Mario Mikočević
@mozgy
Dec 28 2015 19:49
ah, ok, just a plain sendRequest
Aditya Tannu
@AdySan
Dec 28 2015 19:50
@skorokithakis RF using what frequency/hardware?
Mario Mikočević
@mozgy
Dec 28 2015 19:50
and uint8_t pointer on POST confused me even more :)
Aditya Tannu
@AdySan
Dec 28 2015 19:51
@skorokithakis @CNLOHR did some tests last year, take a look at this https://www.youtube.com/watch?v=7BYdZ_24yg0
Stavros Korokithakis
@skorokithakis
Dec 28 2015 19:52
@AdySan 433 mhz receiver/transmitter
does anyone know whether i can somehow extend the 12E's wifi range?
Endre Karlson
@ekarlso
Dec 28 2015 19:56
is there any known issues with I2C and the ESP ?
we got a issue with a ESP and a PN532 NFC v3 board that uses I2C to communicate, after a while it seems that the I2C just flatlines on the scope
Martin Ayotte
@martinayotte
Dec 28 2015 20:03
@ekarlso , I'm using an I2C GPIO Expander, the MCP23017, on several ESPs and I don't have any issue with them.
Mario Mikočević
@mozgy
Dec 28 2015 20:07
@Links2004 while you're at recoding -> "too less ram" => "not enough ram"
brutzler
@brutzler
Dec 28 2015 20:13
anybody has a good schematic of a MOSFET-PWM circuit for a backgroundlight of a LCD-display (ILI9341)?
MOSFET is better as transistor, or?
Markus
@Links2004
Dec 28 2015 20:15
@brutzler one p mos + a resistor shut do the jop
some think like this:
pic
brutzler
@brutzler
Dec 28 2015 20:17
what is R1 for? recommended value?
Markus
@Links2004
Dec 28 2015 20:18
to limit the current, 50-200 shut do it.
brutzler
@brutzler
Dec 28 2015 20:18
R or k?
Markus
@Links2004
Dec 28 2015 20:19
R, its only for safety, and better for EMV.
brutzler
@brutzler
Dec 28 2015 20:20
OK,thx. Looking for a Mosfet in my trash box.
Any special requirements, or is every MOSFET working?
Markus
@Links2004
Dec 28 2015 20:21
you need a p variant, and it shut work with 3V3 level
brutzler
@brutzler
Dec 28 2015 20:22
oh, can the 3v3-Vcc be a problem?
Markus
@Links2004
Dec 28 2015 20:22
VCC is 3V3 for the ILI9341
brutzler
@brutzler
Dec 28 2015 20:23
You meant the MOSFET should work with 3V3-level of the GPIO
Markus
@Links2004
Dec 28 2015 20:24
yes it need to switch by GD voltage of 3V3.
Steve Nelson
@zenmanenergy
Dec 28 2015 20:34
with the latest git pull I’ve started getting uploading errors:
warning: espcomm_send_command: didn't receive command response
warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed
closing bootloader
but if i switch back to the 2.0.0 version, the same code uploads fine.
Markus
@Links2004
Dec 28 2015 20:39
@zenmanenergy the esptool is the same in both versions, and the bootloader is hard coded,
what board do you use?
Steve Nelson
@zenmanenergy
Dec 28 2015 20:40
01
with an ftdi232
Markus
@Links2004
Dec 28 2015 20:40
so you select generic?
Steve Nelson
@zenmanenergy
Dec 28 2015 20:41
yes. i was having some spiffs issues with the 2.0.0 codebase, so I switched to the latest git pull and now it doesn’t want to upload at all
Markus
@Links2004
Dec 28 2015 20:43
strange the upload settings have not changes, too.
can you compare the flash command (esptool call)
Steve Nelson
@zenmanenergy
Dec 28 2015 20:43
hmmm. i just switched back… same issue. sigh. I don’t know how to debug this type of issue. I seem to get it frequently.
Mario Mikočević
@mozgy
Dec 28 2015 20:43
I need something like this ->
// experimental
  http.connect();
  http.addHeader( "Content-Length", length );
  http.sendHeader( "POST" );
  while ( length > 2048 ) {
    // fill buffer here
    http.write( buffer, 2048 );
    length = length - 2048;
  }
  http.write( buffer, length );
// experimental
it this even possible ?
Markus
@Links2004
Dec 28 2015 20:43
@mozgy http client or server?
Mario Mikočević
@mozgy
Dec 28 2015 20:44
ESP is client
that's followup on that upload file from esp thingy
Steve Nelson
@zenmanenergy
Dec 28 2015 20:45
@Links2004 when I run this at the command line: sudo ./esptool.py --port /dev/tty.usbserial-A50285BI --baud 115200 erase_flash
Markus
@Links2004
Dec 28 2015 20:45
                // get tcp stream
                WiFiClient * stream = http.getStreamPtr();
then you get access to the tcp
Steve Nelson
@zenmanenergy
Dec 28 2015 20:45
it gave me this:
Connecting...
Traceback (most recent call last):
File "./esptool.py", line 675, in <module>
esp.flash_erase()
File "./esptool.py", line 294, in flash_erase
self.flash_begin(0, 0)
File "./esptool.py", line 213, in flash_begin
struct.pack('<IIII', erase_size, num_blocks, ESPROM.ESP_FLASH_BLOCK, offset))1 != "\0\0":
File "./esptool.py", line 112, in command
raise Exception('Invalid head of packet')
Exception: Invalid head of packet
i swapped boards… and that error went away.
Mario Mikočević
@mozgy
Dec 28 2015 20:46
ah ok, back to reading source :)
Steve Nelson
@zenmanenergy
Dec 28 2015 20:46
any idea what caused that?
Markus
@Links2004
Dec 28 2015 20:46
Steve Nelson
@zenmanenergy
Dec 28 2015 20:46
ok
Markus
@Links2004
Dec 28 2015 20:46
I have done some fixes to the py version
Steve Nelson
@zenmanenergy
Dec 28 2015 20:47
thanks. i’ll give it a shot
is that the version of the tool used in the esp-arduino codebase?
Markus
@Links2004
Dec 28 2015 20:48
no, the IDE includes the c version from @igrr
Steve Nelson
@zenmanenergy
Dec 28 2015 20:48
oh ok.
Mario Mikočević
@mozgy
Dec 28 2015 20:48
@Links2004 btw, disabling wifi sleep seems to be working so far .. ty
Steve Nelson
@zenmanenergy
Dec 28 2015 20:50
uggh. El Capitan sucks monkey balls! The friggin’ /dev port for my ftdi disappears all the damn time.
Aditya Tannu
@AdySan
Dec 28 2015 20:54
@zenmanenergy I had that too, turned out to be a bad micro-USB cable.
Steve Nelson
@zenmanenergy
Dec 28 2015 20:55
oh yeah?
i’ll try another one.
i have to reboot every time. one thing that I thought would fix it was turning of “KEXT” signing. which makes me a little nervous because I don’t know what the heck that is.
but i tried it and i thought it was working. then poof the port disappears again… and again.
Aditya Tannu
@AdySan
Dec 28 2015 20:58
yeah i had exactly same issue, the KEXT thing just needs to be done once
after changing the usb cable hasnt happened yet
Steve Nelson
@zenmanenergy
Dec 28 2015 20:59
ok. i’ll try this one and buy a couple new ones at that. thanks for the tip.
Aditya Tannu
@AdySan
Dec 28 2015 21:00
the ch340 drivers seem finicky though, i get rnadom reboots sometime on connecting a device
Steve Nelson
@zenmanenergy
Dec 28 2015 21:01
that’s the one in the nodemcu, isn’t it?
Aditya Tannu
@AdySan
Dec 28 2015 21:01
yeah, some old(0.9) and new ones(v3),
the 1.0 (or V2) has a CP2102
which doesnt need kext disabling AFAIK
Steve Nelson
@zenmanenergy
Dec 28 2015 21:06
dang. it’s definitely something in either my hardware or in el cap. the arudino ide just hung and now it’s gone again. these reboots are like this is a windows machine.
oh damn… i just tried plugging into my other usb port and it worked. i guess my usb port itself could be faulty.
brutzler
@brutzler
Dec 28 2015 21:08
@Links2004 : only found some n-MOSFET (TO92, TO220) . Any chance for a PWM background light?
Me No Dev
@me-no-dev
Dec 28 2015 21:16
@zenmanenergy ytou are using USB hub right?
and HEAD uses 1.5 which I have found quite bad for many network tasks
Mario Mikočević
@mozgy
Dec 28 2015 21:20
@Links2004 spoke too soon, it hung again ..
I can talk to it's serial interface fine, just webserver part is unresponsive
Martin Ayotte
@martinayotte
Dec 28 2015 21:29
@brutzler , @Links2004 schematic sent earlier shows a P-MOSFET, so N-MOSFET won't work, unless you change the wiring of the backlight, switching the GND side instead of the VCC side (a bit difficult if the wiring is not accessible on your LCD)
brutzler
@brutzler
Dec 28 2015 21:31
@martinayotte: thought so :-(
Markus
@Links2004
Dec 28 2015 21:44
@brutzler yes a P MOSFET it needed N will not work for the LCD
brutzler
@brutzler
Dec 28 2015 23:55

Using PWM (for a LCD-backlight) on a NodeMCU V1.0. The breadboardfriendly version:
I do not think, that every Pin can be used for PWM. Even this is from the Reference:

analogWrite(pin, value) enables software PWM on the given pin. PWM may be used on pins 0 to 16

Using GPIO1 no reaction on the GLCD
Using GPIO9 always rebooting
Using GPIO10 working, but during OTA-update, there is a flashing of the PWM. Looks like this is used internal for memory access or similiar

Mario Mikočević
@mozgy
Dec 28 2015 23:59
what is your mem setting DIO or QIO ?