These are chat archives for esp8266/Arduino

30th
Jun 2016
Stavros Korokithakis
@skorokithakis
Jun 30 2016 13:27
does anyone know what the footprint/form factor of the A6 GSM modem is? is it custom, or is it something i can get a breakout for?
or how else can i connect it to a breadboard?
Germán Martín
@gmag11
Jun 30 2016 13:41
@skorokithakis Inteligente Electrónica módulo GPRS GSM módulo A6 \ SMS \ Discurso \ placa \ placa de adaptador de transmisión de datos inalámbrica
http://s.aliexpress.com/qyQvuYF3
(from AliExpress Android)
I've bought one. Works fine.
Stavros Korokithakis
@skorokithakis
Jun 30 2016 13:42
@gmag11 ah yes, i saw that as well, but i was wondering if there's a board that will JUST give me the breadboard connections (so i can add the resistors etc myself later). i want to design a PCB with the A6 on it, so i want to prototype it
these boards already have capacitors and resistors, so i don't know the schematic there
Germán Martín
@gmag11
Jun 30 2016 13:45
You have chip information on Ai-thinker web site.
Stavros Korokithakis
@skorokithakis
Jun 30 2016 13:58
i'll read the datasheet again, thanks
Stavros Korokithakis
@skorokithakis
Jun 30 2016 13:59
@martinayotte yeah, i saw that too, but it doesn't say if it's a standard footprint or not
it gives dimensions, but i haven't been able to find a breakout pcb anywhere
Martin Ayotte
@martinayotte
Jun 30 2016 14:02
You means a KiCad lib ?
I don't find any
Stavros Korokithakis
@skorokithakis
Jun 30 2016 14:14
@martinayotte oh, thank you martin, that's very useful
let me download it all
i don't mean a kicad lib necessarily, i mean whether this is a standardized size, like TO-220, or QFP, or something like that
so i can order a ready-made breakout PCB for it for cheap
Martin Ayotte
@martinayotte
Jun 30 2016 14:21
No, I don't think you will find a perfectly matching adaptor, especially that there are pins around, not only on the sides.
Stavros Korokithakis
@skorokithakis
Jun 30 2016 14:28
hm, right :/
Martin Ayotte
@martinayotte
Jun 30 2016 14:34
You can take the layout and build you own adaptor, but you would have to wait the "slow-boat" for you PCB.
Stavros Korokithakis
@skorokithakis
Jun 30 2016 14:35
yeah, and it would be too expensive for a single adaptor :/
i wonder if i can solder wires on it... it's so small, though
Shelby Merrick
@forkineye
Jun 30 2016 14:37
SPIFFS question - If attempt to open a file and fail, can I use the same object and attempt to open the file again, creating it? For instance:
    /* Load CONFIG_FILE json, init with defaults if not found */
    File file = SPIFFS.open(CONFIG_FILE, "r");
    if (!file) {
        LOG_PORT.println(F("- No configuration file found."));

        file = SPIFFS.open(CONFIG_FILE, "w");
        if (!file) {
            LOG_PORT.println(F("*** Error creating configuration file ***"));
        } else {
            /* Generate new CONFIG_FILE */
            LOG_PORT.println(F("* Default configuration saved."));
        }
    } else {
        /* Parse CONFIG_FILE json */
    }
Mehrdad K
@mkeyno
Jun 30 2016 14:39
yes @forkineye I did that for file which is not exist and then create it
Shelby Merrick
@forkineye
Jun 30 2016 14:40
@mkeyno thanks!
Mehrdad K
@mkeyno
Jun 30 2016 14:40
but I suggest use w+ to be sure
Shelby Merrick
@forkineye
Jun 30 2016 14:40
rgr, will do
Stavros Korokithakis
@skorokithakis
Jun 30 2016 14:41
@martinayotte oh, there's an A6 connector schematic in your docs! that's fantastic
Ivan Grokhotkov
@igrr
Jun 30 2016 14:48
when you do File file = something(); and then file = something_else();, you are not reusing the same object. The object gets overwritten...
Actually File object is a reference-counted pointer to the actual object which implements file functions
so when you assign new File to the old variable, old object's reference count goes to zero and it gets deleted
And if you do File f1 = SPIFFS.open(...); and then File f2 = f1;, then both will use the same underlying implementation
and the file will be closed when both f1 and f2 go out of scope, or you call .close(); method on any of them
Me No Dev
@me-no-dev
Jun 30 2016 14:52
will the position increment in both f1 and f2 if you read from f1?
Ivan Grokhotkov
@igrr
Jun 30 2016 14:53
yes, File is a handle to the open file. similar to FILE in C standard library.
Mehrdad K
@mkeyno
Jun 30 2016 14:53
thanks @igrr for enlighten our mistake , speaking of SPIFF file object , do you know how fast we can read the specific file in the ESP flash
Ivan Grokhotkov
@igrr
Jun 30 2016 14:53
also similar to fstreams in C++ STL
You asked the same question couple of days ago and @SteveToulouse mentioned he got 2 Mbps read speed
Mehrdad K
@mkeyno
Jun 30 2016 14:56
yes , but I've got the problem to reading file and that's why aksing you again
also I open ticket for that , and no body yet look at it
Me No Dev
@me-no-dev
Jun 30 2016 14:56
@mkeyno did you try what I told you?
Mehrdad K
@mkeyno
Jun 30 2016 14:57
yes I did
but no success , my loop code so simple but never reach more than 400Kbyte per second
Me No Dev
@me-no-dev
Jun 30 2016 14:57
so you ended up with just the spiffs related code and it was still slow?
Mehrdad K
@mkeyno
Jun 30 2016 14:58
I was hopping you or Ivan could look at my code .
Me No Dev
@me-no-dev
Jun 30 2016 14:58
you pasted only fragments
Mehrdad K
@mkeyno
Jun 30 2016 14:58
yes , I disable the manipulated function and just read the file
no , it was all almost of it
Me No Dev
@me-no-dev
Jun 30 2016 15:00
have you tried installing the FSBrowser sketch and just download the file and see what speeds you get?
Mehrdad K
@mkeyno
Jun 30 2016 15:00
void loop() {



 if(!SHOW) server.handleClient();  
  webSocket.loop();

  if(SHOW)
      {
        if( (millis()- OpenlastTime) > DURATION[image_index]*1000L )
        {
          FILe.close();
          image_index++; 
          if(image_index>IMAGE_NUM)    image_index=0;

           FILe=SPIFFS.open("/SHOW/"+IMAGES[image_index], "r");
          if(!FILe) Serial.println("FILE NOT OPEN");
          OpenlastTime=millis();
          Current_imageLine = 0;
        }
        if((micros()-lastLineShow)> lineInterval)
        {
        int i = 0; 
           while( (i < NUM_LEDS*3) && FILe.available())
          { 
               i += FILe.readBytes( ((char*)leds) + i, (NUM_LEDS*3)-i);
            }

        FastLED.show(); 
        lastLineShow=micros();
               Current_imageLine++;                                        
        }
       {read_line(Current_imageLine++,image_index); FastLED.show(); lastLineShow=micros(); }
          if(Current_imageLine >= IMAGES_LINES)   
          { 
            Serial.print("[frame]"); Serial.println((micros()-lastFrameShow));
            Current_imageLine = 0;
            lastFrameShow=micros(); 
            Start_new_round=false; 
            FILe.seek(0, SeekSet);

           } 

      }

}
but FSBrowser sketch is not what I'm looking for , caz I need read file in the loop
Shelby Merrick
@forkineye
Jun 30 2016 15:02
ah, thanks @igrr !
Mehrdad K
@mkeyno
Jun 30 2016 15:05
@igrr and @me-no-dev may I have your ideas about that
Me No Dev
@me-no-dev
Jun 30 2016 15:05
@mkeyno code seem fine to me
what is the time you measure? the time in the while loop?
Ivan Grokhotkov
@igrr
Jun 30 2016 15:05
doesn't compile for me, SHOW not delared, server not declared, etc.
please do us a favour and upload complete code somewhere
also it is not clear from this code how much FastLED.show(); is going to take
Mehrdad K
@mkeyno
Jun 30 2016 15:06
ok , you can just ignor bool SHOW and sever is just instance of ESP8266WebServer server(80);
Ivan Grokhotkov
@igrr
Jun 30 2016 15:07
also webSocket, FILe
you ask me to help you with your code but you don't give me a way to reproduce what you are seeing.
Mehrdad K
@mkeyno
Jun 30 2016 15:08
I don't know but this library use software SPI about 24Mhz , it is the fastes repo for show LED chip like ws2812
I'm so sorry for that but FIle is the File FILe; and websocket also instance of Markus repo WebSocketsServer webSocket = WebSocketsServer(81);
one of my problem is ,how can I trace such issue , we only have millis() and micros() function
Ivan Grokhotkov
@igrr
Jun 30 2016 15:10
and then you have the code to open the file somewhere, which i also need to guess..
Mehrdad K
@mkeyno
Jun 30 2016 15:11
it could be any file , my file about 75Kbyte
Ivan Grokhotkov
@igrr
Jun 30 2016 15:11
another option is to bang some GPIOs at certain points in code and then see the timings by connecting these gpios to a logic analyzer
Mehrdad K
@mkeyno
Jun 30 2016 15:13
do we have any faster function to read file , or f.open() is fast enough
is interrupt enable during the reading ?
Ivan Grokhotkov
@igrr
Jun 30 2016 15:15
you can use File::readBytes or File::read which work equally fast
yes, interrupts are enabled
Mehrdad K
@mkeyno
Jun 30 2016 15:16
so maybe loss time during using resource by other function
is it safe I disable the interrupt and enable it after reading
Ivan Grokhotkov
@igrr
Jun 30 2016 15:17
no it is not safe.
Mehrdad K
@mkeyno
Jun 30 2016 15:18
I did it with teensy with no problem and same code , I don't know why ESP can't handle it
maybe due to teensy DMA feature
does ESP has same feature ?
Ivan Grokhotkov
@igrr
Jun 30 2016 15:19
ESP8266 has DMA on I2S peripheral, but not on flash interface.
as mentioned above, others have achieved 2Mbps.
Mehrdad K
@mkeyno
Jun 30 2016 15:21
so what would be your suggestion Ivan
2Mbps also come from simple program whereas my code consist manipulation functions
Me No Dev
@me-no-dev
Jun 30 2016 15:23
2Mbps is nothing ;) I have gone up to 1MBps over web server
I didn't believe it myself...
Ivan Grokhotkov
@igrr
Jun 30 2016 15:23
mmm, i think it was 2 megabyte per second
sorry i was clumsy with my caps
why is it hard to believe in 1 mbyte/s network bandwidth? if you have a low latency connection, then it's perfectly possible :)
Me No Dev
@me-no-dev
Jun 30 2016 15:25
did not believe that the ESP can do it.. :D
reading a file from it's file system
Mehrdad K
@mkeyno
Jun 30 2016 15:27
@me-no-dev Ivan says the fast rich DMA feature occupied by I2S and also interrupt enable for other resources
Ivan Grokhotkov
@igrr
Jun 30 2016 15:28
sorry, i don't follow... interrupts are enabled, yes, but unless you use them, they don't occupy any resources.
SteveToulouse
@SteveToulouse
Jun 30 2016 15:28

Hi all, sorry for missing th fun. I got 2MByte/s on a series of large-buffer (16KB) reads in a big (2MByte) SPIFFS file.

I tried smaller reads (like mkeyno's - 3*144 Bytes) in smaller file (75KBytes) and only managed 800KByte/s.

Ivan Grokhotkov
@igrr
Jun 30 2016 15:28
Yep, you should certainly read as much as possible, up to 4k block size.
Also the file should not be fragmented.
Mehrdad K
@mkeyno
Jun 30 2016 15:29
each image consist of 300 line 144 pixel 3 byte (about 127 Kbyte)
SteveToulouse
@SteveToulouse
Jun 30 2016 15:29
I think mkeyno could get closer to 1MByte/s if he reads several of his LED lines in one read operation
but I didn't get a chance to try simulate that
Mehrdad K
@mkeyno
Jun 30 2016 15:31
@SteveToulouse you mean buffer it couple of lines in each read file.readBytes()
SteveToulouse
@SteveToulouse
Jun 30 2016 15:31
yes. as many as possible
the only way to go faster (if that's even possible) would be to read the flash directly yourself, over the SPI interface. Never tried, maybe I'm just being stupid :-)
Mehrdad K
@mkeyno
Jun 30 2016 15:33
should timing be problem ? cause I also should look at when my buffer goes zero and
SteveToulouse
@SteveToulouse
Jun 30 2016 15:34
but I would have thought one could get 5MBytes/s on your 20MHz SPI (Dual IO) interface.
Mehrdad K
@mkeyno
Jun 30 2016 15:35
is it possible to interfere the hardware SPI
SteveToulouse
@SteveToulouse
Jun 30 2016 15:35
I can't think of anything else. Give it a try reading many lines at one time (depending on how much RAM you have available)
Mehrdad K
@mkeyno
Jun 30 2016 15:37
@SteveToulouse would you please try your idea and let us know your result , I don't fully understand how to implement it
I open ticket here esp8266/Arduino#2202
also as Ivan said we could read as 4k as possible read line?
Ivan Grokhotkov
@igrr
Jun 30 2016 15:40
@mkeyno it's not hard, you should try it...
Mehrdad K
@mkeyno
Jun 30 2016 15:41
sure Ivan , but also any help from you folks really appreciated
also can you please post your suggestion in that ticket esp8266/Arduino#2202
Ivan Grokhotkov
@igrr
Jun 30 2016 15:46
once you actually post your full code :)
Me No Dev
@me-no-dev
Jun 30 2016 15:46
and a file sample
Mehrdad K
@mkeyno
Jun 30 2016 15:47
file sample would any bulk file as size of 70Kbyte or more
Ivan Grokhotkov
@igrr
Jun 30 2016 15:47
right
Mehrdad K
@mkeyno
Jun 30 2016 15:48
the folw chart is so simple read line of image put the RGB data in pixel and then fire it
Me No Dev
@me-no-dev
Jun 30 2016 15:49
still we would like to run your exact code. Issues can ba anywhere and there is no better way to diag than run the same sketch
read the same file and so on
Ivan Grokhotkov
@igrr
Jun 30 2016 15:50
you aren't making it easy to help you, that's all I can say.
it's basically a 2 minute job to pack sketch directory into a zip and upload it. that's all. sorry, i'm pissed off and i'll go do something actually useful.
Mehrdad K
@mkeyno
Jun 30 2016 15:50
ok , I'm gonna past it on ticket now
Mehrdad K
@mkeyno
Jun 30 2016 16:18
@igrr @me-no-dev @SteveToulouse I upload the sketch on the ticket
really appreciate if could spare time and look at it
SteveToulouse
@SteveToulouse
Jun 30 2016 17:28
I'll take a look later tonight. In the meantime I built a small sketch to simulate something like I understood from your initial posts
This message was deleted
Mehrdad K
@mkeyno
Jun 30 2016 17:29
thanks @SteveToulouse ,
SteveToulouse
@SteveToulouse
Jun 30 2016 17:30
With a full screen in the file = 3 144 300 Bytes
Mehrdad K
@mkeyno
Jun 30 2016 17:31
about 3 Mbyte
SteveToulouse
@SteveToulouse
Jun 30 2016 17:31

I got:
Total time 168 msecs i.e 6fps
Data read 129600 bytes
Processing speed 771428 read bytes/sec

The LED write time was simulated as 50 microsecondes.

The reads from SPIFFS were 15 lines at a time, not aligned on 4K boundaries.
Mehrdad K
@mkeyno
Jun 30 2016 17:33
so long , must not far from 40 ms
SteveToulouse
@SteveToulouse
Jun 30 2016 17:33
OOps ! Full screen is 3 times 144 times 300 = 129 600 Bytes
I'll try your real code later
Mehrdad K
@mkeyno
Jun 30 2016 17:35
thanks Steve
SteveToulouse
@SteveToulouse
Jun 30 2016 17:35
And I'll check for fragmentation etc. to be suure of what I'm measuring :-P
Bye for now
Mehrdad K
@mkeyno
Jun 30 2016 17:36
can you post code in your github page
SteveToulouse
@SteveToulouse
Jun 30 2016 17:36
I'll do that later too
Mehrdad K
@mkeyno
Jun 30 2016 17:36
take care buddy
SteveToulouse
@SteveToulouse
Jun 30 2016 17:36
cheers!
sticilface
@sticilface
Jun 30 2016 18:08
This message was deleted
This message was deleted
SteveToulouse
@SteveToulouse
Jun 30 2016 21:27
Unforseen stuff to do, sorry. Here's the little test rig
SteveToulouse
@SteveToulouse
Jun 30 2016 21:36
for @mkeyno/issue #2202 that is
Mehrdad K
@mkeyno
Jun 30 2016 21:38
hi @SteveToulouse , have you run the code
SteveToulouse
@SteveToulouse
Jun 30 2016 21:40
Haven't had a chance to run yours, sorry.
Mine still gives around 6fps when I put a 50 microsecond wait to simulate writing to one line of LEDs
Must go zzzzzz now. Have to be up at 4am ugh!
Mehrdad K
@mkeyno
Jun 30 2016 21:43
ok , tnx anyway
Marco Mengoli
@MarcoMengoli
Jun 30 2016 23:30
@Hassanbenlebsir how did you manage to connect the RC522 to ESP8266? works on my Arduino Uno but can't get it work on ESP8266. It simply happens nothing.