Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

MAGTAG - esptool.py NOT detecting chip
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MAGTAG - esptool.py NOT detecting chip

by wavesailor on Wed Oct 27, 2021 7:05 pm

Hi all,

I am finally trying to use my MagTag for the first time but I'm unable to connect to it
I plug it into my laptop running windows 10 and it shows up as below:

Devicemanager.png
Devicemanager.png (46.54 KiB) Viewed 107 times


I then run esptool.py and get the following error:

Code: Select all | TOGGLE FULL SIZE
esptool.py --port COM5 chip_id
esptool.py v3.2
Serial port COM5
Connecting.....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting...
Traceback (most recent call last):
  File "c:\users\JJ\appdata\local\programs\python\python39\lib\site-packages\esptool.py", line 377, in detect_chip
    res = struct.unpack("<IBBBBBBBBI", res[:16])  # 4b flags, 1b flash_crypt_cnt, 7*1b key_purposes, 4b chip_id
struct.error: unpack requires a buffer of 16 bytes


I did try on another laptop but got exactly the same results.
Not sure how to resolve this??

Thanks

wavesailor
 
Posts: 15
Joined: Thu Aug 25, 2016 12:42 pm

Re: MAGTAG - esptool.py NOT detecting chip

by danhalbert on Thu Oct 28, 2021 11:19 am

You need to get it into boot mode. Hold down the boot button and press the reset button, and then release the boot button.

danhalbert
 
Posts: 2629
Joined: Tue Aug 08, 2017 12:37 pm

Re: MAGTAG - esptool.py NOT detecting chip

by wavesailor on Thu Oct 28, 2021 11:41 am

danhalbert wrote:You need to get it into boot mode. Hold down the boot button and press the reset button, and then release the boot button.


Thanks but it was in Boot mode.


It would not get to this if it was not in Boot Mode
Code: Select all | TOGGLE FULL SIZE
Connecting.....
Detecting chip type...

wavesailor
 
Posts: 15
Joined: Thu Aug 25, 2016 12:42 pm

Re: MAGTAG - esptool.py NOT detecting chip

by danhalbert on Thu Oct 28, 2021 11:50 am

I am seeing the same problem with esptool.py V3.2. Try reverting to V3.1. If you installed with pip, you can do
`pip [or pip3] install esptool==3.1`.

`chip_id` does not fail immediately after `flash_erase`, but if I load a .bin, then it fails again. I have filed an issue on esptool.py about this:

https://github.com/espressif/esptool/issues/685

Thanks for reporting this.

danhalbert
 
Posts: 2629
Joined: Tue Aug 08, 2017 12:37 pm

Re: MAGTAG - esptool.py NOT detecting chip

by wavesailor on Thu Oct 28, 2021 12:40 pm

Thanks for feedback.

I did as you mentioned:
Code: Select all | TOGGLE FULL SIZE
C:\Users\JJ>pip check esptool
No broken requirements found.

C:\Users\JJ>pip show esptool
Name: esptool
Version: 3.1
Summary: A serial utility to communicate & flash code to Espressif ESP8266 & ESP32 chips.
Home-page: https://github.com/espressif/esptool
Author: Fredrik Ahlberg (themadinventor) & Angus Gratton (projectgus)
Author-email: angus@espressif.com
License: GPLv2+
Location: c:\users\JJ\appdata\local\programs\python\python310\lib\site-packages
Requires: bitstring, cryptography, ecdsa, pyserial, reedsolo
Required-by:


But esptool.py does not seem to work now - it just gives a blank screen:
Code: Select all | TOGGLE FULL SIZE
C:\Users\JJ>esptool.py --version

C:\Users\JJ>


I'm on windows 10 with Python 3.10.0

wavesailor
 
Posts: 15
Joined: Thu Aug 25, 2016 12:42 pm

Re: MAGTAG - esptool.py NOT detecting chip

by danhalbert on Thu Oct 28, 2021 2:44 pm

I would say to try rolling back Python to 3.9. I was not able to reproduce that specific problem with Python 3.10 on Ubuntu 20.04.
To check the version, use `esptool.py version` (without the "--"). But you should have gotten an error otherwise.

DId you install esptool with pip the first time around?

danhalbert
 
Posts: 2629
Joined: Tue Aug 08, 2017 12:37 pm

Re: MAGTAG - esptool.py NOT detecting chip

by danhalbert on Thu Oct 28, 2021 3:00 pm

The esptool folks suggest specifying the chip explicitly. That may help you work around all this for now:
https://github.com/espressif/esptool/is ... -954015265

danhalbert
 
Posts: 2629
Joined: Tue Aug 08, 2017 12:37 pm

Re: MAGTAG - esptool.py NOT detecting chip

by wavesailor on Thu Oct 28, 2021 5:01 pm

Hey Dan,

I found my problem: I think in did this
Code: Select all | TOGGLE FULL SIZE
pip install esptool.py esptool==3.1

This created an empty file(esptool.py) in my current directory.
Once I deleted it, then version 3.1 of esptool.py worked perfectly.

Thanks.

wavesailor
 
Posts: 15
Joined: Thu Aug 25, 2016 12:42 pm

Please be positive and constructive with your questions and comments.