These are chat archives for esp8266/Arduino

14th
Nov 2015
probonopd
@probonopd
Nov 14 2015 10:52
Hi, is there a "serial" monitor planned for OTA? E.g., using ser2net?
Something that would be usable with the IDE?
Markus
@Links2004
Nov 14 2015 11:09
the current ide only supports ssh "serial" monitor.
if arduino has accepted the changes for OTA ( that it work again in 1.6.6).
we will work on this topic.
brutzler
@brutzler
Nov 14 2015 11:52
Regarding to OTA. Lost overwiew.
What is actually the best and easiest way? I am still using the stuff out of the DNS_SD_Arduino_OTA. But I heard the cracks are working on an arduinoOTA-lib very hard.
but you need the git version to use it
Mario Mikočević
@mozgy
Nov 14 2015 12:16
question- does Ticker work with latest git ?
Markus
@Links2004
Nov 14 2015 12:17
yes it work
Mario Mikočević
@mozgy
Nov 14 2015 12:17
IDE won't compile it for me
Markus
@Links2004
Nov 14 2015 12:18
what error do you get
Mario Mikočević
@mozgy
Nov 14 2015 12:18
build-421 IDE + latest esp git
Markus
@Links2004
Nov 14 2015 12:19
build-421 ? latest supported IDE is 1.6.5
Mario Mikočević
@mozgy
Nov 14 2015 12:19
yeh, OTA fun, remember ? :)
Me No Dev
@me-no-dev
Nov 14 2015 12:20
:D he is using one of the test builds from ArduinoRobot
Mario Mikočević
@mozgy
Nov 14 2015 12:20
basicaly it barfs on ticker linked funkction as undeclared
Me No Dev
@me-no-dev
Nov 14 2015 12:20
what is the error that you get on compilation
missing header maybe?
Mario Mikočević
@mozgy
Nov 14 2015 12:21
tickerDHTScan.attach( WAITTIME, flagDHTScan );
void flagDHTScan( void ) {}
'flagDHTScan' was not declared in this scope
Markus
@Links2004
Nov 14 2015 12:21
please copy the build output here :)
Mario Mikočević
@mozgy
Nov 14 2015 12:21
just did
the very same code works fine on 1.6.5
Me No Dev
@me-no-dev
Nov 14 2015 12:22
1.6.5 with the latest repo or older core?
Markus
@Links2004
Nov 14 2015 12:22
try to place the void flagDHTScan( void ) {} above the function thats call tickerDHTScan.attach( WAITTIME, flagDHTScan );
Mario Mikočević
@mozgy
Nov 14 2015 12:22
hmm, order now matters ? ok
Markus
@Links2004
Nov 14 2015 12:24
may be the error looks like this.
if you Programm in pure c++ then it matter always ;)
the IDE try to that automatically adding prototypes but may failed in this time.
Mario Mikočević
@mozgy
Nov 14 2015 12:25
machine code background here .. kinda got lost in c++ for quite awhile ..
and yes, 1.6.5 with latest esp8266 git compiles this sketch fine
Me No Dev
@me-no-dev
Nov 14 2015 12:39
1.6.7 uses Arduino-Builder which is going the console way
god knows what they changed, but that is the cause
Mario Mikočević
@mozgy
Nov 14 2015 12:47
hehheh - exit status 1 - Exception in thread "Thread-215" java.lang.ArrayIndexOutOfBoundsException: -1
don't think that this build is prime ready yet
Me No Dev
@me-no-dev
Nov 14 2015 12:48
paste the trace please
Mario Mikočević
@mozgy
Nov 14 2015 12:48
whole java error block from 1.6.7 ide ?
Me No Dev
@me-no-dev
Nov 14 2015 12:49
yes, the exception trace lines that follow
Mario Mikočević
@mozgy
Nov 14 2015 12:50
exit status 1 Exception in thread "Thread-215" java.lang.ArrayIndexOutOfBoundsException: -1 at javax.swing.text.Utilities.getTabbedTextWidth(Utilities.java:249) at javax.swing.text.Utilities.getTabbedTextWidth(Utilities.java:208) at org.fife.ui.rsyntaxtextarea.TokenImpl.listOffsetToView(TokenImpl.java:678) at org.fife.ui.rsyntaxtextarea.SyntaxView.modelToView(SyntaxView.java:547) at javax.swing.plaf.basic.BasicTextUI$RootView.modelToView(BasicTextUI.java:1509) at javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:1047) at javax.swing.plaf.basic.BasicTextUI.modelToView(BasicTextUI.java:1022) at javax.swing.text.JTextComponent.modelToView(JTextComponent.java:1377) at org.fife.ui.rtextarea.RTextAreaBase.possiblyUpdateCurrentLineHighlightLocation(RTextAreaBase.java:776) at org.fife.ui.rtextarea.RTextArea.fireCaretUpdate(RTextArea.java:605) at org.fife.ui.rsyntaxtextarea.RSyntaxTextArea.fireCaretUpdate(RSyntaxTextArea.java:810) at javax.swing.text.JTextComponent$MutableCaretEvent.fire(JTextComponent.java:4394) at javax.swing.text.JTextComponent$MutableCaretEvent.stateChanged(JTextComponent.java:4416) at javax.swing.text.DefaultCaret.fireStateChanged(DefaultCaret.java:802) at javax.swing.text.DefaultCaret.changeCaretPosition(DefaultCaret.java:1274) at javax.swing.text.DefaultCaret.handleSetDot(DefaultCaret.java:1173) at javax.swing.text.DefaultCaret$DefaultFilterBypass.setDot(DefaultCaret.java:1913) at javax.swing.text.NavigationFilter.setDot(NavigationFilter.java:64) at org.fife.ui.rtextarea.ConfigurableCaret$FoldAwareNavigationFilter.setDot(ConfigurableCaret.java:670) at javax.swing.text.DefaultCaret.setDot(DefaultCaret.java:1151) at javax.swing.text.DefaultCaret.setDot(DefaultCaret.java:1051) at javax.swing.text.JTextComponent.setCaretPosition(JTextComponent.java:1631) at processing.app.Editor.addLineHighlight(Editor.java:2033) at processing.app.Editor.statusError(Editor.java:2888) at processing.app.Editor$BuildHandler.run(Editor.java:2019) at java.lang.Thread.run(Thread.java:745)
I was just rearranging code blocks so that they follow scope
no actual code change
Me No Dev
@me-no-dev
Nov 14 2015 12:53
that is normal
it can happen by just clicking on the window
I have had this error since ages
Mario Mikočević
@mozgy
Nov 14 2015 12:55
ok
Mario Mikočević
@mozgy
Nov 14 2015 13:14
ok, I am now completely confused -> took original code, unchanged, just did copy/paste to new sketch window and it now compiles fine
same code back to old sketch name - errors
where arduino IDE saves history ?
Mario Mikočević
@mozgy
Nov 14 2015 13:51
got it all sorted, OTA works nicely, thank you for the help ! :)
frippe75
@frippe75
Nov 14 2015 14:13
big thanks from me as well, OTA has been working flawlessly for about 15 sketchuploads now. Now I just have to come up with a way to get the BasicOTA sketch on all (20) of my ESP12e ... :-) It really should be "factory loaded".
frippe75
@frippe75
Nov 14 2015 14:35
This message was deleted
frippe75
@frippe75
Nov 14 2015 14:53

I'm looking for a way to OTA pull upgrade a ATMega328 connected only via serial to the ESP8266.
The ESP8266AVRISP provides a push mechanism but is only good for development stage. If I was to create a product that I wanted to have the customers upgrade pull is the way to go if I dont want to redistribute avrdude along....

I started looking into the STK500 protocol but feel a bit time- and skill-limited to get that done. Not sure if I could re-work the ESP8266AVRISP sketch but I think that it relies heavily on the avrdude to do the heavy lifting (STK500). The headerfiles do indicate STK500 awareness ....

Another problem with existing push solutions are that they are rather large codewise.

Compiling Arduino_Wifi_AVRISP:
Sketch uses 222,260 bytes (21%) of program storage space
And thats 40% if you want to do OTA of the ESP8266 as well (right??)

My thinking (bruteforce fire-and-forget) was something along the lines of:

Create a new uploader that does an avrdude running under tusc.
It will capture all the serial communication with timing. (This is working)

The format of the file will be:

<line delay in ms>:<byte array>
.
.

<EOF>

I have not gotten this to work fully but the OTA pull would be as simple as:

  • Download the file to memory or fs.
  • Loop file
    Serial.write(..<byte array>...)
    delay(<line delay> + extra delay for safety)
    End Loop

Maybe I need to read the serial data from the ATMega but I was thinking I simply ignore it...

I did some tests comparing my "output"/"binary" files and only the timing varies vagly.

I realize this is a bit bruteforce...
Any input to this?

:-)

Markus
@Links2004
Nov 14 2015 14:57
the ESP8266AVRISP uses ISP to download the firmware to an atmega.
if you have allready programed ones you can use a serial connection to talk to the atmega bootloader this shut be easyer then the ISP stuff.
a simple serial bridge to an pc running avrdude shut be working
frippe75
@frippe75
Nov 14 2015 14:58
I though the ESP8266AVRISP could not get a bootloader onto the ATMega.
But I want to be able to change my ATMega sketch ...
Markus
@Links2004
Nov 14 2015 14:58
why not?
its an ISP programmer running stk500 protocol over network
normally you shut be able to upload the arduino bootloader to the atmega this way
frippe75
@frippe75
Nov 14 2015 15:01
Ok but what about pull OTA?
Im talking about after the "product"shipped to a customer.
I dont want to supply a firmware upgrade tool that gets installed on a PC or something like that.
I would like the ESP8266 to be able to program the ATMega328 on it's own using a pull firmware file.
Also the ESP8266AVRISP is fairly large in size.
Markus
@Links2004
Nov 14 2015 15:03
that shut be easy.
  1. ESP running a serial bridge server
  2. if some think connects the ESP triggers the ATmega reset to get to the bootloader
  3. use avrdude to write the atmega firmware by the serial bridge
This message was deleted
shut need only around 30 - 50 lines of code.
frippe75
@frippe75
Nov 14 2015 15:05
But my "customers" wont have avrdude..
Markus
@Links2004
Nov 14 2015 15:06
"I dont want to supply a firmware upgrade tool that gets installed on a PC or something like that."
your tool can start avrdude in backround to get the jop done.
frippe75
@frippe75
Nov 14 2015 15:07
I dont think we are on the same page. I dont want to supply avrdude.
If the tool you are referring to is something running outside my product.
Me No Dev
@me-no-dev
Nov 14 2015 15:07
so you do not need to look at the stk500 then
gimme a sec I'll give you a header that does all ICSP communication
Markus
@Links2004
Nov 14 2015 15:08
ok, how do the firmware upgrade tool looks like?
frippe75
@frippe75
Nov 14 2015 15:08
It's ALL running on the ESP8266
ALL=ONLY
:-)
Markus
@Links2004
Nov 14 2015 15:10
ok then your first description was somehow misleading me.
frippe75
@frippe75
Nov 14 2015 15:10
My thinking was to have a resetline to the ATMega and get it into bootloader mode. And send my sketch that way, But I was certain that it was still realted to the STK500 protocol at this stage.
Markus
@Links2004
Nov 14 2015 15:11
ok so the ESP and ATmega are connected by RX TX and some GPIO to the Reset of the atmega?
frippe75
@frippe75
Nov 14 2015 15:11
I just think it was kind of a long comment on my behalf :-)
here is an example of how I run a web request for the signature and stuff
void handleAvrInfo(){
  ICSP_ENTER_PROG();

  uint8_t sig0 = ICSP_GET_SIG0();
  uint8_t sig1 = ICSP_GET_SIG1();
  uint8_t sig2 = ICSP_GET_SIG2();
  uint8_t low = ICSP_GET_FUSE_LOW();
  uint8_t high = ICSP_GET_FUSE_HIGH();
  uint8_t ext = ICSP_GET_FUSE_EXT();
  uint8_t lock = ICSP_GET_FUSE_LOCK();

  char output[128];
  sprintf(output, "{\"sig0\":%u,\"sig1\":%u,\"sig2\":%u,\"low\":%u,\"high\":%u,\"ext\":%u,\"lock\":%u}", sig0, sig1, sig2, low, high, ext, lock);
  server.send(200, "text/json", output);
  ICSP_LEAVE_PROG();
}
AVR is connected to the SPI port and uses pin 16 for reset
I started working on a full ICSP web interface but got drawn into other things
now you need to dig some source that can parse your hex and turn it into ISCP commands
frippe75
@frippe75
Nov 14 2015 15:14
Wow great! But one more criteria I left out was that SPI requires too many pins for me.
Me No Dev
@me-no-dev
Nov 14 2015 15:14
ICSP is SPI it uses 4 pins
there is no way around that
frippe75
@frippe75
Nov 14 2015 15:14
I know.
only 2 for Serial.
Me No Dev
@me-no-dev
Nov 14 2015 15:15
if you want to turn the hex into Serial stk500va commands that is something else
frippe75
@frippe75
Nov 14 2015 15:15
Im actually out of pins on the ATmega.
Me No Dev
@me-no-dev
Nov 14 2015 15:15
then you need RX, TX and Reset pins
so that is one less
not sure how much of a win
frippe75
@frippe75
Nov 14 2015 15:15
Dont I need the Reset for the SPI?
Me No Dev
@me-no-dev
Nov 14 2015 15:16
ESP pin 16 is AVR reset
you need Reset either way
frippe75
@frippe75
Nov 14 2015 15:16
So thats 2 pins then?
Me No Dev
@me-no-dev
Nov 14 2015 15:16
because you need to put the AVR into bootloader
it's 3 pins
RX, TX and reset
or MISO, MOSI, SCK and Reset
frippe75
@frippe75
Nov 14 2015 15:16
I meant two pin in favor of Serial over SPI
pins...
Me No Dev
@me-no-dev
Nov 14 2015 15:16
1 pin
frippe75
@frippe75
Nov 14 2015 15:17
SS?
Me No Dev
@me-no-dev
Nov 14 2015 15:17
that is the reset pin
frippe75
@frippe75
Nov 14 2015 15:17
Aha!
Ok but what about sketch size?
Me No Dev
@me-no-dev
Nov 14 2015 15:17
what about it?
frippe75
@frippe75
Nov 14 2015 15:17
for the SPI version.
Me No Dev
@me-no-dev
Nov 14 2015 15:17
this SPI code can upload any sketch to any AVR and size
frippe75
@frippe75
Nov 14 2015 15:18
I dont have too much to spend on the OTA.
I do understand it's better in almost all ways.
Me No Dev
@me-no-dev
Nov 14 2015 15:19
it does not matter wether you will write the HEX to Serial or Hex to SPI
frippe75
@frippe75
Nov 14 2015 15:19
Using ESP12-e
Me No Dev
@me-no-dev
Nov 14 2015 15:19
it's about the same amount of code
you have more thanplenty of space
frippe75
@frippe75
Nov 14 2015 15:19
Ok I might be missing how much simpler your alternative is compared to the ESP8266AVRISP
Me No Dev
@me-no-dev
Nov 14 2015 15:20
ESP8266AVRISP gets stk500v1 commands and turns them into SPI
what I pastebined is just the SPI commands that you can use to control the AVR
frippe75
@frippe75
Nov 14 2015 15:21
ICSP_ENTER_PROG(); basically sends the reset ?
Me No Dev
@me-no-dev
Nov 14 2015 15:22
and sends the command to enter prog mode
frippe75
@frippe75
Nov 14 2015 15:22
Ok so while in prog mode. I simply send my sketch=
?
Me No Dev
@me-no-dev
Nov 14 2015 15:22
I do not know how to answer to you right now
frippe75
@frippe75
Nov 14 2015 15:23
.. haha... asking stupid questions... :-)
Me No Dev
@me-no-dev
Nov 14 2015 15:23
you should read on how ICSP works on the AVR and trhen you will understand what the code is for and how to use it
frippe75
@frippe75
Nov 14 2015 15:23
me asking that is ...
I have read some of the programming guides from ATMEL but It's does not look trivial. I was hoping to get around that but having avrdude to the heavy lifting.
Me No Dev
@me-no-dev
Nov 14 2015 15:25
but you said customers will not have avrdude
frippe75
@frippe75
Nov 14 2015 15:25
no.
Me No Dev
@me-no-dev
Nov 14 2015 15:26
then avrdude is not an option
you can go many ways getting the hex to the esp
then you need to write the rest
frippe75
@frippe75
Nov 14 2015 15:26
Thats why I package my firmware (that later gets put on a webserver) using the avrdude under strace (I might have written tusc but that is the HP-UX version of strace).
That generates a hexfile which also contains timing info. It's like a only do a replay of that avrdude session on the ESP8266...
Yeah that is it... think of it as an avrdude recorder... :-)
Me No Dev
@me-no-dev
Nov 14 2015 15:29
if you google rhe ahafruit gemma bootloader git, in there you should find a sketsh that loads the bootloader from arduino to attiny85
sketch is in hex format, attiny is connected over the SPI
you can see there how the hex is parsed and turned into SPI commands
frippe75
@frippe75
Nov 14 2015 15:29
ok "adafruit gemma bootloader git"
But I still need to "port" that arduino SPI version to ESP8266 SPI right=
right?
I think thats why the old ArduinoISP sketch did not work on ESP8266.
Me No Dev
@me-no-dev
Nov 14 2015 15:32
if it has specific AVR code then yes
you have to do some coding, cmon :D
can't have it all already done
frippe75
@frippe75
Nov 14 2015 15:33
But... Did you understand what I wanted to create?
Me No Dev
@me-no-dev
Nov 14 2015 15:33
yes
frippe75
@frippe75
Nov 14 2015 15:33
or is it flawed from start..
Me No Dev
@me-no-dev
Nov 14 2015 15:33
and I gave you all the tools you might need
wether it's flawed is for you to figure out :)
frippe75
@frippe75
Nov 14 2015 15:34
for that I'm greatfull! thanks!
Me No Dev
@me-no-dev
Nov 14 2015 15:34
read how ICSP works in general, read some of the examples, then it's really not that hard to do it
but you have to keep track of addresses, pages and so on
some stuff is given by avrdude but is not found in the HEX
that data is MCU specific so should be hardcoded in your sketch
frippe75
@frippe75
Nov 14 2015 15:36
Ok! But I will try version first... probably only to come to the conclusion I need to do it the proper way.
My primary focus is to create a minimal uploader. save pins. Thanks for the chat!
...and read as little STK500/SPI as possible ;-)
Me No Dev
@me-no-dev
Nov 14 2015 15:40
does your way give you indication of fail?
you "play" the avrdude but what do you do with the responses?
frippe75
@frippe75
Nov 14 2015 15:41
throw them out the window! It a bruteforce fire&forget approach (thats what I call it instead of un-educated way of doing it )
I did 10 consecutive uploads using avrdude and the behavior is the same all 10 times. As long as I use the same architecture and speeds I should in theory be good.
The only "problem" with my way is that my binary file will be larger since it contains the hex file + commands and addresses sent via serial.
But a ~700byte hex file went to maybe 1200bytes...
So it does consume more memory space during the upgrade.... might be a problem.
I was planning on putting in some checksum on the file. But maybe I could upload it in chunks.. Not sure if the bootloaded will timout during programming if a long pause is inserted...
Mario Mikočević
@mozgy
Nov 14 2015 17:03
question - is this multicast storm with OTA really needed in that amount ?
Me No Dev
@me-no-dev
Nov 14 2015 17:04
what do you mean by storm?
should be asked every 2 minutes
Mario Mikočević
@mozgy
Nov 14 2015 17:04
17:36:00.146085 IP 192.168.44.106.5353 > 224.0.0.251.5353: 0*- [0q] 4/0/0 PTR esp8266-f930bf._arduino._tcp.local., (Cache flush) TXT "board=generic" "auth_upload=no" "tcp_check=no" "ssh_upload=no", (Cache flush) SRV esp8266-f930bf.local.:8266 0 0, (Cache flush) A 192.168.44.106 (199)
Me No Dev
@me-no-dev
Nov 14 2015 17:05
packet looks finee
Mario Mikočević
@mozgy
Nov 14 2015 17:05
10-12 per sec
Me No Dev
@me-no-dev
Nov 14 2015 17:05
that is not normal
Mario Mikočević
@mozgy
Nov 14 2015 17:06
anything I can do to check/fix ?
Me No Dev
@me-no-dev
Nov 14 2015 17:06
check what is requesting it
tcpdump should show prequest packets also prior to those responses
Mario Mikočević
@mozgy
Nov 14 2015 17:07
hm? open IDE requests those that often ?
Me No Dev
@me-no-dev
Nov 14 2015 17:08
as I said, they should be every 2 minutes
at east that is what is on my side and what is set ass TTL for the answers
Mario Mikočević
@mozgy
Nov 14 2015 17:08
ok, noted, closed IDE now, it stopped
every 1 minute
after I restarted IDE
onkelfunny
@onkelfunny
Nov 14 2015 20:45
Hello. Is someone using the OneButton Library? I have a problem with the state... the state is always pressed.
Bildschirmfoto 2015-11-14 um 21.43.39.png
This is my code:
OneButton button1(buttonPin, true);

ok ... found a solution with

pinMode(buttonPin, INPUT_PULLUP);

frippe75
@frippe75
Nov 14 2015 21:23
This message was deleted
This message was deleted