0

Getting Started with FeatherS2 esp32-2
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Getting Started with FeatherS2 esp32-2

by cattledog on Tue Jan 12, 2021 12:40 pm

I am getting started with the a new FeatherS2, and find that the most simple code will not run from usb load.
CIRCUITPY(G:) is present.
CircuitPython installed for the board is: adafruit-circuitpython-unexpectedmaker_feathers2-en_US-6.1.0-rc.0.uf2. I have also tried version 6.0.0
Mu is installed and Adafruit mode selected.

This test code will run in REPL (without the while loop, but with multiple print/sleep statements) but there is no serial output from the usb download.
Code: Select all | TOGGLE FULL SIZE
import board
import time
while True:
    print("hello")
    time.sleep(2)


When attempting to run this blink code from usb download the led does not blink, but I can get the board to blink with statements in REPL.

Code: Select all | TOGGLE FULL SIZE
import board
import digitalio
import time

led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT

while True:
    led.value = True
    time.sleep(2)
    led.value = False
    time.sleep(2)
    print("hello")


One observation is that while G: shows the 6.1.0 version, the REPL tag shows 6.0.0
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 6.0.0 on 2020-11-16; FeatherS2 with ESP32S2


Another finding is that the print code will run correctly with serial output in Mu when the Python mode is selected.

What do you recommend?

cattledog
 
Posts: 10
Joined: Tue Jan 12, 2021 12:11 pm

Re: Getting Started with FeatherS2 esp32-2

by tannewt on Tue Jan 12, 2021 12:45 pm

It sounds like you may not have updated to 6.1.0 correctly. The serial output should show the newer version number. I suspect you copied the UF2 to the CIRCUITPY drive instead of the BOOT drive.

You should definitely use the latest pre-release. The ESP32-S2 code is improving quickly so you should use the latest pre-release.

tannewt
 
Posts: 2034
Joined: Thu Oct 06, 2016 8:48 pm

Re: Getting Started with FeatherS2 esp32-2

by cattledog on Tue Jan 12, 2021 12:52 pm

I suspect you copied the UF2 to the CIRCUITPY drive instead of the BOOT drive.

Thanks for your speedy reply.
The board came with the bootloader installed and I have never seen the BOOT drive. How do I get the 6.1.0 version on the BOOT drive if that's where it needs to be.

cattledog
 
Posts: 10
Joined: Tue Jan 12, 2021 12:11 pm

Re: Getting Started with FeatherS2 esp32-2

by kevinjwalters on Tue Jan 12, 2021 1:37 pm

These boards are atypical with a RST (reset) button and a BOOT (button). I think I've been pressing RST and then BOOT to get the UFTHRS2BOOT drive to appear. but here's the official instructions from the FAQ on https://feathers2.io/

How can I get my FeatherS2 into UF2 bootloader mode?

If your FeatherS2 shipped with the UF2 bootloader, you can click [RESET], then click [BOOT] to get it into the UF2 bootloader mode. You will then see the RGB LED on your FeatherS2 turn Red while the device is unmounted, and then once mounted, it will turn green.

A drive will appear in your filesystem called UFTHRS2BOOT. From here you can re-flash the latest CircuitPython firmware by copying over the firmware.uf2 file for the version you want to install.

kevinjwalters
 
Posts: 836
Joined: Sun Oct 01, 2017 3:15 pm

Re: Getting Started with FeatherS2 esp32-2

by cattledog on Tue Jan 12, 2021 2:29 pm

These boards are atypical with a RST (reset) button and a BOOT (button). I think I've been pressing RST and then BOOT to get the UFTHRS2BOOT drive to appear. but here's the official instructions from the FAQ on https://feathers2.io/


Yes I have been following the RST and BOOT button sequence but I never see the UFTHRS2BOOT drive to appear. I still only see CIRCUITPY G:

The faq in the feather2io link states
My FeatherS2 doesn't go into UF2 bootloader mode!
If you can't get your FeatherS2 into UF2 bootloader mode, it means your board shipped to you prior to the UF2 bootloader being ready for the ESP32S2. Sorry!

It is possible to flash your FeatherS2 with the latest UF2 bootloader by following the instructions I have put together in this guide.


I have tried to follow the instructions in the link https://feathers2.io/install_uf2.html but I have not been successful. I can seem to get the command prompt to respond
C:\Users\cattledog>esptool.py --chip esp32s2 -p COM5 -b 921600 --before=default_reset --after=no_reset write_flash --flash_mode dio --flash_size detect --flash_freq 80m 0x1000 bootloader.bin 0x8000 partition-table.bin 0xe000 ota_data_initial.bin 0x410000 tinyuf2.bin
'esptool.py' is not recognized as an internal or external command,
operable program or batch file.


If anyone can guide me through this lower level stuff I would appreciate it.

cattledog
 
Posts: 10
Joined: Tue Jan 12, 2021 12:11 pm

Re: Getting Started with FeatherS2 esp32-2

by kevinjwalters on Tue Jan 12, 2021 2:44 pm

If you have esptool.py in the current directory then Windows needs .\esptool.py to explicitly execute it from there. This may have changed from the dark days of MS-DOS many decades back.

kevinjwalters
 
Posts: 836
Joined: Sun Oct 01, 2017 3:15 pm

Re: Getting Started with FeatherS2 esp32-2

by nealdt on Tue Jan 12, 2021 2:44 pm

cattledog wrote:I have tried to follow the instructions in the link https://feathers2.io/install_uf2.html but I have not been successful. I can seem to get the command prompt to respond
C:\Users\cattledog>esptool.py --chip esp32s2 -p COM5 -b 921600 --before=default_reset --after=no_reset write_flash --flash_mode dio --flash_size detect --flash_freq 80m 0x1000 bootloader.bin 0x8000 partition-table.bin 0xe000 ota_data_initial.bin 0x410000 tinyuf2.bin
'esptool.py' is not recognized as an internal or external command,
operable program or batch file.


If anyone can guide me through this lower level stuff I would appreciate it.


You probably just need to install esptool with pip on a terminal:

Code: Select all | TOGGLE FULL SIZE
pip install esptool


(possibly "pip3" instead of "pip")

and then try running your command again.

nealdt
 
Posts: 18
Joined: Mon Feb 10, 2020 5:31 pm

Re: Getting Started with FeatherS2 esp32-2

by cattledog on Tue Jan 12, 2021 4:20 pm

install esptool with pip on a terminal:


I ran pip3 and installed esptool. It was confirmed
Code: Select all | TOGGLE FULL SIZE
C:\Users\cattledog>pip3 install esptool
Requirement already satisfied: esptool in c:\users\cattledog\appdata\local\programs\python\python36\lib\site-packages (3.0)
Requirement already satisfied: bitstring>=3.1.6 in c:\users\cattledog\appdata\local\programs\python\python36\lib\site-packages (from esptool) (3.1.7)
Requirement already satisfied: cryptography>=2.1.4 in c:\users\cattledog\appdata\local\programs\python\python36\lib\site-packages (from esptool) (3.3.1)
Requirement already satisfied: ecdsa>=0.16.0 in c:\users\cattledog\appdata\local\programs\python\python36\lib\site-packages (from esptool) (0.16.1)
Requirement already satisfied: pyserial>=3.0 in c:\program files\mu\pkgs (from esptool) (3.4)
Requirement already satisfied: reedsolo<=1.5.4,>=1.5.3 in c:\users\cattledog\appdata\local\programs\python\python36\lib\site-packages (from esptool) (1.5.4)
Requirement already satisfied: six>=1.4.1 in c:\program files\mu\pkgs (from cryptography>=2.1.4->esptool) (1.11.0)
Requirement already satisfied: cffi>=1.12 in c:\users\cattledog\appdata\local\programs\python\python36\lib\site-packages (from cryptography>=2.1.4->esptool) (1.14.4)
Requirement already satisfied: pycparser in c:\users\cattledog\appdata\local\programs\python\python36\lib\site-packages (from cffi>=1.12->cryptography>=2.1.4->esptool) (2.20)


Then I ran the command line prompt (as given in the UM link) as administrator and got this error.
Code: Select all | TOGGLE FULL SIZE
C:\WINDOWS\system32>esptool.py --chip esp32s2 -p COM5 -b 921600 --before=default_reset --after=no_reset write_flash --flash_mode dio --flash_size detect --flash_freq 80m 0x1000 bootloader.bin 0x8000 partition-table.bin 0xe000 ota_data_initial.bin 0x410000 tinyuf2.bin
usage: esptool write_flash [-h] [--erase-all]
                           [--flash_freq {keep,40m,26m,20m,80m}]
                           [--flash_mode {keep,qio,qout,dio,dout}]
                           [--flash_size FLASH_SIZE]
                           [--spi-connection SPI_CONNECTION] [--no-progress]
                           [--verify] [--encrypt]
                           [--ignore-flash-encryption-efuse-setting]
                           [--compress | --no-compress]
                           <address> <filename> [<address> <filename> ...]
esptool write_flash: error: argument <address> <filename>: [Errno 2] No such file or directory: 'bootloader.bin'


bootloader.bin is one of the files supplied by UM and is in the folder in downloads esptool-master
That esptool-master is not one of the ones shown in the esptool locations. The command line appears to be running esptool, but its not finding what it needs.

I was never very good at dos, and this is getting very frustrating. So much for CircuitPython being beginner friendly :-(

Bottom line, I can't get the FeatherS2 into bootloader mode so I can install the correct CircuitPython version required. The board arrived yesterday from Adafruit, and I'm a little surprised that they carry a version which is so difficult to get going.

cattledog
 
Posts: 10
Joined: Tue Jan 12, 2021 12:11 pm

Re: Getting Started with FeatherS2 esp32-2

by nealdt on Tue Jan 12, 2021 4:41 pm

cattledog wrote:
Code: Select all | TOGGLE FULL SIZE
esptool write_flash: error: argument <address> <filename>: [Errno 2] No such file or directory: 'bootloader.bin'


bootloader.bin is one of the files supplied by UM and is in the folder in downloads esptool-master
That esptool-master is not one of the ones shown in the esptool locations. The command line appears to be running esptool, but its not finding what it needs.


You're so close! You just need to run esptool.py from the same directory as where your bootloader.bin file is. The easiest way would be to find bootloader.bin in Windows Explorer, then copy the folder path from the address bar. (It should look something like "C:\Users\blahblah\Downloads\esptool-master"). Next, in your terminal, change the "working directory" to the path you copied, using
Code: Select all | TOGGLE FULL SIZE
cd **path you copied**


(without the asterisks.) Then run esptool.py one more time.

nealdt
 
Posts: 18
Joined: Mon Feb 10, 2020 5:31 pm

Re: Getting Started with FeatherS2 esp32-2

by cattledog on Tue Jan 12, 2021 5:23 pm

You just need to run esptool.py from the same directory as where your bootloader.bin file is.


Yes, I'm trying to do that, but the esptool.py in the file with bootloader.bin and the other UM files is a "shortcut" to some other python file and doesn't run. So, I added an .exe version of esptool.py in the file but still get an error when I run the command line.

Code: Select all | TOGGLE FULL SIZE
C:\Users\cattledog\Downloads\esptool-master\esptool-master>esptool.py.exe>--chip esp32s2 -p COM5 -b 921600 --before=default_reset --after=no_reset write_flash --flash_mode dio --flash_size detect --flash_freq 80m 0x1000 bootloader.bin 0x8000 partition-table.bin 0xe000 ota_data_initial.bin 0x410000 tinyuf2.bin
Cannot open C:\Users\cattledog\Downloads\esptool-master\esptool-master\esptool.py-script.py


Code: Select all | TOGGLE FULL SIZE
Directory of C:\Users\cattledog\Downloads\esptool-master\esptool-master

01/12/2021  01:09 PM    <DIR>          .
01/12/2021  01:09 PM    <DIR>          ..
01/12/2021  09:18 AM    <DIR>          .github
01/12/2021  09:18 AM                98 .gitignore
01/12/2021  09:18 AM             5,652 .gitlab-ci.yml
01/12/2021  09:18 AM             1,356 .travis.yml
01/12/2021  09:50 AM            22,752 bootloader.bin
01/12/2021  09:18 AM             2,855 CONTRIBUTING.md
01/12/2021  09:18 AM             6,230 espefuse.py
01/12/2021  09:38 AM    <DIR>          espressif
01/12/2021  09:18 AM            41,703 espsecure.py
01/12/2021  11:30 AM                 0 esptool.py
01/12/2021  11:28 AM            74,752 esptool.py.exe
01/12/2021  09:18 AM            10,505 esp_rfc2217_server.py
01/12/2021  09:18 AM    <DIR>          flasher_stub
01/12/2021  09:18 AM            18,092 LICENSE
01/12/2021  09:18 AM               252 MANIFEST.in
01/12/2021  09:50 AM             8,192 ota_data_initial.bin
01/12/2021  09:50 AM             3,072 partition-table.bin
01/12/2021  09:18 AM            27,111 README.md
01/12/2021  09:18 AM               959 setup.cfg
01/12/2021  09:18 AM             4,438 setup.py
01/12/2021  09:18 AM    <DIR>          test
01/12/2021  09:50 AM           131,616 tinyuf2.bin
01/12/2021  09:38 AM    <DIR>          __pycache__
              18 File(s)        359,635 bytes
               7 Dir(s)  855,931,518,976 bytes free

C:\Users\cattledog\Downloads\esptool-master\esptool-master>esptool.py.exe>--chip esp32s2 -p COM5 -b 921600 --before=default_reset --after=no_reset write_flash --flash_mode dio --flash_size detect --flash_freq 80m 0x1000 bootloader.bin 0x8000 partition-table.bin 0xe000 ota_data_initial.bin 0x410000 tinyuf2.bin
Cannot open C:\Users\cattledog\Downloads\esptool-master\esptool-master\esptool.py-script.py


On the Adafruit discord forum I see reference to a new UF2 bootloader tool for the S2. Will that be of use to me even though I cant get into bootloader mode?

cattledog
 
Posts: 10
Joined: Tue Jan 12, 2021 12:11 pm

Re: Getting Started with FeatherS2 esp32-2

by nealdt on Tue Jan 12, 2021 5:34 pm

I'm not an expert, but I think you don't want to run the esptool stuff that's in the esptool-master repository that you cloned. When you ran esptool.py from C:\Windows\System32, it was running the script you installed earlier with pip3 install esptool. But if you run esptool.py in the esptool-master folder, it seems like it's running a different file with the same name. Try copying bootloader.bin to a different folder, and running the original command (*not* esptool.py.exe) from that folder.

nealdt
 
Posts: 18
Joined: Mon Feb 10, 2020 5:31 pm

Re: Getting Started with FeatherS2 esp32-2

by cattledog on Tue Jan 12, 2021 6:02 pm

Progress!

I placed all the UM .bin files in a folder and ran the command line, but it timed out rather than connect.

Code: Select all | TOGGLE FULL SIZE
01/12/2021  09:50 AM    <DIR>          .
01/12/2021  09:50 AM    <DIR>          ..
01/12/2021  09:50 AM            22,752 bootloader.bin
01/12/2021  09:50 AM             8,192 ota_data_initial.bin
01/12/2021  09:50 AM             3,072 partition-table.bin
01/12/2021  09:50 AM           131,616 tinyuf2.bin
01/12/2021  09:50 AM    <DIR>          __MACOSX
               4 File(s)        165,632 bytes
               3 Dir(s)  855,938,142,208 bytes free

C:\Users\cattledog\Downloads\UMfiles>esptool.py --chip esp32s2 -p COM5 -b 921600 --before=default_reset --after=no_reset write_flash --flash_mode dio --flash_size detect --flash_freq 80m 0x1000 bootloader.bin 0x8000 partition-table.bin 0xe000 ota_data_initial.bin 0x410000 tinyuf2.bin
esptool.py v3.0
Serial port COM5
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32-S2: Timed out waiting for packet header


What UM says I should see
Code: Select all | TOGGLE FULL SIZE
esptool.py v3.0
Serial port /dev/cu.usbmodem01
Connecting....
Chip is ESP32-S2
Features: WiFi, ADC and temperature sensor calibration in BLK2 of efuse
Crystal is 40MHz
MAC: 7c:df:a1:00:8c:18
Uploading stub...
Running stub...
Stub running..


Hardware manager confirms COM5 comes and goes when I connect and disconnect the FeatherS2.

cattledog
 
Posts: 10
Joined: Tue Jan 12, 2021 12:11 pm

Re: Getting Started with FeatherS2 esp32-2

by nealdt on Tue Jan 12, 2021 6:15 pm

Did you put the feather into boot mode using the BOOT and RESET buttons right before running esptool? If so, someone else will have to help, we're beyond my knowledge now :(.

nealdt
 
Posts: 18
Joined: Mon Feb 10, 2020 5:31 pm

Re: Getting Started with FeatherS2 esp32-2

by cattledog on Tue Jan 12, 2021 7:10 pm

Well, I certainly feel foolish but I finally did manage to find the correct sequence of RST/BOOT button presses to get the Feather S2 into bootloader mode. All kinds of flashing lights and I see the bootloader drive. The problem is now that when I try to drag the CP version file (both 6.0.1 and 6.1.1.) to the UFTHRS2BOOT(G:) it gets about 80% loaded and then comes up with an error message

Error 0x800701B1: A device which does not exist was specified


The CP file does not show in UFTHRS2BOOT when I go into bootloader mode again, and the programs do not run.

Interestingly, the version number of what I tried to copy into the boot drive does show in the REPL report, but the programs do not run.

cattledog
 
Posts: 10
Joined: Tue Jan 12, 2021 12:11 pm

Re: Getting Started with FeatherS2 esp32-2

by nealdt on Tue Jan 12, 2021 7:33 pm

That's great!

I often see the same behavior as you in Windows when dragging a .UF2 file to an attached device: progress bar almost to the end, then a Windows error. I don't believe this is actually an issue -- it's never been for me. You don't see a CP file on UFTHRS2BOOT because it's not really a file; by "copying" the UF2 to the drive in boot mode, you're actually writing to the flash memory of the microcontroller, not to the filesystem (as I understand it). So it doesn't show up as a file; it just causes new programming to be written to the device, which should allow it to reboot as a CircuitPython device with a code.py that you can edit. For that, you may need to use the RESET button (not BOOT) -- after that (fingers crossed), the device should show up as CIRCUITPY instead of UFTHRS2BOOT.

nealdt
 
Posts: 18
Joined: Mon Feb 10, 2020 5:31 pm

Please be positive and constructive with your questions and comments.