These are chat archives for esp8266/Arduino

13th
May 2016
Martin Ayotte
@martinayotte
May 13 2016 00:16
@dogmaphobic , pretty normal since you try to access pwmTable outside its limit, you need to add a "if (i > 1) i = 0;" (normal C/C++ behavior with any pointers)
Gus Grubba
@dogmaphobic
May 13 2016 00:16
I don’t, he does :P
Martin Ayotte
@martinayotte
May 13 2016 00:17
@dogmaphobic , what do you means ?
Gus Grubba
@dogmaphobic
May 13 2016 00:17
pretty normal since you try to access
I don’t try to access anything. @M0ebiu5 does. I was just telling him his array only has space for 2 integers and his loop goes on incrementing the index forever.
Martin Ayotte
@martinayotte
May 13 2016 00:18
Can you provide link to this code ?
Oh ! sorry ! I got the wrong interlocutor ! @M0ebiu5 : check the above discussion
:-)
Clemens Kirchgatterer
@everslick
May 13 2016 05:50
what is the prefered way to increase the .text segment? i tried to set len of iram1_0_seg : org = 0x40100000, len = 0x8000 <- HERE to 0x9000 in the correxponding linker script, but them my sketch does not start anymore
Ivan Grokhotkov
@igrr
May 13 2016 05:53
You can not increase .text segment above 0x40108000 because there is no IRAM there.
(well actually there is, but it's used as IROM cache)
GDBStub .text segment amounts to 3420 bytes
Clemens Kirchgatterer
@everslick
May 13 2016 06:00
aha, thx. ok, then i have to further strip my binary i guess. or can i make room for it in the other direction (downwards). maybe reducing heap?
Clemens Kirchgatterer
@everslick
May 13 2016 06:09
but maybe this is futile anyway, i have to compile with -Os in the first place, and i don't think gdb likes that. :-(
Ivan Grokhotkov
@igrr
May 13 2016 06:13
heap comes from data RAM, and .text segment goes into instruction RAM, so there is no way to trade one for another
Clemens Kirchgatterer
@everslick
May 13 2016 06:22
ah, yes, harvard architecture, stpid me
Ivan Grokhotkov
@igrr
May 13 2016 07:28
Yeah, in that case using a real JTAG might be a better option
M0ebiu5
@M0ebiu5
May 13 2016 07:56
@dogmaphobic the sample code shows the crash when using the pgm_read_word_near function - so in my environment, i is never incremented. The code ended up like this after shrinking...have you tried it?
hreintke
@hreintke
May 13 2016 11:11
Is anyone using the "Arduino C++ IDE 1.0" eclipse marketplace extension and know how to include libaries like f.e <Wire.h> in the application. I get fatal error: Wire.h: No such file or directory when trying.
Ivan Grokhotkov
@igrr
May 13 2016 12:01
@hreintke i think this comment from the author implies that this feature is being worked on: https://marketplace.eclipse.org/comment/3790#comment-3790
hreintke
@hreintke
May 13 2016 12:12
@igrr :
I had seen that comment but had the impression is was related to "user defined libraries".
In my wording : libraries that are not part of the standard distribution but added by users afterwards.
And Wire.h is coming with the standard distribution.
But : Thanks for the reply. Will wait until eclipse-neon arrives and use arduino-ide until then.
Clemens Kirchgatterer
@everslick
May 13 2016 12:47
after hours of reading and experimentation, i came to the conclusion, that the core itself does already use most of the available space in .text. adding ICACHE_FLASH_ATTR to functions does not help, because this seems to be the default anyway, so normal code goes into .irom. also setting #define ATTR_GDBFN ICACHE_FLASH_ATTR did not help. next thing i will try is, if i can make GDBStub work in an almost empty sketch... are those statements correct so far?
Ivan Grokhotkov
@igrr
May 13 2016 12:49
Yep, looks correct. I can say that GDBStub does work for me along with PubSubClient and ESP8266WiFi (WiFiClientSecure) libraries.
Nils Uliczka
@darookee
May 13 2016 13:45
Has anyone got the usb host shield library to compile for the esp8266?
Clemens Kirchgatterer
@everslick
May 13 2016 14:00
ivan, thanx! so the only thing, that would make room in the IRAM is to more aggressively use ICACHE_FLASH_ATTR in core functions then. looks like a lot of work. :-/
Stavros Korokithakis
@skorokithakis
May 13 2016 14:26
can anyone help me with a multiwifi+mqtt example?
@igrr any ideas?
Stavros Korokithakis
@skorokithakis
May 13 2016 14:47
hmm
does running wifiMulti.addAP() with the same ssid/password harm anything?
Ivan Grokhotkov
@igrr
May 13 2016 15:09
@everslick well the core itself has very little code, size wise, that goes into IRAM. It mostly comes from the SDK functions. There are many which absolutely need to be in RAM, and then some which are there for performance reasons.
@skorokithakis i'm not really a WiFiMulti guy, this thing was written by @Links2004, I haven't really ever used it myself.
Stavros Korokithakis
@skorokithakis
May 13 2016 15:10
oh hmm, thanks
i'm trying things out now
Ivan Grokhotkov
@igrr
May 13 2016 15:10
Do you have some specific issues though?
If you just throw a pubsubclient thing into WiFiMulti example it should work I guess
For mqtt you need two objects: a TCP client (WiFiClient) and an MQTT client (PubSubClient)
These two objects are initialized exactly the same way is PubSubClient library esp8266 example
Stavros Korokithakis
@skorokithakis
May 13 2016 15:15
hmm, yeah, now that i experiment, that part seems to work
i'm having trouble with the reconnection part
i'm guessing that this isn't the right way to check if the wifi is connected: "if(WiFiMulti.run() == WL_CONNECTED) return;"
wow, this is weird
i've added Serial.println() statements between the wifi connection and the MQTT publish, and the statements stop printing anything right before the wifi connection, but the MQTT publish works!
i have no idea why i don't see anything printed in Serial
after the "connecting wifi..." message
Stavros Korokithakis
@skorokithakis
May 13 2016 15:20
i need to write my ESP boilerplate library, this is so common that it should just work :/
Stavros Korokithakis
@skorokithakis
May 13 2016 15:34
looks like it works, but Serial just breaks for some reason
Clemens Kirchgatterer
@everslick
May 13 2016 16:40
i'm going to release a arduino SDK based framework soon, that has support for mqtt, websockets, initial setup via soft AP... to remove the pain of doing it over and over again.
Mehrdad K
@mkeyno
May 13 2016 16:45
hi @everslick ,
what would your release repository be ?
Clemens Kirchgatterer
@everslick
May 13 2016 16:57
github
Mehrdad K
@mkeyno
May 13 2016 16:57
I mean which repository on your github page
Clemens Kirchgatterer
@everslick
May 13 2016 16:58
i'm currently writing the README.md and adding the last bits to the Makefile
i did not push it yet, but i will call it genesys for now
Mehrdad K
@mkeyno
May 13 2016 17:03
@everslick , I have question about UDP , r u in mood and got time to talk about it
Clemens Kirchgatterer
@everslick
May 13 2016 17:06
sure, if you don't mind lags ;-)
Mehrdad K
@mkeyno
May 13 2016 17:13
thanks buddy , actually I intend to slice the big stream file (like 150-50kb) to dozen of parts and add the specific IP to each of them and send it designated ESP module which are connected to my home wifi-router and listening to UDP package( each sliced package is around 7kb) , then all the Modules should received the its package and concurrently start to process it, and it should be performed not more than 40ms
with this criteria do you think is it possible to follow such timing and dispense the big package to the ESP nodes
Clemens Kirchgatterer
@everslick
May 13 2016 17:19
yes, i think this is indeed possible from a performance standpoint. you can get very low latencies generally on the ESP, but UDP on the esp is limited to 1.5K, IIRC so you need to find a way to increase that udp buffer.
luckily the arduino core comes with LWIP source code, so somewhere there there might be a define for that :)
Gus Grubba
@dogmaphobic
May 13 2016 17:24
My experience with high throughput UDP is to have a large number of packet loss. Regarding the frame size (1.5k versus 7k), unless you will be writing the code down at the Espresiff level, you have no control over that. You Start/Write/End. The writes are limited to around 8k internally so you need to make sure to check the return written amount. From there, the buffer is split into whatever number of frames and sent over the wire.
Mehrdad K
@mkeyno
May 13 2016 17:24
I know each stream for each protocol must have limitation but it also should has lower level action to deliver the larger than buffer in chain tasks , however it may has lag penalty for chain task
so @dogmaphobic you say if let the UDP to send my big data , it may loos it or cost me some delay and have no choose to change the low level function to match my exact delivery size
Gus Grubba
@dogmaphobic
May 13 2016 17:30
It’s not about the size. It’s how fast you feed it. Usually you would:
_udp.beginPacket(some_ip, some_port);
_udp.write(somedata, somedata.length);
_udp.endPacket();
If you write more than around 8k at a time and don’t check the amount actually written, those bytes will be lost. That’s data loss before it even got sent.
Clemens Kirchgatterer
@everslick
May 13 2016 17:35
i think there is still a bug pending for udp.endPacket(); not returning an error iwhen it discards the data. i have a delay(3); as a workaround in my code for that
Mehrdad K
@mkeyno
May 13 2016 17:36
how fast I can? is there any way to calculate delivery time ? also big file is exact proportional of the node numbers , and each node check exact amount of data that should has
Gus Grubba
@dogmaphobic
May 13 2016 17:37
i think there is still a bug pending for udp.endPacket(); not returning an error
Yes but udp.write() returns the amount that was actually written to the TX buffer. You can check that and see if it matches what you wrote.
Ideally, there should be a way to find out the amount of space availabla in the TX buffer before doing a write.
Actually, now that I see a comment from @igrr, I may have been looking in the wrong place. I do not know if the value returned by udp.write() is accurate or not.
Mehrdad K
@mkeyno
May 13 2016 17:42
actually I did it with my old cable router and Ethernet cable , I use the MEGA5560 and Ethernet shield for each node and deliver not big file to each node by UDP , however I decided to go to wireless level and replace the MEGA-Ethernet node to ESP
Me No Dev
@me-no-dev
May 13 2016 17:44
UDP has no guarantee of transmission, 1.5K is not ESP limitation, but rather the maximum size a network packet can be
if you mean to transmit more than 1460 bytes, you will most probably lose some
for reliable transmission there is TCP
also there is no guarantee that the UDP packets will be received in the proper order
Mehrdad K
@mkeyno
May 13 2016 17:46
so @me-no-dev what is your suggestion , can I do timing (less than 40ms) for TCP protocol
Me No Dev
@me-no-dev
May 13 2016 17:47
timing? you mean between packets or between transmission?
Mehrdad K
@mkeyno
May 13 2016 17:48
I should deliver sliced big file to my nodes less that 40ms,. how about websocket , because I need keep unidirectional link alive
Me No Dev
@me-no-dev
May 13 2016 17:48
you mentioned 150K packets
so 150K to all nodes in 40ms or less?
Mehrdad K
@mkeyno
May 13 2016 17:49
yes the big file like 150 to 250kb should sliced and delivered to designated note less than 40 ms
I do slicing in my processing program run on my laptop
Me No Dev
@me-no-dev
May 13 2016 17:50
those are 100-150 separate network packets
the ESP can not do that for the time you ask
Mehrdad K
@mkeyno
May 13 2016 17:50
and my laptop connected through wifi to the router modem
I think each ESP node should have share of data at most about 7kb
Me No Dev
@me-no-dev
May 13 2016 17:52
so each ESP is sending 7k to the computer?
and they all amount to 150k?
Mehrdad K
@mkeyno
May 13 2016 17:53
no ESP just receive in unidirectional way at most 7 kb from router
Me No Dev
@me-no-dev
May 13 2016 17:55
I think I got lost a bit... maybe you should better explaing what exactly is going on through the network
you have 150K on the PC that you "slice"
each ESP should get a slice?
Mehrdad K
@mkeyno
May 13 2016 17:57
yes
am I making it clear now
Me No Dev
@me-no-dev
May 13 2016 18:00
yes
Mehrdad K
@mkeyno
May 13 2016 18:00
my processing program slice the big data to this 7kb packages and add the specific IP to each of them and then send it to router , so router can deliver it designated ESP node
Me No Dev
@me-no-dev
May 13 2016 18:01
each ESP on it's own can handle 7K in 40ms
best option would be to have them already in connection with the computer
so you do not have to handshake every client
(in case of TCP)
also if you can further split those 7K into 1.5K packets and roundrobin the ESPs, the result will be more uniform and fast than sending 7K to ESP then 7K to the next
if you really want that data to get to the ESPs, UDP is not your friend
another thing... if you are not running Async, each client will wait untill you read those 7K to ACK them and letthe PC know that it got the data
which could cause retransmissions and other network nonsence
Mehrdad K
@mkeyno
May 13 2016 18:06
actually this 40 ms is related to 25 frame per second of the main image , I should slice this main image to specific parts and deliver it to ESP node so they can demonstrate it on LED strips , , I should synchronized this process in the way, all nodes show the image concurrently during this 40 ms
Me No Dev
@me-no-dev
May 13 2016 18:07
you are really trying to push those ESPs :) yes I figured you are making a large screen ;)
Mehrdad K
@mkeyno
May 13 2016 18:07
so timing and synchronization so important for me
Me No Dev
@me-no-dev
May 13 2016 18:08
maybe polling instead could be better
each ESP requesting it's own part of the image
that way If one fails, it will not screw the whole image
Mehrdad K
@mkeyno
May 13 2016 18:09
so you say conect those dozen of
ESP's to an access point
Me No Dev
@me-no-dev
May 13 2016 18:11
no, I'm saying to run a TCP server on your PC that will serve the chunks to the ESPs
so each ESP connects to the socket and asks for data
then each can tell which part it wants and get it
Mehrdad K
@mkeyno
May 13 2016 18:13
but they have no idea which part belong to them unless my processing program give the designated slice
Me No Dev
@me-no-dev
May 13 2016 18:13
you can get the client's IP on the computer if you want it that way
and give the chunk based on that
Mehrdad K
@mkeyno
May 13 2016 18:15
also I think there must be wifi-router so every one connected to , in case of large amount of ESP's my computer can't handles its networks traffic
This message was deleted
Me No Dev
@me-no-dev
May 13 2016 18:18
I did some simple math and 150K packets at 25 per second amounts to over 30Mbps
the count of ESPs on it's own can take your wifi down :)
the router thattey will connect to will be your bottleneck
and prolly processing itself
but I would love to see something like that done
Martin Ayotte
@martinayotte
May 13 2016 18:20
Maybe load could be spread across several routers ...
Me No Dev
@me-no-dev
May 13 2016 18:21
that is one way that can be tried
different channels also
Mehrdad K
@mkeyno
May 13 2016 18:21
why not
Me No Dev
@me-no-dev
May 13 2016 18:21
scaling up as you go can also give many answers
Mehrdad K
@mkeyno
May 13 2016 18:23
so I think need pyramid the routers goes to the ESP nodes
Me No Dev
@me-no-dev
May 13 2016 18:24
yeah the topology is also a good question
all but one routers should be in AP mode
star from a common switch might be the best
Mehrdad K
@mkeyno
May 13 2016 18:26
but I thought I could connected theoretically 255 ESP to each router and in each given time I have to deliver not more than the 7kb to each node
Clemens Kirchgatterer
@everslick
May 13 2016 18:26
Me No Dev
@me-no-dev
May 13 2016 18:26
they are 7k of payload though
your actuall throughput is a much different thing
you have wifi headers, ethernet headers, acks and whatnot that does not carry a payload
and most home routers are not at all capable of handling 255 wifi clients at once
Mehrdad K
@mkeyno
May 13 2016 18:28
I know but in practical I need at most 20 ESP nodes and wont be hard for simple router
Me No Dev
@me-no-dev
May 13 2016 18:28
no, but 30+Mbps to 20 nodes will be :)
Mehrdad K
@mkeyno
May 13 2016 18:29
my worry was how to sync them in proper time
also I thought router deliver each slice one by one , so no pressure on bandwidth at all
Me No Dev
@me-no-dev
May 13 2016 18:31
you will not need it if you are able to deliver quickly enough and have the current frame in the memory of the PC
what do you mean no pressure? you want to do 25 times by 150KB data
that is 30Mbps
constant :)
Mehrdad K
@mkeyno
May 13 2016 18:32
no 25 times by 150/25 data
Me No Dev
@me-no-dev
May 13 2016 18:33
each frame is 150K correct?
Mehrdad K
@mkeyno
May 13 2016 18:33
yes
Me No Dev
@me-no-dev
May 13 2016 18:34
so that is 30Mbps through the router (not to each ESP)
Mehrdad K
@mkeyno
May 13 2016 18:35
why 30Mbpes ? (150*8Kb=1.2Mbps)
Me No Dev
@me-no-dev
May 13 2016 18:36
  • 25?
1.2Mbps per ESP
30Mbps for all for a second
Mehrdad K
@mkeyno
May 13 2016 18:38
150kb divided on number of ESP, it's somethings around 7kb * 25(fps) = 1.75 MB per s
am I correct ?
Me No Dev
@me-no-dev
May 13 2016 18:38
sure
Mehrdad K
@mkeyno
May 13 2016 18:41
so I think the main problem is on which protocol deliver those parts and then sync them to demonstrate the actual image
how about the websocket
Me No Dev
@me-no-dev
May 13 2016 18:41
plain TCP will do best
no protocol overhead
Mehrdad K
@mkeyno
May 13 2016 18:46
so you say each ESP should do webserver role and in loop function check whether new client is available , then read data which is assembled in our format , no such browser header things included , just like transparent link
Me No Dev
@me-no-dev
May 13 2016 18:46
no web servers :)
a TCP server runniong on each ESP or a TCP server running on the computer
best on the computer and ESPs being clients
so each ESP connects to the compuer and either ask for the data or get it pushed from the server (computer)
Mehrdad K
@mkeyno
May 13 2016 18:51
dear @me-no-dev can you tell me which ESP library example is close to this idea
Me No Dev
@me-no-dev
May 13 2016 18:52
I do not think that there is anything "close" enough, but any Client example should work
Mehrdad K
@mkeyno
May 13 2016 18:55
ok , any way really appreciated for your time buddy , you are very helpful and let you know any progress on this idea
Me No Dev
@me-no-dev
May 13 2016 18:55
cool beans :) I hope it works!
Mehrdad K
@mkeyno
May 13 2016 18:56
and sorry if I bother anyone here with my boring talk
Me No Dev
@me-no-dev
May 13 2016 18:56
what res are you expecting to get?
Mehrdad K
@mkeyno
May 13 2016 18:58
as you guess wifi screen with magnificent library of FastLEd
recently Danial adapted his library for ESP
I have lot of fun with FastLED and arduino
Me No Dev
@me-no-dev
May 13 2016 19:01
cool but what is the resolution of the final screen?
how many pixels are you expecting to drive from each ESP?
Mehrdad K
@mkeyno
May 13 2016 19:03
about 1 2 meter for 144 pixel /m strip which make image frame about 12144144*3 byte
1x2x144x144x3
Me No Dev
@me-no-dev
May 13 2016 19:04
nice :)
Mehrdad K
@mkeyno
May 13 2016 19:05
around 120 kb
Stavros Korokithakis
@skorokithakis
May 13 2016 23:45
would anyone know why my serial port stops responding when i use wifimulti.run()?