Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Holger Lembke
@holgerlembke
Hmm. I'm to stupid to check flash writablility.... suggestions anyone?
  const unsigned int lowteststart = 0x80000;  // 512k
  const unsigned int teststep = 0x80000;      // 512k

  // Write
  for (unsigned int i = lowteststart; i < realSize; i = i + teststep) {
    Serial.printf("Write %08X\n", i);
    SPIEraseSector(i/FLASH_SECTOR_SIZE);
    SPIWrite(i, &i, sizeof(i));
  }

  // Read
  unsigned int j = 0;
  for (unsigned int i = lowteststart; i < realSize; i = i + teststep) {
    Serial.printf("Read %08X", i);
    SPIRead(i, &j, sizeof(j));
    Serial.printf(" Diff %u\n", j-i);
  }
Clemens Kirchgatterer
@everslick
@holgerlembke suggestions: try the functions in EspClass i.e. bool EspClass::flashEraseSector(uint32_t sector) and check the return codes from these functions.
Holger Lembke
@holgerlembke
Looks like flash write/read size is hardcoded.... if I compile with 512k writing the first data fails, if I compile with 4mb there is success. so no chance this way....
Holger Lembke
@holgerlembke
        // Winbond
        case 0x1840EF: // W25Q128
            return (16_MB);
Martin Ayotte
@martinayotte
What do you mean ? What are you trying to achieve ?
Holger Lembke
@holgerlembke
I try to verify that I can access the full 16 mb of my flash memory
Martin Ayotte
@martinayotte
Ok ! and what are the failure ? Are you using Esp.flashEraseSector() and Esp.flashWrite() ?
Holger Lembke
@holgerlembke
if i compile with 512k ---> can't access beyond 512k, if I compile with 4mb--> can't access beyond 4mb. so there seems to be some thing inside the compilation, that limits flash access that is not related to the real flash size.
(i use above code, now switched to esp:: same result.)
Martin Ayotte
@martinayotte
@me-no-dev could maybe answer why. maybe the LD scripts need to be tweaked.
Holger Lembke
@holgerlembke
yepp. i think so, too
holgerlembke @holgerlembke eats a fried herring now and then.... hmmm. a beer?
Me No Dev
@me-no-dev
@holgerlembke just keep tight another day and prep env to compile esptool from source
Holger Lembke
@holgerlembke
I'm as tight as man can be. I only want to understand what I do and why it fails. But as far as I see, I understand it now... it is limited in the build process
Loial Otter
@LoialOtter_twitter
Size of simple c program that copies things around flash and boots to one of them (eboot): 1384... size of a c program that compiles with wifi (hello world example): 244338... right... hmm...
Ivan Grokhotkov
@igrr
@holgerlembke re flash size: if you want to write outside the bounds which are given at compilation time, you need to tweak flash size field of global flashchip structure, see tools/sdk/include/spi_flash.h.
But keep in mind that whenever you call any routine which changes WiFi persistent configuration, it will use the range [flashChip.chip_size - 3 * SPI_FLASH_SEC_SIZE; flashChip.chip_size) for storage.
so your runtime changes to flashChip.chip_size will affect where wifi config is saved
Loial Otter
@LoialOtter_twitter
hmm... and a minimal ota with full core is 274072... that's pretty impressive if the sdk libraries take ~240k of that
and my solution - save a minimal ota firmware elsewhere on the flash (masked out with an adjustment to the ld script) which eboot can copy in place if the firmware goes into a boot loop more than 'x' number of times in a row
xbary
@xbary
Hey
Is it possible to do so showed that the IDE after compiling unless the changed usage of RAM and flash? eg.
Program size: 456 461 bytes (used 48% of a 958 448 byte maximum) (8,75 secs) [+1422]
Minimum Memory Usage: 52368 bytes (64% of a 81920 byte maximum) [+234]
I use Visual Micro
ZenHoop
@ZenHoop
Can anyone tell me why I can easily connect to my modules some times and other times I get can't connect to this network? I have changed channels twice from 1 to 11 then to 6. I have also been updating my router to use what ever channel I have chosen for my chips. I have made sure to clear saved networks, disabled and re-enabled my adapter before trying to reconnect.
Me No Dev
@me-no-dev
@holgerlembke @mozgy esp8266/Arduino#2351 is my attempt at 8 and 16MB support
Mehrdad K
@mkeyno
hi All,I have to use while(1) instruction to read the serial input in certain of time , the serial reading speed set to 9600, and I think it'll gotta take while , I've got no error but while my loop may took more than 4 ms ,is it wisdom to put yield() inside the while(1) to prevent any probably wifi stack choking ?
Martin Ayotte
@martinayotte
Yes ! but if you wish to have cleaner code, there are many ways where you can avoid having a while() and leaving the loop() has often as possible.
Mehrdad K
@mkeyno
@martinayotte I have to send AT command and read serial SIM module in certain of time in loop() function , can you elaborate what approach would be best ?
following is the code currently I use
int sendCmdAndWaitForResp(const char* cmd, const char *resp, unsigned timeout)
{
 SIM.write(cmd);
// Serial.println(cmd);
int len = strlen(resp);
    byte sum=0,Location=0;
    unsigned long timerStart,timerEnd;
    timerStart = millis();    
    while(1) {
        if(SIM.available()) {
                        char c = SIM.read();
                        // Serial.write(c);
                        if(c<32) SIM_BUFF+='_';
                        else     SIM_BUFF+=c;
                        Location++;
                        sum = (c==resp[sum]) ? sum+1 : 0;
                        if(sum == len) break;
                      }
        timerEnd = millis();
        if(timerEnd - timerStart > 1000 * timeout) return 0; 
      }
    while(SIM.available())    SIM.read(); 
    return Location-len+1;  
}
Martin Ayotte
@martinayotte
I would separate the handling of Send and the Response in 2 tasks. I presume that responses have some delimitter such CR or CRLF, accumulate the characters with while(Serial.available()) and process response only when the CRLF arrives. So, when responses is not yet completed, you simple leaving the loop()
Mehrdad K
@mkeyno
is it possible in your approach , may loose some responds while I'm doing other stuff in loop()?
Martin Ayotte
@martinayotte
Serial at 9600baud, meaning 960 chars/sec, leaving you plenty of time to do something else, especially if those other tasks are not blocking too.
Also, I think in the SDK layer, UART is using FIFO, although I don't know a big it is.
Mehrdad K
@mkeyno
that's why I choose low speed such as 9600, and as serial is interrupt driven I was hopping no mess with wifi stack
Martin Ayotte
@martinayotte
I was wrong : the FIFO seems to be handle in esp8266/2.3.0/cores/esp8266/uart.* with 128 bytes.
Mehrdad K
@mkeyno
actually I'm using software serial for reading module and set its buffer to 256
Martin Ayotte
@martinayotte
With SoftwareSerial, you have more chance to get troubles with the WiFi stack. But maybe it can still work.
Mehrdad K
@mkeyno
actually I have , sometimes my module reset or my websocket connection severed
Martin Ayotte
@martinayotte
For the module resets, I'm not sure it is related.
Mehrdad K
@mkeyno
@martinayotte I have SIM module connected and close to my ESP-12F, when it get call , make the ESP reset , do you have any suggestion to protect ESP
Martin Ayotte
@martinayotte
@mkeyno , this is usually symptom of bad power supply. Make sure it is strong enough and well regulated and add capacitors nearby.
Shelby Merrick
@forkineye
Is it possible to feed the hardware watchdog?
Ivan Grokhotkov
@igrr
WDT_FEED();
In esp8266_peri.h
Shelby Merrick
@forkineye
thanks @igrr !
Shelby Merrick
@forkineye
@igrr If I need to bitbang a packet for 800us with interrupts disabled, will WDT_FEED() keep me alive or should I expect issues?
Ivan Grokhotkov
@igrr
Disabling wifi interrupt for more than 20us is not recommended. You will likely get wdt reset if you disable them for that long.
Michael Miller
@Makuna
@forkineye What sort of packet are you bit-banging?