Shop OBEX P1 Docs P2 Docs Learn Events
ParallaxESP WX8266 programming help. — Parallax Forums

ParallaxESP WX8266 programming help.

Clock LoopClock Loop Posts: 2,069
edited 2018-12-06 05:50 in Accessories
I am in the process of documenting modern updated info on the ParallaxWX-8266 device.

I want to help others program it and even program ANY esp8266 with parallax's firmware...
It will be included in my other thread about it and compiling various parallax tools.

I am using the Parallax-Esp data at the github site:
https://github.com/parallaxinc/Parallax-ESP

And the problem I am having is the flash scripts in the release directory don't work.
The new version of the python programming program doesn't work with it.
And I do not know what version I SHOULD use.

So I downloaded the compiled result of the Parallax-Esp directory, and booted windows.
I used the esp8266 tool to do the programming, but it didn't work.

When I connect putty to the serial output of the 8266 module, it shows this output at baud: 74880
2nd boot version : 1.6
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 4Mbit(256KB+256KB)
no GPIO select!
jump to run user1 @ 1000

rf_cal[0] !=0x05,is 0xFF

 ets Jan  8 2013,rst cause:1, boot mode:(3,7)

load 0x40100000, len 2408, room 16
tail 8
chksum 0xe5
load 0x3ffe8000, len 776, room 0
tail 8
chksum 0x84
load 0x3ffe8310, len 632, room 0
tail 8
chksum 0xd8
csum 0xd8

The script that is old and dosen't work anymore is:
# flash the firmware
# and clear out all settings and the user flash filesystem

PORT=/dev/ttyUSB0
if [ ! -z $1 ]
then
  PORT=$1
fi
echo Using port $PORT

BAUD=115200
BOARD=none # none, ck, nodemcu, wifio
FLASH_SIZE=2M
FLASH_BLOCK_SIZE=1024
FLASH_SPEED=80
FLASH_INTERFACE=qio

BOOT_LOADER=0x000000
USER1_IMAGE=0x001000

USER_SETTINGS1=0x07E000
USER_SETTINGS2=0x07F000

if [ $FLASH_SIZE = 1M ]; then
WIFI_SETTINGS1=0x0FC000
WIFI_SETTINGS2=0x0FE000
WIFI_SETTINGS3=0x0FA000
elif [ $FLASH_SIZE = 2M ]; then
WIFI_SETTINGS1=0x1FC000
WIFI_SETTINGS2=0x1FE000
WIFI_SETTINGS3=0x1FA000
elif [ $FLASH_SIZE = 4M ]; then
WIFI_SETTINGS1=0x3FC000
WIFI_SETTINGS2=0x3FE000
WIFI_SETTINGS3=0x3FA000
else
echo Unsupported flash size $FLASH_SIZE
exit 1
fi

#flash filesystem base
FFS_BASE=0x100000

esptool \
-cp $PORT \
-cd $BOARD \
-cb $BAUD \
-bz $FLASH_SIZE \
-bf $FLASH_SPEED \
-bm $FLASH_INTERFACE \
-ca $BOOT_LOADER -cf boot_v1.6.bin \
-ca $USER1_IMAGE -cf httpd.user1.bin \
-ca $USER_SETTINGS1 -cf blank.bin \
-ca $USER_SETTINGS2 -cf blank.bin \
-ca $WIFI_SETTINGS1 -cf esp_init_data_default.bin \
-ca $WIFI_SETTINGS2 -cf blank.bin \
-ca $WIFI_SETTINGS3 -cf blank.bin \
-ca $FFS_BASE -cf blank.bin

I modified it to work with the new python programmer code, but it still dosen't work.
# flash the firmware
# and clear out all settings and the user flash filesystem

PORT=/dev/ttyUSB0
if [ ! -z $1 ]
then
  PORT=$1
fi
echo Using port $PORT

BAUD=115200
BOARD=auto # none, ck, nodemcu, wifio
FLASH_SIZE=4m
#FLASH_SIZE=detect
FLASH_BLOCK_SIZE=1024
FLASH_SPEED=80m
FLASH_INTERFACE=qio

BOOT_LOADER=0x000000
USER1_IMAGE=0x001000

USER_SETTINGS1=0x07E000
USER_SETTINGS2=0x07F000

if [ $FLASH_SIZE = 1m ]; then
WIFI_SETTINGS1=0x0FC000
WIFI_SETTINGS2=0x0FE000
WIFI_SETTINGS3=0x0FA000
elif [ $FLASH_SIZE = 2m ]; then
WIFI_SETTINGS1=0x1FC000
WIFI_SETTINGS2=0x1FE000
WIFI_SETTINGS3=0x1FA000
elif [ $FLASH_SIZE = 4m ]; then
WIFI_SETTINGS1=0x3FC000
WIFI_SETTINGS2=0x3FE000
WIFI_SETTINGS3=0x3FA000
else
echo Unsupported flash size $FLASH_SIZE
exit 1
fi

#flash filesystem base
FFS_BASE=0x100000

esptool.py --port $PORT --baud $BAUD write_flash --flash_size $FLASH_SIZE --flash_freq $FLASH_SPEED --flash_mode $FLASH_INTERFACE \ $BOOT_LOADER ../esp_iot_sdk_v2.0.0.p1/bin/boot_v1.6.bin $USER1_IMAGE ../build/httpd.user1.bin \ $USER_SETTINGS1 ../esp_iot_sdk_v2.0.0.p1/bin/blank.bin \ $USER_SETTINGS2 ../esp_iot_sdk_v2.0.0.p1/bin/blank.bin \ $WIFI_SETTINGS1 ../esp_iot_sdk_v2.0.0.p1/bin/esp_init_data_default.bin \ $WIFI_SETTINGS2 ../esp_iot_sdk_v2.0.0.p1/bin/blank.bin \ $WIFI_SETTINGS3 ../esp_iot_sdk_v2.0.0.p1/bin/blank.bin \ $FFS_BASE ../esp_iot_sdk_v2.0.0.p1/bin/blank.bin

I tried another tool.. same result.
709 x 680 - 167K

Comments

  • Clock LoopClock Loop Posts: 2,069
    edited 2018-12-06 05:50
    Man, I come back to the same problems years later and my own history solves it.

    https://forums.parallax.com/discussion/comment/1391937/#Comment_1391937

    I need the "helper" program.

    https://github.com/igrr/esptool-ck

    Testing now.

    This is why I am documenting it all.
    The little details are missing from instructions.
  • Clock LoopClock Loop Posts: 2,069
    edited 2018-12-06 07:37
    I was able now to get it to work in linux. ..
    But the Parallax-ESP program still doesn't work on my ParallaWX8266 module...
    And now i can't even get a serial output because i can't use the custom baud in linux???
    The old output in windows at the odd baud, showed the module as the wrong size??? I am not sure if that is wrong yet..
    SPI Flash Size & Map: 4Mbit(256KB+256KB)
    
    So that might be part of the issue.

    I had to copy all the files it wants into the release folder. You can find them in ../build and ../esp_iot_sdk_v2.0.0.p1
    You also need to change the command esptool to ./esptool in each .sh file.
    also copy esptool.py and the esptool into the release folder.
    esptool.py is the programmer tool --> https://github.com/espressif/esptool
    esptool is actually the esphelper too -->https://github.com/igrr/esptool-ck
    $ ./clear.sh
    Using port /dev/ttyUSB0
    Uploading 4096 bytes from blank.bin to flash at 0x0007E000
    ....                                                                             [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x0007F000
    ....                                                                             [ 100% ]
    Uploading 128 bytes from esp_init_data_default.bin to flash at 0x001FC000
    .                                                                                [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x001FE000
    ....                                                                             [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x001FA000
    ....                                                                             [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x00100000
    ....                                                                             [ 100% ]
    :~/P-Esp$ ./flash-all.sh
    Using port /dev/ttyUSB0
    Uploading 3856 bytes from boot_v1.6.bin to flash at 0x00000000
    ....                                                                             [ 100% ]
    Uploading 317668 bytes from httpd.user1.bin to flash at 0x00001000
    ................................................................................ [ 25% ]
    ................................................................................ [ 51% ]
    ................................................................................ [ 77% ]
    .......................................................................          [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x0007E000
    ....                                                                             [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x0007F000
    ....                                                                             [ 100% ]
    Uploading 128 bytes from esp_init_data_default.bin to flash at 0x001FC000
    .                                                                                [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x001FE000
    ....                                                                             [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x001FA000
    ....                                                                             [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x00100000
    ....                                                                             [ 100% ]
    :~/P-Esp$ putty
    
    

    Nice linux, nice.

    Forced to use standard baud rates.... Same hardware lets custom baud in windozer....
    :~/P-Esp$ sudo putty -serial /dev/ttyUSB0 -sercfg 115200,8,n,1,N &
    [1] 31803
    :~/P-Esp$ stty -F /dev/ttyUSB0
    speed 115200 baud; line = 0;
    min = 1; time = 0;
    ignbrk -brkint -icrnl -imaxbel
    -opost -onlcr
    -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
    :~/P-Esp$ 
    [1]+  Done                    sudo putty -serial /dev/ttyUSB0 -sercfg 115200,8,n,1,N
    :~/P-Esp$ 
    :~/P-Esp$ 
    :~/P-Esp$ 
    :~/P-Esp$ sudo putty -serial /dev/ttyUSB0 -sercfg 74880,8,n,1,N &
    [1] 507
    :~/P-Esp$ stty -F /dev/ttyUSB0
    speed 57600 baud; line = 0;
    min = 1; time = 0;
    ignbrk -brkint -icrnl -imaxbel
    -opost -onlcr
    -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
    :~/P-Esp$ 
    [1]+  Done                    sudo putty -serial /dev/ttyUSB0 -sercfg 74880,8,n,1,N
    :~/P-Esp$ 
    


    So who knows how to do custom baud in linux?



    I guess the only option I have is to rip out my current outdoor install of another working ParallaxEsp.
    Then do a .bin backup and then restore that bin to the other module.
    Then I can look at the various bins that get uploaded to the esp and figure out why its not working.
    Theres a handy python tool someone made that will split your whole bin into the proper sizes and even show you what the whole bin looks like..

    Ok, get to hackin..
    https://microcontrollerelectronics.com/decoding-an-esp8266-firmware-image/

    You must use a fairly large 3.3v regulator with these.
    I initially used a lm1117 800ma LDO regulator, and it caused the problem I have now, a bad upload to an esp using the OTA web interface.
    I switched to a regulator capable of 3A, no problems after that. But I now have to upload a good image, and don't have a OTA interface.
    Now I must do it serially.
    1024 x 768 - 88K
  • Hi Clock loop!

    Are you still having issues programming the devices?

    There's an updated programming doc I could share, which takes into account the module flash size change that happened about a year ago.

    The intention is to push github with some parallax-esp code and doc updates in January. If the programming docs would help you sooner, I could prepare something shareable over the weekend.
  • Clock LoopClock Loop Posts: 2,069
    edited 2018-12-06 08:46
    VonSzarvas wrote: »
    Hi Clock loop!

    Are you still having issues programming the devices?

    Yea it won't run the parallax AP when I program. And I haven't yet pulled out my second module to image the bin. (because its keeping my greenhouse from freezing)
    So I can't run the bin analysis to figure out WTF...
    VonSzarvas wrote: »
    There's an updated programming doc I could share, which takes into account the module flash size change that happened about a year ago.

    The intention is to push github with some parallax-esp code and doc updates in January. If the programming docs would help you sooner, I could prepare something shareable over the weekend.

    Do you mean some of the parallax modules have different size flash?
    Oh, that is need info, if I want to help others, who knows what they may have...
    Which changes how you program it... currently the sh file has 4m for the size.
    You saying this changed?

    I am adding all this info to my thread in the forum accessories area, anything helps.
  • Here's what I could quickly put together.

    From what I recall... The modules were originally 4MB, then became 2MB at some point (supplier change).
    But then I think the supplier had some "supply" issues, and was shipping 2MB modules as 4MB :)
    There's a command in this pdf which determines your module size, so you can then use the correct programming command.

    This memory size is only really relevant because the module itself will always look for the user-settings (esp_init_data_default.bin) at an address relevant to the max module size. Ie. at 0x1fc000 or 0x3fc000. So that bin needs to be stored in the right place, depending on Flash size, or I think the module may appear bricked.

    I'm pretty sure I have a step-by-step on installing python somewhere, but I won't be in that office until late Saturday or Sunday.


  • Clock LoopClock Loop Posts: 2,069
    edited 2018-12-06 10:41
    VonSzarvas wrote: »
    at an address relevant to the max module size. Ie. at 0x1fc000 or 0x3fc000. So that bin needs to be stored in the right place, depending on Flash size, or I think the module may appear bricked.

    THATS IT!


    Thanks for the info....
    :~/P-Esp$ esptool.py --baud 115200 --port /dev/ttyUSB0 flash_id
    esptool.py v2.6-beta1
    Serial port /dev/ttyUSB0
    Connecting........____
    Detecting chip type... ESP8266
    Chip is ESP8266EX
    Features: WiFi
    MAC: xx:xx:xx:xx:xx:xx
    Uploading stub...
    Running stub...
    Stub running...
    Manufacturer: a1
    Device: 4016
    Detected flash size: 4MB
    Hard resetting via RTS pin...
    

    Reading the flash, and recovering it to another esp DOSEN'T WORK. (perhaps some mac address issues)
    esptool.py --baud 460800 --port /dev/ttyUSB0 read_flash 0x00000 0x400000 flash.bin
    esptool.py v2.6-beta1
    Serial port /dev/ttyUSB0
    Connecting....
    Detecting chip type... ESP8266
    Chip is ESP8266EX
    Features: WiFi
    MAC: xx:xx:xx:xx:xx:xx
    Uploading stub...
    Running stub...
    Stub running...
    Changing baud rate to 460800
    Changed.
    4194304 (100 %)
    4194304 (100 %)
    Read 4194304 bytes at 0x0 in 109.7 seconds (305.8 kbit/s)...
    Hard resetting via RTS pin...
    
    Writing this .bin file to another esp dosen't work.

    ....grinding.....
  • Clock LoopClock Loop Posts: 2,069
    edited 2018-12-06 10:42
    This works.
    $ ./esptool.py --baud 921600 write_flash 0x00000 boot_v1.6.bin 0x01000 httpd.user1.bin 0x100000 blank.bin 0x3FC000 esp_init_data_default.bin
    esptool.py v2.6-beta1
    Found 1 serial ports
    Serial port /dev/ttyUSB0
    Connecting.....
    Detecting chip type... ESP8266
    Chip is ESP8266EX
    Features: WiFi
    MAC: xx:xx:xx:xx:xx:xx
    Uploading stub...
    Running stub...
    Stub running...
    Changing baud rate to 921600
    Changed.
    Configuring flash size...
    Auto-detected Flash size: 4MB
    Flash params set to 0x0040
    Compressed 3856 bytes to 2763...
    Wrote 3856 bytes (2763 compressed) at 0x00000000 in 0.0 seconds (effective 965.9 kbit/s)...
    Hash of data verified.
    Compressed 317668 bytes to 239609...
    Wrote 317668 bytes (239609 compressed) at 0x00001000 in 3.8 seconds (effective 673.7 kbit/s)...
    Hash of data verified.
    Compressed 4096 bytes to 26...
    Wrote 4096 bytes (26 compressed) at 0x00100000 in 0.0 seconds (effective 2054.9 kbit/s)...
    Hash of data verified.
    Compressed 128 bytes to 75...
    Wrote 128 bytes (75 compressed) at 0x003fc000 in 0.0 seconds (effective 64.1 kbit/s)...
    Hash of data verified.
    
    Leaving...
    Hard resetting via RTS pin...
    

    Thanks VON!
  • VonSzarvas wrote: »
    Here's what I could quickly put together.

    From what I recall... The modules were originally 4MB, then became 2MB at some point (supplier change).
    But then I think the supplier had some "supply" issues, and was shipping 2MB modules as 4MB :)
    There's a command in this pdf which determines your module size, so you can then use the correct programming command.

    This memory size is only really relevant because the module itself will always look for the user-settings (esp_init_data_default.bin) at an address relevant to the max module size. Ie. at 0x1fc000 or 0x3fc000. So that bin needs to be stored in the right place, depending on Flash size, or I think the module may appear bricked.

    I'm pretty sure I have a step-by-step on installing python somewhere, but I won't be in that office until late Saturday or Sunday.

    I thought I had made the firmware adjust to the flash size automatically. Maybe that isn't working yet? I've had it working on modules with as little as 512K of flash.

  • Clock LoopClock Loop Posts: 2,069
    edited 2018-12-06 11:23
    David Betz wrote: »
    I thought I had made the firmware adjust to the flash size automatically. Maybe that isn't working yet? I've had it working on modules with as little as 512K of flash.
    IT WAS MY FAULT.

    I put 4m not 4M

    If I had payed attention to the script output i could have figured out that was the issue.
    $ ./clear.sh <--HAS 2M as default
    Using port /dev/ttyUSB0
    Uploading 4096 bytes from blank.bin to flash at 0x0007E000
    .... [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x0007F000
    .... [ 100% ]
    Uploading 128 bytes from esp_init_data_default.bin to flash at 0x001FC000
    . [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x001FE000
    .... [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x001FA000
    .... [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x00100000
    .... [ 100% ]
    :~/P-Esp$ ./flash-all.sh
    Using port /dev/ttyUSB0
    Uploading 3856 bytes from boot_v1.6.bin to flash at 0x00000000
    .... [ 100% ]
    Uploading 317668 bytes from httpd.user1.bin to flash at 0x00001000
    ................................................................................ [ 25% ]
    ................................................................................ [ 51% ]
    ................................................................................ [ 77% ]
    ....................................................................... [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x0007E000
    .... [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x0007F000
    .... [ 100% ]
    Uploading 128 bytes from esp_init_data_default.bin to flash at 0x001FC000
    . [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x001FE000
    .... [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x001FA000
    .... [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x00100000
    .... [ 100% ]
    :~/P-Esp$ putty

    SO EVERYONE PAY ATTENTION TO THE FLASH_SIZE=4M setting.
    NOT FLASH_SIZE=2M or FLASH_SIZE=4m

    Its FLASH_SIZE=4M

    Now I can finish the INFO, thanks guys.
  • David Betz wrote: »
    I thought I had made the firmware adjust to the flash size automatically. Maybe that isn't working yet? I've had it working on modules with as little as 512K of flash.

    I thought that you did too. But if the user purposely writes the user.bin file to the wrong place, things go wonky.



  • Clock LoopClock Loop Posts: 2,069
    edited 2018-12-06 11:57
    Im still trying to figure out why the default flash-all.sh dosen't work.
    It won't run the AP, and just dumps data out the DO port.
    So perhaps my typo isn't the only problem.
    $ ./flash-all.sh
    Using port /dev/ttyUSB0
    Uploading 3856 bytes from boot_v1.6.bin to flash at 0x00000000
    ....                                                                             [ 100% ]
    Uploading 317668 bytes from httpd.user1.bin to flash at 0x00001000
    ................................................................................ [ 25% ]
    ................................................................................ [ 51% ]
    ................................................................................ [ 77% ]
    .......................................................................          [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x0007E000
    ....                                                                             [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x0007F000
    ....                                                                             [ 100% ]
    Uploading 128 bytes from esp_init_data_default.bin to flash at 0x003FC000
    .                                                                                [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x003FE000
    ....                                                                             [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x003FA000
    ....                                                                             [ 100% ]
    Uploading 4096 bytes from blank.bin to flash at 0x00100000
    ....                                                                             [ 100% ]
    


    But this WILL get the AP working.
    $ ./esptool.py --baud 921600 write_flash 0x00000 boot_v1.6.bin 0x01000 httpd.user1.bin 0x100000 blank.bin 0x3FC000 esp_init_data_default.bin
    esptool.py v2.6-beta1
    Found 1 serial ports
    Serial port /dev/ttyUSB0
    Connecting.....
    Detecting chip type... ESP8266
    Chip is ESP8266EX
    Features: WiFi
    MAC: xx:xx:xx:xx:xx:xx
    Uploading stub...
    Running stub...
    Stub running...
    Changing baud rate to 921600
    Changed.
    Configuring flash size...
    Auto-detected Flash size: 4MB
    Flash params set to 0x0040
    Compressed 3856 bytes to 2763...
    Wrote 3856 bytes (2763 compressed) at 0x00000000 in 0.0 seconds (effective 961.4 kbit/s)...
    Hash of data verified.
    Compressed 317668 bytes to 239609...
    Wrote 317668 bytes (239609 compressed) at 0x00001000 in 3.8 seconds (effective 668.0 kbit/s)...
    Hash of data verified.
    Compressed 4096 bytes to 26...
    Wrote 4096 bytes (26 compressed) at 0x00100000 in 0.0 seconds (effective 2044.6 kbit/s)...
    Hash of data verified.
    Compressed 128 bytes to 75...
    Wrote 128 bytes (75 compressed) at 0x003fc000 in 0.0 seconds (effective 63.8 kbit/s)...
    Hash of data verified.
    
    Leaving...
    Hard resetting via RTS pin...
    
  • Clock LoopClock Loop Posts: 2,069
    edited 2018-12-06 12:24
    I think the problem is the "helper" program.

    https://github.com/igrr/esptool-ck

    Why even use it? The user must download ANOTHER program that can simply be eliminated by typing out the instructions...
    Perhaps the esptool.py program didn't have things it now does.

    So the script currently does
    -cb $BAUD
    

    But should do
    -baud $BAUD
    

    Im testing right now by rewriting the script.
  • David BetzDavid Betz Posts: 14,516
    edited 2018-12-06 12:35
    Clock Loop wrote: »
    I think the problem is the "helper" program.

    https://github.com/igrr/esptool-ck

    Why even use it? The user must download ANOTHER program that can simply be eliminated by typing out the instructions...
    Perhaps the esptool.py program didn't have things it now does.

    So the script currently does
    -cb $BAUD
    

    But should do
    -baud $BAUD
    

    Im testing right now by rewriting the script.
    I have a local copy of the esptool-ck repository that I've been using. Maybe they modified the official copy. I guess I could add my local copy to the Parallax-ESP repository. In any case, esptool-ck isn't just a script. It turns out that the Python script won't work for us for some reason that I can't recall. If you can get it to work that would be great. We can get rid of the use of esptool-ck.

  • Clock LoopClock Loop Posts: 2,069
    edited 2018-12-06 15:58
    David Betz wrote: »
    If you can get it to work that would be great. We can get rid of the use of esptool-ck.

    It WORKS NOW!
    $ ./flash-all.sh
    Using port /dev/ttyUSB0
    esptool.py v2.6-beta1
    Serial port /dev/ttyUSB0
    Connecting.....
    Detecting chip type... ESP8266
    Chip is ESP8266EX
    Features: WiFi
    MAC: xx:xx:xx:xx:xx:xx
    Uploading stub...
    Running stub...
    Stub running...
    Changing baud rate to 921600
    Changed.
    Configuring flash size...
    Flash params set to 0x004f
    Compressed 3856 bytes to 2763...
    Wrote 3856 bytes (2763 compressed) at 0x00000000 in 0.0 seconds (effective 965.6 kbit/s)...
    Hash of data verified.
    Compressed 317668 bytes to 239609...
    Wrote 317668 bytes (239609 compressed) at 0x00001000 in 3.8 seconds (effective 668.0 kbit/s)...
    Hash of data verified.
    Compressed 4096 bytes to 26...
    Wrote 4096 bytes (26 compressed) at 0x0007e000 in 0.0 seconds (effective 2045.7 kbit/s)...
    Hash of data verified.
    Compressed 4096 bytes to 26...
    Wrote 4096 bytes (26 compressed) at 0x0007f000 in 0.0 seconds (effective 2048.8 kbit/s)...
    Hash of data verified.
    Compressed 128 bytes to 75...
    Wrote 128 bytes (75 compressed) at 0x003fc000 in 0.0 seconds (effective 64.2 kbit/s)...
    Hash of data verified.
    Compressed 4096 bytes to 26...
    Wrote 4096 bytes (26 compressed) at 0x003fe000 in 0.0 seconds (effective 2031.9 kbit/s)...
    Hash of data verified.
    Compressed 4096 bytes to 26...
    Wrote 4096 bytes (26 compressed) at 0x003fa000 in 0.0 seconds (effective 2056.0 kbit/s)...
    Hash of data verified.
    Compressed 4096 bytes to 26...
    Wrote 4096 bytes (26 compressed) at 0x00100000 in 0.0 seconds (effective 2068.4 kbit/s)...
    Hash of data verified.
    
    Leaving...
    Verifying just-written flash...
    (This option is deprecated, flash contents are now always read back after flashing.)
    Flash params set to 0x004f
    Verifying 0xf10 (3856) bytes @ 0x00000000 in flash against boot_v1.6.bin...
    -- verify OK (digest matched)
    Verifying 0x4d8e4 (317668) bytes @ 0x00001000 in flash against httpd.user1.bin...
    -- verify OK (digest matched)
    Verifying 0x1000 (4096) bytes @ 0x0007e000 in flash against blank.bin...
    -- verify OK (digest matched)
    Verifying 0x1000 (4096) bytes @ 0x0007f000 in flash against blank.bin...
    -- verify OK (digest matched)
    Verifying 0x80 (128) bytes @ 0x003fc000 in flash against esp_init_data_default.bin...
    -- verify OK (digest matched)
    Verifying 0x1000 (4096) bytes @ 0x003fe000 in flash against blank.bin...
    -- verify OK (digest matched)
    Verifying 0x1000 (4096) bytes @ 0x003fa000 in flash against blank.bin...
    -- verify OK (digest matched)
    Verifying 0x1000 (4096) bytes @ 0x00100000 in flash against blank.bin...
    -- verify OK (digest matched)
    Hard resetting via RTS pin...
    

    NEW flash-all.sh
    # flash the firmware
    # and clear out all settings and the user flash filesystem
    
    PORT=/dev/ttyUSB0
    if [ ! -z $1 ]
    then
      PORT=$1
    fi
    echo Using port $PORT
    
    BAUD=115200
    FLASH_SIZE=4MB          # 16MB, detect, 256KB, 2MB-c1, 8MB, 2MB, 4MB, 512KB, 1MB, 4MB-c1
    FLASH_BLOCK_SIZE=1024
    FLASH_SPEED=80m         # keep,40m,26m,20m,80m
    FLASH_INTERFACE=qio     # keep,qio,qout,dio,dout
    
    BOOT_LOADER=0x000000
    USER1_IMAGE=0x001000
    
    USER_SETTINGS1=0x07E000
    USER_SETTINGS2=0x07F000
    
    if [ $FLASH_SIZE = 1MB ]; then
    WIFI_SETTINGS1=0x0FC000
    WIFI_SETTINGS2=0x0FE000
    WIFI_SETTINGS3=0x0FA000
    elif [ $FLASH_SIZE = 2MB ]; then
    WIFI_SETTINGS1=0x1FC000
    WIFI_SETTINGS2=0x1FE000
    WIFI_SETTINGS3=0x1FA000
    elif [ $FLASH_SIZE = 4MB ]; then
    WIFI_SETTINGS1=0x3FC000
    WIFI_SETTINGS2=0x3FE000
    WIFI_SETTINGS3=0x3FA000
    else
    echo Unsupported flash size $FLASH_SIZE
    exit 1
    fi
    
    #flash filesystem base
    FFS_BASE=0x100000
    
    ./esptool.py \
    --port $PORT \
    --baud $BAUD \
    write_flash \
    --flash_freq $FLASH_SPEED \
    --flash_mode $FLASH_INTERFACE \
    --flash_size $FLASH_SIZE \
    --verify \
    --compress \
    $BOOT_LOADER boot_v1.6.bin \
    $USER1_IMAGE httpd.user1.bin \
    $USER_SETTINGS1 blank.bin \
    $USER_SETTINGS2 blank.bin \
    $WIFI_SETTINGS1 esp_init_data_default.bin \
    $WIFI_SETTINGS2 blank.bin \
    $WIFI_SETTINGS3 blank.bin \
    $FFS_BASE blank.bin
    

    It looks like we can.
  • It seems to me that there was a reason we were using esptool-ck instead of esptool. Maybe esptool has been updated since then though.
  • VonSzarvasVonSzarvas Posts: 3,488
    edited 2018-12-06 12:58
    David Betz wrote: »
    It turns out that the Python script won't work for us for some reason that I can't recall. If you can get it to work that would be great. We can get rid of the use of esptool-ck.

    We were using only Python esptool with BadgeWX. It sure works fine nowadays.
    Could well be it was updated since your issues some years earlier when PESP began, as you suspected!


    (I think the install of python/esptool was pretty text-book. Either-way, I documented the install & usage steps at the time, so will share that here on the weekend, if there was anything funky involved)

  • Clock LoopClock Loop Posts: 2,069
    edited 2018-12-06 15:57
    AND perhaps take some settings out by commenting them so the program does AUTO mode for those settings.
    Auto mode for Flash size will not work, because the addresses for the "chunks" need to be set, so the user MUST set the size.
    (unless you first run the $ esptool.py flash_id and are able to dump the size output to a variable)
    I don't know how to do all that....

    It would be nice to support all sizes, then Parallax can be like the BORG and assimilate all.

    I think someone better than I should rewite the script because esptool.py works great alone!
    But for now, the new flash-all.sh works. I suppose they should all get re-written.


    I also have found that flashing at speeds above 115200 might be flakey.
    I programmed one ParallaxESP at 921600, and it seemed to program fine, most of the time.
    But sometimes, I would connect to the AP and it would just drop dead, and the blue light would go out, and i would get a crash dump output from the DBG pin.
    I think this is from the fast programming speed.
    Perhaps for the re-written default scripts, it should still be the slower speed like it is now, and let the techs up the speed, since they know it might be problematic.
    (like I have found)
Sign In or Register to comment.