Sparkfun ESP32 Thing

Posted on
  • Hi,
    I flashed a SparkFun ESP32 Thing with Espruino (specifically espruino_1v99_esp32.bin) however I just get junk out of it.

    If I reset I see the bootloader (I assume) print some stuff then I get junk eg..

    [Maelstrom 16:47] ~ >cu -l /dev/cu.usbserial-DN02MPA4 -s 115200
    Connected.
    ets Jun  8 2016 00:22:57
    
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    ets Jun  8 2016 00:22:57
    
    rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_d­rv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:2
    load:0x3fff0018,len:4
    load:0x3fff001c,len:2364
    load:0x40078000,len:0
    load:0x40078000,len:10880
    entry 0x40078c4c
    ���1Il���
    

    I tried a few different baud rates (9600, 19200, 38400, 57600, 115200, 230400, 921600) and none of them produced anything sensible except for the boot loader at 115200.

    Any help appreciated, thanks.

    BTW I flashed this board with MicroPython and it worked so I think the board is OK.

  • What flashing command did you use?

    If you used dio try qio or vice-versa..

    The baud rate to use is 115200.

    Sometimes after flashing you need to disconnect the USB and reconnect.

  • OK I used dio, like so..

    /Users/oconnd1/Documents/Arduino/hardwar­e/espressif/esp32/tools/esptool.py --chip esp32                                \
            --port /dev/cu.usbserial-DN02MPA4                         \
            --baud 921600                               \
            --after hard_reset write_flash              \
            -z                                          \
            --flash_mode dio                            \
            --flash_freq 40m                            \
            --flash_size detect                         \
            0x1000 bootloader.bin                       \
            0x8000 partitions_espruino.bin              \
            0x10000 espruino_1v99_esp32.bin
    

    Although I flashed MicroPython with..

    /Users/oconnd1/Documents/Arduino/hardwar­e/espressif/esp32/tools/esptool.py --chip esp32                                \
            --port /dev/cu.usbserial-DN02MPA4                         \
            --baud 921600                               \
            --after hard_reset write_flash              \
            -z                                          \
            --flash_mode dio                            \
            --flash_freq 40m                            \
            --flash_size detect                         \
            0x1000 ~/Downloads/esp32-20180808-v1.9.4-443-gc­1c798fbc.bin
    

    and that worked.

    I'll try qio tomorrow for Espruino tomorrow and see how I go, thanks.

  • If it's working with dio for micro python - then that's unlikely.

    Do a flash erase first - there might be something in flash left over that is giving you grief.

  • I realised I had an old-ish esptool so I updated, no change.

    I tried qio and that resulted in it rebooting constantly, eg

    rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_d­rv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:QIO, clock div:3
    load:0x3fff0018,len:4
    load:0xd532060c,len:642933257
    1162 mmu set 00010000, pos 00010000
    1162 mmu set 00020000, pos 00020000
    1162 mmu set 00030000, pos 00030000
    1162 mmu set 00040000, pos 00040000
    1162 mmu set 00050000, pos 00050000
    1162 mmu set 00060000, pos 00060000
    1162 mmu set 00070000, pos 00070000
    1162 mmu set 00080000, pos 00080000
    1162 mmu set 00090000, pos 00090000
    ets Jun  8 2016 00:22:57
    
    rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_d­rv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:QIO, clock div:3
    load:0x3fff0018,len:4
    load:0xd532060c,len:642933257
    1162 mmu set 00010000, pos 00010000
    1162 mmu set 00020000, pos 00020000
    1162 mmu set 00030000, pos 00030000
    1162 mmu set 00040000, pos 00040000
    1162 mmu set 00050000, pos 00050000
    1162 mmu set 00060000, pos 00060000
    1162 mmu set 00070000, pos 00070000
    1162 mmu set 00080000, pos 00080000
    ~1162 mmu set 00090000, pos 00090000
    ets Jun  8 2016 00:22:57
    

    I also tried lowering the SPI clock to 26MHz and doing and erase & reprogram but no dice.

  • Your board probably has a 26mhz crystal, and will only run at the moment with Espruino 1v97. I guess that could change in the next or future release.

    Background:

    http://forum.espruino.com/conversations/­324909/

    More here:

    https://esp32.com/viewtopic.php?t=2800

  • I tried 1v97 but no luck unfortunately.

    esptool --port /dev/cu.usbserial-DN02MPA4                         \
            --baud 921600                               \
            --after hard_reset write_flash              \
            -z                                          \
            --flash_mode dio                            \
            --flash_freq 26m                            \
            --flash_size detect \
    > 0x1000 bootloader.bin 0x8000 partitions_espruino.bin 0x10000 espruino_1v97_esp32.bin
    esptool.py v2.5.1-dev
    Serial port /dev/cu.usbserial-DN02MPA4
    Connecting.......
    Detecting chip type... ESP32
    Chip is ESP32D0WDQ6 (revision 0)
    Features: WiFi, BT, Dual Core
    MAC: 24:0a:c4:05:6f:c4
    Uploading stub...
    Running stub...
    Stub running...
    Changing baud rate to 921600
    Changed.
    Configuring flash size...
    Auto-detected Flash size: 4MB
    Flash params set to 0x0221
    Compressed 13344 bytes to 8838...
    Wrote 13344 bytes (8838 compressed) at 0x00001000 in 0.1 seconds (effective 953.9 kbit/s)...
    Hash of data verified.
    Compressed 3072 bytes to 162...
    Wrote 3072 bytes (162 compressed) at 0x00008000 in 0.0 seconds (effective 1534.6 kbit/s)...
    Hash of data verified.
    Compressed 930160 bytes to 520555...
    Wrote 930160 bytes (520555 compressed) at 0x00010000 in 11.4 seconds (effective 653.4 kbit/s)...
    Hash of data verified.
    
    Leaving...
    Hard resetting via RTS pin...
    
    [Maelstrom 21:30] ~/Downloads >cu -l /dev/cu.usbserial-DN02MPA4 -s 115200
    Connected.
    ets Jun  8 2016 00:22:57
    
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    ets Jun  8 2016 00:22:57
    
    rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_d­rv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:3
    load:0x3fff0018,len:4
    load:0x3fff001c,len:2364
    load:0x40078000,len:0
    load:0x40078000,len:10880
    entry 0x40078c4c
     �bp�x~�n�b
               |�n��8~�n���n�������Ă�#��#�n�r�l;|��n���­�Ă�#��#�n�����n�`�������nĒ�
                                                                                  �?�n��
    
  • OK. 1v96 might work too. I initially had to flash to 1v96 then up to 1v97.

    However, I've included here some files here that I built today (through the help of Wilberforce) for version 1v99 that resolves problems for me on a board with a 26mhz crystal. It might work for you.

    Also use "40m" for "--flash_freq" in your esptool, in addition to erasing the flash memory first.

    Like this,

    esptool.py --port  /dev/cu.usbserial-DN02MPA4  erase_flash
    

    then

    sudo esptool.py --chip esp32 --port "/dev/cu.usbserial-DN02MPA4" --baud 921600 write_flash -z --flash_mode "dio" --flash_freq "40m" 0x1000 bootloader.bin 0x10000 espruino_esp32.bin 0x8000 partitions_espruino.bin
    

    Let me know if it works, I'm curious.


    3 Attachments

  • It works for me. (At least the first test.) I can connect (after a reset) with espruino ide. Thanks!

  • Great! Good to know! :)

  • When will be get this into the main line? In the next stable release?

  • Yes. Espruinobuildtools has the new bootlpoader.bin. The problem is that the Travis builds only save latest firmware.bin, not the zip of the complete set.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Sparkfun ESP32 Thing

Posted by Avatar for Darius @Darius

Actions