These are chat archives for esp8266/Arduino

3rd
May 2015
ficeto
@ficeto
May 03 2015 12:23
@igrr you mind if I just translate all register calls in the HardwareSerial to the new definitions? will not touch anything else, and will make it more readable I believe
Ivan Grokhotkov
@igrr
May 03 2015 12:24
okay, I don't mind. I never got used to the original register names anyway
ficeto
@ficeto
May 03 2015 12:24
same reason... :)
Ivan Grokhotkov
@igrr
May 03 2015 12:25
btw I failed to reproduce the ASCIITable issue again. if I ever do, I'll dump the flash and check if it was written correctly
ficeto
@ficeto
May 03 2015 12:26
I'll try later to upload an old firmware I have through the old method I used (custom Makefile) and see if that does anything to "help"
because that is what I had loaded before
Ivan Grokhotkov
@igrr
May 03 2015 12:27
I started writing the bootloader with sketch upload function. I think I can fit into 50 sectors which would make enough room for the sketch
duplicating the necessary libraries
ficeto
@ficeto
May 03 2015 12:27
you want to do it http?
Ivan Grokhotkov
@igrr
May 03 2015 12:28
http server at first, yes
ficeto
@ficeto
May 03 2015 12:29
if you do it socket+mdns, we can make it appear like ArduinoYun does and make such uploader
Ivan Grokhotkov
@igrr
May 03 2015 12:29
with dns-sd so that the ide can find the board on the local network
ficeto
@ficeto
May 03 2015 12:29
that might be aster and smaller
Ivan Grokhotkov
@igrr
May 03 2015 12:29
unfortunately arduino uses ssh for yun
ficeto
@ficeto
May 03 2015 12:29
would not need to parse HTTP post data which is a bitch
yeah, but not a big deal to do it socket
I'm am pretty comfrtable with Java as well
best would be to be in ck-esptool
I can give you my work on the Adruino uploader
you can see how I parse the multypacket binary files
and I parse two files actually (firmware and eeprom)
which is just like the two bins for the esp
Ivan Grokhotkov
@igrr
May 03 2015 12:38
okay, that would be great
I thought I would use http so that the Authentication header would carry the HMAC signature
which would allow for password-protected uploads later
ficeto
@ficeto
May 03 2015 12:42
I see nothing wront in trying bith ways :)
maybe even figure out how to support both at the same time
just like the Arduino does
do you guys know which bit enables the UART1 swap
I see bit 2 is UART0
Ivan Grokhotkov
@igrr
May 03 2015 12:47
where does uart1 TX go after swap?
ficeto
@ficeto
May 03 2015 12:48
well pins 6 and 11 for UART1 are like 13 and 15 for UART0
so I imagine something like that
obviously it would not work
because we need those for the FLASH
Ivan Grokhotkov
@igrr
May 03 2015 12:49
yeah, 6 is flash
ficeto
@ficeto
May 03 2015 12:50
do we use 11?
because 11 would become TX
that is SPI1CS0
it's not broken out on my module
Ivan Grokhotkov
@igrr
May 03 2015 12:52
11 is flash as well iirc, at least I didn't map it in the older version of wiring code
ficeto
@ficeto
May 03 2015 12:54
yes, just looked at a scematic I have
ficeto
@ficeto
May 03 2015 13:45
here is the new UART ficeto/Arduino@58c03c3
ficeto
@ficeto
May 03 2015 13:55
I found that source that I talked about
I was actuallt uploading HEX files, which are strings, but should e the same
how can I share that with you now?
server.h
#ifndef HTTP_SERVER_H
#define HTTP_SERVER_H

#include "espino.h"

enum {
    SERVER_IDLE = 0,
    INTO_RX,
    INTO_POST,
    INTO_TX,
};

enum {
    POST_INIT = 0,
    POST_LENGTH,
    POST_BOUNDARY,
    POST_STARTED,
    POST_PROCESSING,
    POST_FILES,
    POST_FLASH,
    POST_EEPROM,
    POST_DONE
};

struct http_post_data {
    uint8_t status;
    uint32_t content_length;
    uint32_t parsed_length;
    uint32_t flash_size;
    uint32_t eeprom_size;
    uint8_t erase;
    uint8_t low_fuse;
    uint8_t high_fuse;
    uint8_t ext_fuse;
    uint8_t lock_fuse;

    char boundary[64];
    char model[16];
    char flash[64];
    char eeprom[64];
};

struct http_post_data current_post;
void createHttpServer();


#endif
Ivan Grokhotkov
@igrr
May 03 2015 13:59
zip it up and send me: ivan at esp8266 com
ficeto
@ficeto
May 03 2015 14:00
done
ficeto
@ficeto
May 03 2015 14:14
a quick question.... the actuall flashing method is really writing bytes at specific FASH addresses reight?
you are no longer enabling a pullup on RXD right?
ficeto
@ficeto
May 03 2015 14:14
right
not needed
Ivan Grokhotkov
@igrr
May 03 2015 14:14
it's enabled automatically?
ficeto
@ficeto
May 03 2015 14:15
yes, once it's in UART mode, it no longer matters
Ivan Grokhotkov
@igrr
May 03 2015 14:15
ok
yes, flashing is erasing sectors and then writing them
ficeto
@ficeto
May 03 2015 14:15
but...
maybe should leave it enabled to filter external noise if left floating
for flashing:
so an easy api can be made like
[R/W][ADDR]{DATA][CSUM]
Ivan Grokhotkov
@igrr
May 03 2015 14:19
addr will likely be fixed
we can use HMAC for a checksum as well
ficeto
@ficeto
May 03 2015 14:19
if so, replace with LEN
Ivan Grokhotkov
@igrr
May 03 2015 14:20
aside from authentication
yes, need length
ficeto
@ficeto
May 03 2015 14:21
the other thing with using socket communication is that you can always have current status of the operation
POST on the other side dumps it all and waits for end result
unless there is a way to push headers only for update?
Ivan Grokhotkov
@igrr
May 03 2015 14:23
well we can either have a different endpoint for status, or have the server send the client some status updates
ficeto
@ficeto
May 03 2015 14:24
not sure how will all that coop with the MCU though
might become too much work
each TCP packet on it's own has 56 bytes overhead
then add the HTTP headers overhead
Ivan Grokhotkov
@igrr
May 03 2015 14:28
looks like we need to add back the twi_* functions
ficeto
@ficeto
May 03 2015 14:28
they are there
need to rename the files only
si2c -> twi
lemme fix that PULLUP issue and will commit both
like twi_setClock and others
maybe keep the function names and just add aliases
so much for renaming stuff
ficeto
@ficeto
May 03 2015 14:32
maybe he is using some intermittent commit?
#ifndef SI2C_h
#define SI2C_h
#include "Arduino.h"

void twi_init(uint8_t sda, uint8_t scl);
void twi_stop(void);
void twi_setClock(uint32_t freq);
uint8_t twi_writeTo(uint8_t address, uint8_t * buf, uint32_t len, uint8_t sendStop);
uint8_t twi_readFrom(uint8_t address, uint8_t * buf, uint32_t len, uint8_t sendStop);

#endif
Ivan Grokhotkov
@igrr
May 03 2015 14:33
L/var/folders/15/ybtbgzpj7636vv4wp92l2c700000gn/T/build5050457091355091536.tmp 
/var/folders/15/ybtbgzpj7636vv4wp92l2c700000gn/T/build5050457091355091536.tmp/Wire/Wire.cpp.o: In function `TwoWire::write(unsigned char)':
Wire.cpp:(.text+0x130): undefined reference to `twi_init(unsigned char, unsigned char)'
Wire.cpp:(.text+0x143): undefined reference to `twi_init(unsigned char, unsigned char)'
/var/folders/15/ybtbgzpj7636vv4wp92l2c700000gn/T/build5050457091355091536.tmp/Wire/Wire.cpp.o: In function `TwoWire::begin()':
Wire.cpp:(.text+0x190): undefined reference to `twi_setClock(unsigned int)'
/var/folders/15/ybtbgzpj7636vv4wp92l2c700000gn/T/build5050457091355091536.tmp/Wire/Wire.cpp.o: In function `TwoWire::begin(unsigned char)':
Wire.cpp:(.text+0x19b): undefined reference to `twi_setClock(unsigned int)'
/var/folders/15/ybtbgzpj7636vv4wp92l2c700000gn/T/build5050457091355091536.tmp/Wire/Wire.cpp.o: In function `TwoWire::begin(int)':
Wire.cpp:(.text+0x1a8): undefined reference to `twi_readFrom(unsigned char, unsigned char*, unsigned int, unsigned char)'
/var/folders/15/ybtbgzpj7636vv4wp92l2c700000gn/T/build5050457091355091536.tmp/Wire/Wire.cpp.o: In function `TwoWire::setClock(unsigned int)':
Wire.cpp:(.text+0x1ca): undefined reference to `twi_readFrom(unsigned char, unsigned char*, unsigned int, unsigned char)'
/var/folders/15/ybtbgzpj7636vv4wp92l2c700000gn/T/build5050457091355091536.tmp/Wire/Wire.cpp.o: In function `TwoWire::requestFrom(int, int, int)':
Wire.cpp:(.text+0x29c): undefined reference to `twi_writeTo(unsigned char, unsigned char*, unsigned int, unsigned char)'
/var/folders/15/ybtbgzpj7636vv4wp92l2c700000gn/T/build5050457091355091536.tmp/Wire/Wire.cpp.o: In function `TwoWire::beginTransmission(unsigned char)':
Wire.cpp:(.text+0x2ba): undefined reference to `twi_writeTo(unsigned char, unsigned char*, unsigned int, unsigned char)'
collect2: error: ld returned 1 exit status
Error compiling.
this is what i get
ficeto
@ficeto
May 03 2015 14:33
pfff that easy shit
and actually is SHIT
because unsigned long refuses to match to uint32_t
same goes for unsigned char
will fix in a sec
Ivan Grokhotkov
@igrr
May 03 2015 14:37
we also need to rename si2c.c to core_esp8266_si2c.c
because linker scripts moves everything from core_esp8266_* to the .irom0.text segment
and then perhaps inline some of the functions...
will take a look at that later
Ivan Grokhotkov
@igrr
May 03 2015 14:42
hehe no uint32_t matches unsigned long, its not the problem :)
the functions in si2c.c are C functions
and si2c.h is included into Wire.cpp, making declarations appear in C++ code
so the linker won't find the definitions
extern "C" {
  #include <stdlib.h>
  #include <string.h>
  #include <inttypes.h>
  #include "si2c.h"
}
need to move si2c.h to the extern "C" section
ah, wait, si2c.h pulls arduino.h
ficeto
@ficeto
May 03 2015 14:46
lemm check what I did just now
changed all mentioned so far, so let me get it a go
what didi you say fails?
Ivan Grokhotkov
@igrr
May 03 2015 14:47
SFRRanger_reader from examples
Markus
@Links2004
May 03 2015 14:47
#ifndef SI2C_h
#define SI2C_h
#include "Arduino.h"

#ifdef __cplusplus
extern "C" {
#endif
void twi_init(uint8_t sda, uint8_t scl);
void twi_stop(void);
void twi_setClock(uint32_t freq);
uint8_t twi_writeTo(uint8_t address, uint8_t * buf, uint32_t len, uint8_t sendStop);
uint8_t twi_readFrom(uint8_t address, uint8_t * buf, uint32_t len, uint8_t sendStop);
#ifdef __cplusplus
}
#endif
#endif
Ivan Grokhotkov
@igrr
May 03 2015 14:48
yeah like this
i wish espressif headers had c++ guards...
Markus
@Links2004
May 03 2015 14:51
si2c.c has a problem at 160Mhz
ficeto
@ficeto
May 03 2015 14:51
ficeto/Arduino@2e3e98b
what is the problem?
Markus
@Links2004
May 03 2015 14:51
#define TWI_CLOCK_STRETCH 400 but counter is uint8_t i;
ficeto
@ficeto
May 03 2015 14:51
too fast? too slow?
ahhh
:D
Ivan Grokhotkov
@igrr
May 03 2015 14:53
so changing uint32_t and uint8_t to unsigned int and unsigned char wasn't really necessary, right? ;)
ficeto
@ficeto
May 03 2015 14:53
ficeto/Arduino@346ae20
i had this fail on me on another occasion
can not remember on which class/method
but had to replace uint32_t with unsigned long not to get errors
I think it was my UART rewrite for the BAUD
Markus
@Links2004
May 03 2015 14:55
do you include stdint.h ?
ficeto
@ficeto
May 03 2015 14:56
I believe so
it did not say that it can not find what either is
Ivan Grokhotkov
@igrr
May 03 2015 14:57
size_t = unsigned long != unsigned int = uint32_t
in terms of conversions
ficeto
@ficeto
May 03 2015 14:58
so what is unsigned long then?
uint64_t?
Ivan Grokhotkov
@igrr
May 03 2015 14:58
no, it's 32 bit
the size is the same, but the types are not
Markus
@Links2004
May 03 2015 14:59
no typedef unsigned long long uint64_t;
Ivan Grokhotkov
@igrr
May 03 2015 14:59
size_t can be 64 bit on a 64-bit arch, but here it is 32-bit
ficeto
@ficeto
May 03 2015 15:03
pin_functions.png
a nice pin chart if you want to add it to readme or wiki
Ivan Grokhotkov
@igrr
May 03 2015 15:06
it's the Espressif's gpio xls file right?
have it somewhere
ficeto
@ficeto
May 03 2015 15:09
ok... all neede changes for I2C are in my fork
just ran a couple of tests... should be good
si2c.h -> twi.h
si2c.c -> core_esp8266_si2c.c
yes, it's the xls with some colors :) colors always help
Ivan Grokhotkov
@igrr
May 03 2015 15:13
can you try the i2c scanner sketch with the latest changes? http://playground.arduino.cc/Main/I2cScanner
and some i2c device connected, that is)
Markus
@Links2004
May 03 2015 15:21
ok bad `.irom0.text' will not fit in region `irom0_0_seg' with the latest commit in one of my projects. will try to change the ld file to get the unused 200kb to in the 512K flash to work
Ivan Grokhotkov
@igrr
May 03 2015 15:23
@Links2004 if you move irom0, mind the EEPROM library, it has #define CONFIG_START_SECTOR 0x3C
Markus
@Links2004
May 03 2015 15:25
infect the free space is before 0x00000 - 0x3E000 is for user app but infact the linker script only use 32k of it but the space is 248k.
room for some optimations :) may i also split the user code from the SDK libs need some test for find the best solution
Ivan Grokhotkov
@igrr
May 03 2015 15:28
move irom0 to 0x10000
and CONFIG_START_SECTOR somewhere near the end of flash, like 0x7b
i'm writing a wifi-enabled bootloader now, so the memory layout will change again in a few days :)
Markus
@Links2004
May 03 2015 15:30
move to the end is a bad idee i think if we support want to support flash chips > 512kb
Ivan Grokhotkov
@igrr
May 03 2015 15:30
why exactly is this a bad idea?
Markus
@Links2004
May 03 2015 15:30
based of what protocol ? tftp, http
then we need to move it again
Ivan Grokhotkov
@igrr
May 03 2015 15:31
at 0x7c000 and 0x7d000 we have two sectors from SDK libs i think
so we can use another one at 0x7b000 for the EEPROM lib
based on http
the are 8k big so no space
Ivan Grokhotkov
@igrr
May 03 2015 15:35
7c000-7dfff — taken
7e000-7ffff — taken
so we use 7b000-7bfff
any issues with that?
Markus
@Links2004
May 03 2015 15:35
no :) i will change it
Markus
@Links2004
May 03 2015 15:45
Links2004/Arduino@5d2cc7d
Ivan Grokhotkov
@igrr
May 03 2015 15:48
need to check that erasing 0x6b sectors starting at 0x10000 doesn't wipe the sector at 0x7b000
because the workaround in esptool is only approximate...
it may still wipe a bit more than necessary
ficeto
@ficeto
May 03 2015 16:01
hm... twi library is working fine
i have a beautifull output on my digi scope
but as soon as device is conneted something is not enough
maybe external pullup...
freq is set to 100KHz and in reality outputs at 90KHz which is fine
Markus
@Links2004
May 03 2015 16:03
normal the internal one of uC are around 50k - 80k so too high for i2c
ficeto
@ficeto
May 03 2015 16:04
i thought I had some on the module, since I had it tested with this exact RTC
Markus
@Links2004
May 03 2015 16:07
EEPROM tested, not deleted during flash or reboot
Markus
@Links2004
May 03 2015 16:32
why the pinMode change is in the contractor in OneWire::OneWire? from my point of view this is a bad idea.
ficeto
@ficeto
May 03 2015 16:33
?
the contractor is called before all the init stuff
ficeto
@ficeto
May 03 2015 16:35
where do you think it should be?
Markus
@Links2004
May 03 2015 16:35
even before user_init()
ficeto
@ficeto
May 03 2015 16:36
does it have begin or init method?
Markus
@Links2004
May 03 2015 16:36
i complete miss the begin function so that it can be called in setup like for all other classes
ficeto
@ficeto
May 03 2015 16:36
should be there
ficeto
@ficeto
May 03 2015 17:09
@igrr I need to reread some specs
since I added the i2c errors, i notice on active module I get nack on sending address
ficeto
@ficeto
May 03 2015 17:32
now that was a stupid mistake...
ficeto/Arduino@d18dd0d
ficeto
@ficeto
May 03 2015 17:37
scanner is working as it should now
no external pullups needed
ficeto
@ficeto
May 03 2015 17:49
so either F_CPU does not make my ESP run on 160MHz, or the UART Clock is always divided by 80MHz
uploading with set 160MHz doubles the UART bandwith
ficeto
@ficeto
May 03 2015 18:08
Just measured the SCL frequencies at both 80 and 160 MHZ and everything is as acurate as it can be
Ivan Grokhotkov
@igrr
May 03 2015 18:56
no constructors are called from user_init, please check the main
we do it manually
Markus
@Links2004
May 03 2015 19:38
i only know this problems from other devices like arm cortex
OneWire oneWire(13); // when this contractor is executed on ESP8266

void setup(void) {

} 

void loop(void) {

}
on arm it is called before the main or anything else
when i interpreter this knowledge for the ESP8266 it will be before user_init() (if i am wrong please show my when its called)
Ivan Grokhotkov
@igrr
May 03 2015 19:42
static void do_global_ctors(void)
in core_esp8266_main.cpp
Markus
@Links2004
May 03 2015 19:44
a ok now i get it, then we have no problem its after the pin init an so one. i had dis kind of problem in other projects :)
ficeto
@ficeto
May 03 2015 19:45
guys I need some help here
Markus
@Links2004
May 03 2015 19:45
where is the problem?
ficeto
@ficeto
May 03 2015 19:45
i pretty much got a SDCard server going
but...
if I read the contents of a text file into string and server.send that it's great
but can not stream the content with client.write
it sends some part of it (always different) then hangs
so small text files are not issue, but images and larger files...
cant client.print(image)
here is what I'm currenty trying:
void handleNotFound(){
  digitalWrite(led, 1);
  if(hasSD){
    File dataFile = SD.open(server.uri().c_str());
    if (dataFile) {
      WiFiClient client = server.client();

      String dataType = "text/plain";
      if(server.uri().endsWith(".htm")) dataType = "text/html";
      else if(server.uri().endsWith(".css")) dataType = "text/css";
      else if(server.uri().endsWith(".js")) dataType = "application/javascript";
      else if(server.uri().endsWith(".png")) dataType = "image/png";
      else if(server.uri().endsWith(".gif")) dataType = "image/gif";
      else if(server.uri().endsWith(".jpg")) dataType = "image/jpeg";

      client.print("HTTP/1.1 200 OK\r\nContent-Type: ");
      client.print(dataType);
      client.print("\r\n");
      if(dataType == "image/png" || dataType == "image/jpeg" || dataType == "image/gif"){
        client.print("Content-Length: ");
        client.print(dataFile.size(), DEC);
        client.print("\r\n\r\n");
        while (dataFile.available()){
          client.write(dataFile.read());
        }
        dataFile.close();
      } else {
        client.print("\r\n");
        while (dataFile.available()){
          client.print((char)dataFile.read());
        }
        dataFile.close();
      }
      return;
    }
  } else {
    Serial1.println("NO SDCARD");
  }

  String message = "File Not Found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET)?"GET":"POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i=0; i<server.args(); i++){
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
  digitalWrite(led, 0);
}
Markus
@Links2004
May 03 2015 19:48
the tcp part does not like small passages many small eave 1 byte slows it down drastic.
is the ESP8266 hanging or only the browser is stopping?
ficeto
@ficeto
May 03 2015 19:49
that is true if each client.write sends a packet
is that the case?
Markus
@Links2004
May 03 2015 19:49
yes each write sends one tcp page
ficeto
@ficeto
May 03 2015 19:49
browser waits a bit more for data then ends(touts)
that is shit...
so how to do this?
Markus
@Links2004
May 03 2015 19:50
may build a small buffer ~1k
read 1k from sd then send it and so one
mtu is typical at 1500Byte so more make no sens for local network DSL around 1450
ficeto
@ficeto
May 03 2015 19:53
will give it a shot
client.write(buf, len) is there ight?
Markus
@Links2004
May 03 2015 19:54
yes
ficeto
@ficeto
May 03 2015 20:02
it almost works....
image is 117KB
loads differently (75K, 103K..) then the ESP hangs
Markus
@Links2004
May 03 2015 20:03
can you add a Ticker to see if its a full freeze or only the loop has freeze
ficeto
@ficeto
May 03 2015 20:04
the HTTP server no loger responds
Markus
@Links2004
May 03 2015 20:05
yes its single task, but the question is if the SDK part also stopped
ficeto
@ficeto
May 03 2015 20:06
no I keep getting "LmacRxBlk:1" in debug output
Markus
@Links2004
May 03 2015 20:07
ok bad, have seen this bug too in other cases but it was fixed in my case, try to find it....
esp8266/Arduino#50 this is one part of it
but for the deeper functions of tcp @igrr has more know how
Ivan Grokhotkov
@igrr
May 03 2015 20:14
this usually means that you are not reading some of the received data
but perhaps happens in other cases as well
ficeto
@ficeto
May 03 2015 20:19
I added a few "while(client.available()) client.read();"
to no help
and what is really shitty is that the amount of data transfered is not constant
just did 84K
did 33 before that
Ivan Grokhotkov
@igrr
May 03 2015 20:21
what is this minimal amount we need to transfer to trigger this?
around 100k I guess
ficeto
@ficeto
May 03 2015 20:23
yes
I used the pin function table I posted here
here is the actuall sender:
File dataFile = SD.open(server.uri().c_str());
    if (dataFile) {
      WiFiClient client = server.client();

      String dataType = "text/plain";
      if(server.uri().endsWith(".htm")) dataType = "text/html";
      else if(server.uri().endsWith(".css")) dataType = "text/css";
      else if(server.uri().endsWith(".js")) dataType = "application/javascript";
      else if(server.uri().endsWith(".png")) dataType = "image/png";
      else if(server.uri().endsWith(".gif")) dataType = "image/gif";
      else if(server.uri().endsWith(".jpg")) dataType = "image/jpeg";

      String head = "HTTP/1.1 200 OK\r\nContent-Type: ";
      head += dataType;
      head += "\r\nContent-Length: ";
      head += dataFile.size();
      head += "\r\n\r\n";
      client.print(head);

      while(client.available()) client.read();

      #define WWW_BUF_SIZE 1450     
      uint8_t obuf[WWW_BUF_SIZE];
      uint16_t i = 0;
      while (dataFile.available() > WWW_BUF_SIZE){
        for(i = 0; i < WWW_BUF_SIZE; i++) obuf[i] = dataFile.read();
        client.write(obuf, WWW_BUF_SIZE);
        while(client.available()) client.read();
      }


      uint16_t leftLen = dataFile.available();
      for(i = 0; i < leftLen; i++) obuf[i] = dataFile.read();
      client.write(obuf, leftLen);
      while(client.available()) client.read();

      dataFile.close();
      return;
    }
ficeto
@ficeto
May 03 2015 20:32
and I just had it load the full file... so this is really random thing
Ivan Grokhotkov
@igrr
May 03 2015 20:33
1450 is close to the MTU size... TCP headers are 40 to 60 bytes
ficeto
@ficeto
May 03 2015 20:36
tried 1300... same thing
Ivan Grokhotkov
@igrr
May 03 2015 20:36
still if it says RxMacBlk it means that it can't Rx because the buffer queue is full... perhaps the browser opens another connection and starts sending data there?
ficeto
@ficeto
May 03 2015 20:37
that shows once the file stops, so it is the browser asking for more data but not getting it
asks 3 times and quits
or at least I get this message 3 times then the browser stops loading
Ivan Grokhotkov
@igrr
May 03 2015 20:37
OK, I need to enable debug output and check the logs
that's in the core directory
change
ficeto
@ficeto
May 03 2015 20:41
New client
Request: /pins.png
Args: 
request handler not found
LmacRxBlk:1
LmacRxBlk:1
LmacRxBlk:1
Ivan Grokhotkov
@igrr
May 03 2015 20:48
I mean tcp debug output (debug.h in core directory)
ficeto
@ficeto
May 03 2015 20:48
got it
here is the error:
:sent 1450

:ww

:wr

:rch 135, 47

:rch 182, 105

LmacRxBlk:1
LmacRxBlk:1
:er -8

:ww

:wr !_pcb

:wr !_pcb

:wr !_pcb

:wr !_pcb

:wr !_pcb

:wr !_pcb

:wr !_pcb

:wr !_pcb

:wr !_pcb

:wr !_pcb

:wr !_pcb

:wr !_pcb

:wr !_pcb

LmacRxBlk:1
Ivan Grokhotkov
@igrr
May 03 2015 20:49
whoa
Markus
@Links2004
May 03 2015 20:49
-8 = Connection aborted.
Ivan Grokhotkov
@igrr
May 03 2015 20:50
yeah, I know...
so we send some data and wait for delivery confirmation, and at this point some data comes in
Ivan Grokhotkov
@igrr
May 03 2015 20:56
which we are unable to process because we are waiting for delivery confirmation
ficeto
@ficeto
May 03 2015 20:56
you mean ACK on the packet?
Ivan Grokhotkov
@igrr
May 03 2015 20:56
yes
somehow this situation should be handled by TCP because we are advertising changes to the window size after all...
ficeto
@ficeto
May 03 2015 20:58
yes, that might just be a duplicate packet with the same ack/seq if the client did not get ACKed
maybe I should TCPdump this shit and see what comes
Ivan Grokhotkov
@igrr
May 03 2015 20:59
perhaps
there's also a memory leak in the ClientContext code which is triggered with the wifiwebserver example sketch
I'll check on that once I arrive back home
perhaps this is related
ficeto
@ficeto
May 03 2015 21:06
well you were almost correct for the seq/ack
packets go and at some point the ESP no longer accepts the ACK from the client
and keeps resending the same packet
just ignoring the ACK from the client
Ivan Grokhotkov
@igrr
May 03 2015 21:08
can you log ESP.getFreeHeapSize() from your buffer sending loop? we might be out of men
ficeto
@ficeto
May 03 2015 21:11
28096 at point of failure
I do see a small leak though
300 bytes or so
28112
:wr

:rch 181, 46

LmacRxBlk:1
LmacRxBlk:1
:er -8

:ww

28096
:wr !_pcb
ficeto
@ficeto
May 03 2015 21:17
248 bytes heap difference between the first and the second request (first was success)
Ivan Grokhotkov
@igrr
May 03 2015 21:18
okay, so the leak issue is likely not related...
ficeto
@ficeto
May 03 2015 21:18
nope and the esp is not hanged, because it keeps sending packets
Ivan Grokhotkov
@igrr
May 03 2015 21:20
are we eligible for Espressif's bug bounty with this one?)
ficeto
@ficeto
May 03 2015 21:20
it's their stack so why not
I have the tcpdump here :)
ficeto
@ficeto
May 03 2015 21:35
this is exactly how it goes:
data flows normally untill a random point at which the ESP no longer reads the ACKs from the client
then it keeps trying 3 more timrs to send the same packet
after which it sends FIN for termination and again does not see the response from the client for that FIN
after the third duplicate FIN, finally they agree on termination