0

New MagTag with CircuitPython is looking for 'code.pq' inste
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

New MagTag with CircuitPython is looking for 'code.pq' inste

by sgoadhouse on Sun Mar 28, 2021 4:27 pm

I purchased a MagTag at the end of January and started playing with it today. I am also new to CircuitPython. Following instructions at https://learn.adafruit.com/creating-mag ... cuitpython I updated to the latest UF2 boot loader and I installed the latest stable MagTag UF2 image: v6.1.0. After reset, I got an error message:

Code: Select all | TOGGLE FULL SIZE
code.py output:
OSError: [Errno 2] No such file/directory: 'code.pq'

Code done running


I cannot find any mention of this error on adafruit.com. It appears as if the MagTag is getting letters confused and is looking for 'code.pq' instead of 'code.py'. So I created a file named 'code.pq' and entered:

Code: Select all | TOGGLE FULL SIZE
print("Hello World")



Now, the MagTag says:

Code: Select all | TOGGLE FULL SIZE
code.py output:
Traceback (most recent call last):
  File "code.py", line 1, in <module>
NameError: name 'prant' is not defined

Code done running.


It is as if the MagTag read the command 'print' as 'prant'. So I connected over serial to the REPL. If I type 'help()' I get the error message: 'NotImplementedError: byte code not implemented' If I then use the Up Arrow to repeat the command, it now shows as 'hedp()'. I can sometimes edit the line and I get the proper help message but not always.

I was doing all of this on my MacBook Pro so I moved to a Windows 10 machine. Same result. I also tried MagTag UF2 image, 6.2.0-beta.4, as well as the latest nightly build and got the exact same result. I even tried 3 other USB cables. Same result.

It seems as if something is wrong with the ESP32-S2 module but it is extremely odd.

sgoadhouse
 
Posts: 12
Joined: Mon Jul 13, 2009 6:59 pm

Re: New MagTag with CircuitPython is looking for 'code.pq' i

by tannewt on Mon Mar 29, 2021 4:31 pm

What language is your OS using? Maybe it's misinterpreting the character encoding of CircuitPython (should be UTF-8.)

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

Re: New MagTag with CircuitPython is looking for 'code.pq' i

by sgoadhouse on Mon Mar 29, 2021 10:49 pm

Good question. I was wondering about that too but did not think to check. I just checked now and got the below. Seems to be correct.

Code: Select all | TOGGLE FULL SIZE
% locale   
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=

sgoadhouse
 
Posts: 12
Joined: Mon Jul 13, 2009 6:59 pm

Re: New MagTag with CircuitPython is looking for 'code.pq' i

by tannewt on Tue Mar 30, 2021 12:58 pm

Do you have any other boards that run CircuitPython? I wonder if they work ok. Also, what terminal program(s) are you using?

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

Re: New MagTag with CircuitPython is looking for 'code.pq' i

by sgoadhouse on Wed Mar 31, 2021 11:14 am

I do have a PyPortal that I never got around to trying. That may be good to try to verify my system.

I used 'screen' on the Mac which I use just about everyday for work. I also downloaded Mu to my Mac since it was recommended. When I tried a Windows 10 machine, I installed Putty and used that. All three had the same oddity where the echoed letters were correct, REPL complained about the entry and then Up Arrow revealed a letter or two changed from what I had typed.

Something I did not mention but I have been wondering about - I did attempt to program the CircuitPython binary image using esptool.py to see if that would make a difference from installing via UF2. In this case, it would not boot at all. I used esptool.py to reinstall the UF2 bootloader and then installed the CircuitPython UF2 image, which worked. That could be a clue that there is something wrong with the module/board like with memory where the CircuitPython bin image hits one of the impacted areas but UF2 loader + CircuitPython UF2 misses it mostly except for this input issue.

I took a close look at the soldering of the ESP32S2 module. It looks ok but there were a few suspicious pads. I do not have much experience inspecting the soldering of a castellated module.

I will give the PyPortal a try (been meaning to). If I can get that working as expected, then I believe we should consider this some odd hardware issue and the MagTag needs to be replaced.

sgoadhouse
 
Posts: 12
Joined: Mon Jul 13, 2009 6:59 pm

Re: New MagTag with CircuitPython is looking for 'code.pq' i

by sgoadhouse on Wed Mar 31, 2021 10:04 pm

I spent some quality time with my PyPortal and CircuitPython and my MacBook Pro. I had absolutely no issues. I updated the ESP32 firmware as well as CircuitPython and its libraries to 6.1.0. I followed through the tutorials on editing the code.py file and on using REPL through the serial port. All of that worked as expected. I was able to copy over many example files and they all worked as expected.

So there should be no issues with using my MacBook Pro and CircuitPython boards in general.

I went back to the MagTag and connected it to a Windows 10 machine. I then went through the process of Erasing the Flash, loading in the UF2 bootloader and then loading in CircuitPython 6.1.0. Although I had no problems with the PyPortal and the MacBook Pro, I do get those annoying "Disk Not Ejected Properly" messages when the CircuitPython device resets itself. So I wanted to see if reflashing the MagTag on a Windows 10 machine, where you do not get such messages, would solve the problem. Unfortunately, it did not. The problem still exists.

I also found that if I try several times to type in the command in REPL on the MagTag, it may eventually work. So the letter changing is not as deterministic as I had thought. I just had not been as stubborn as I needed to be. It took 5 or 6 times to get a single command to work. Once the command was accepted without any characters changed, the command appeared to work correctly. It still makes the MagTag unusable but it is interesting that the issue is intermittent.

sgoadhouse
 
Posts: 12
Joined: Mon Jul 13, 2009 6:59 pm

Re: New MagTag with CircuitPython is looking for 'code.pq' i

by tannewt on Thu Apr 01, 2021 5:37 pm

Please post a picture of the USB connector on the MagTag. It does sound like a weird USB hardware issue.

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

Re: New MagTag with CircuitPython is looking for 'code.pq' i

by sgoadhouse on Fri Apr 02, 2021 11:04 am

Using my USB microscope, I took this image which shows the connector and surrounding components. From this distance, the shield pins on the USB connector look sloppy but good enough. The soldering of the passives looks good.
IMG_003.JPG
USB Connector and surrounding components
IMG_003.JPG (469 KiB) Viewed 77 times


I zoomed in further and in my opinion, the USB connector pins appear as if the solder did not flow properly. Obviously the solder got soft but you do not see any wicking of the solder along the sides of the pins. This image is of the worse pins but all of the non-shield pins look like this. The solder is pillowed around the pins and not wicked. I think this could be the problem. There may be enough of a connection to mostly function but with flaky results, which is what I am experiencing. It does not explain how I was able to successfully update firmware on the board unless there is a checksum/CRC and retries on failure.
IMG_005.JPG
Up close view of some pins
IMG_005.JPG (383.5 KiB) Viewed 77 times

sgoadhouse
 
Posts: 12
Joined: Mon Jul 13, 2009 6:59 pm

Re: New MagTag with CircuitPython is looking for 'code.pq' i

by adafruit_support_carter on Fri Apr 02, 2021 12:50 pm

That soldering actually doesn't look too bad. I think there's something super extra special going on with that MagTag. Let's just replace it. Thanks for all the info and attempts to troubleshoot.

Send an email to support@adafruit.com with a link to this thread and your order number and they can send you a replacement MagTag.

adafruit_support_carter
 
Posts: 19772
Joined: Tue Nov 29, 2016 2:45 pm

Re: New MagTag with CircuitPython is looking for 'code.pq' i

by sgoadhouse on Fri Apr 09, 2021 4:45 pm

I got really lucky and more MagTags came in this week so I could nab a RMA one. I just received it today and this one works as it should. 'code.py' executes correctly with no funny character changes. I was able to install one of the OpenWeather examples and it runs and looks great. Thanks for your help. I may try to reflow the solder on the USB connector and the ESP module to see if one of those actions fixes it. If I manage to get the old one working, I will post what worked in case it is useful to someone else in the future. I do not have high hopes that it will ever work correctly.

sgoadhouse
 
Posts: 12
Joined: Mon Jul 13, 2009 6:59 pm

Re: New MagTag with CircuitPython is looking for 'code.pq' i

by adafruit_support_carter on Fri Apr 09, 2021 5:18 pm

Yeah! Glad the replacement one worked.

Yah, share anything you find out about that other one. It's a bit of a mystery, so would be interesting to know what it might be related to.

Have fun!

adafruit_support_carter
 
Posts: 19772
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.