Erratic behavior with change directory (CD)
Opened this issue · 16 comments
My first tests with the BETA PICO, while generally going well, have shown some recurring erratic behavior. Unfortunately nothing that can be systematically reproduce. That being said the following simple commands would 1 time out of 2 crash the PICO.
Fire up the 2068 (I always start with a freshly powered up 2068)
type:
SAVE « tpi:cd A-M »
The verbose mode shows that the command was successful and the current folder is now A-M
next type:
SAVE « tpi:cd B » (or A or something else that is present on the A-M folder)
The PICO start flashing quickly and never stops. Or the light goes out and PICO hangs.
As I said, it works about half of the time without problem. The verbose mode will report that the folder is now A-M/B. The other half there are problems.
note: obviously the double quote is the one from the TS-2068 with no space before or after the SAVE command, these are artefacts from the text editor of the Github bug report.
Francois
Same, Francois. I can't pin it down yet.
I've been trying to reproduce this misbehaviour with no luck (or is it "with luck"?) I rebooted, tried different action before and after, and nothing. I cannot make it fail.
Please take note of not issuing further commands until the LED starts slowly blinking again; it happened to me sometimes that I finished typing a command with the Pico still working, and led to crashes.
Also, I had MANY troubles with SD cards that get corrupted after several hangs, which could happen during beta testing. As a workaround, consider reformatting the SD card on a PC, of course with previous backup, restore the contents and see if the fail continues.
I did further tests. First I change the BETA PICO board to a new TS2068, but the problem persisted.
I check the same command sequence on my own PICO and could not reproduce the problem.
So it got me thinking: the most obvious difference between the two PICOs I can see right away is that the BETA PICO is in verbose mode. Next test I do is to remove verbose mode and try again. I will let you know.
Francois
I have only encountered this issue in the new software. I have installed the current software on a board, tested and change directory works fine. Upgraded the exact same board (and same SD card) and I encounter the same issue.
I do not have verbose mode enabled.
Francois, are you able to reliably reproduce the error?
Well, I seem to finally have nailed this down. For some reason, maybe related to the weird "bus sharing" solution implemented between the SD Card and the IO bus, sometimes in rapid CD commands, the SD card itself can't cope up, as you beta tester have cleverly noticed; so the os.chdir() command itself fails, even though is a perfectly valid command, and .... guess what....it LEAVES THE SD CARD MOUNTED! what could lead to possible corruptions. So, we might've found the two most annoying bugs so far, related to a single piece of code.
Lines # 1077-1081 now wrap the actual os.chdir() command in a try..except block, that reports a failure when attempting to chdir, again, even if the command itself is perfectly valid. Please try this version with a sample program as the following:
and you'll notice the program fails but both the TS and the Pico fully recover. Again, notice that the command fail even if it's a perfectly valid one.
Wow!
Great work rcalcagno. I will try out the new code this weekend. I don't have any free time before that.
I am having trouble mounting cartridges, but I'm also having trouble simply changing directories. This is with me using the most-up-to-date files when I restored my TS-Pico a couple of days ago. Now that I have access to GitHub again, perhaps this post belongs in the ticket thread for the Change Directory issues. For now, it's here on the discussion forum.
For instance, see the attached screenshot.
In the picture you'll see a directory listing of my TAP directory. Verbose is turned on. I tried to change to the DCK directory and I got the "Invalid I/O Command." Notice that verbose message tells me, "OS error changing to: DCK." I double-checked that the command was correct when I typed it.
With errors like this one, I begin to question my firmware again. Before I issued this CD command, I had just checked my microSD card in my Windows computer using chkdsk. There were no problems found. I did NOT reformat the microSD drive and move the files to it again. I have to trust chkdsk or how can I trust any of the files on my microSD card?
At a point like this one, I really do want to get the debug function working with Thonny and my TS-Pico. I believe that is the only way I'll be able to give usable feedback in a case like this one where my error reporting is vague.
Update:
When I began typing this message, I had not turned off the TS-Pico, nor had not rebooted the T/S 2068 after the directory error that I talk about above. This is good, as it leads me to another odd quirk that I can't explain.
After I typed this post, but before I sent it, I noticed that the fast-blinking on my TS-Pico had stopped. No LED was on at all. I'm not sure when that happened. It must have been about ten minutes after the above error occurred. Out of curiosity, I got a directory listing. I did not expect the TS-Pico to respond correctly. Instead, I got a directory listing, but not of the TAP directory. I got a directory with these files:
Notice that I did not change above the TAP directory to the "real" root directory. The last command I entered that gave me the error was meant to bring me into the DCK directory. After I issued the directory command that gave the above listing that I typed, the LED went from not blinking at all to the steady "heartbeat" blinking.
This seems weird, right?
When I come back into town this coming Sunday (Aug. 25), I'll still keep notes of what I do as I beta test the TS-Pico the following week, but I think I may also begin taking video of the TS-Pico and my TV for self-reference if I can manage to come up with an easy way to do it each time that I'm using the TS-Pico. It may help me (and others?) troubleshoot problems that I run into that are hard to track down using just my descriptions.
Adam
Adam: I don't see a DCK folder in your listing; please confirm you are standing on the right path. Also, it would be super useful if you can restore functionality of logging the error messages on Thonny's screen. Let us know.
Ricardo: Take a look at that picture of the directory listing of the TAP directory on my TS-Pico again. The DCK directory is certainly there in the TAP directory.
I highly doubt that I'll have time to get Thonny's error messages working before I leave town. It was never working for me. When I did try to use it, that was when I believe I messed up the firmware on the TS-Pico. How? I don't know.
I will certainly try my best to get logging/debugging working in Thonny when I get back into town. Not only will it be useful for when I need to post about problems I've encountered, but I'll be able to track down and fix issues that I encounter myself without needing to ask for help. That's the idea, anyway.
Adam
Sorry Ryan, I didn't pay enough attention. Next thing to check would be to try to swap SD cards with either the one on your old Pico, or a brand new one, to see whether the problem continues. Of course, in addition to the serial debugging.
Many thanks
This is Adam doing some testing here, not Ryan.
That first TS-Pico seemed to be working okay. It also has quirks, but I swapped microSD cards with my new TS-Pico. I get similar trouble.
Here's what I tested. This microSD card has just the TAP directory; it doesn't have the DCK or ROM directories on it. I changed into the A-M directory successfully. I tried to move into the L directory, but that failed. I tried a reboot of the T/S 2068, but I got the same issue again changing into the L directory.
I took the microSD card out of my TS-Pico and put it into my Windows 10 system. I checked that the L directory is valid. I can view the files on it on my Windows computer. I used chkdsk on my microSD card and the utility finds no issues.
Next, I could format the microSD card and move files to it again using my Windows computer. However, I hope that this won't be needed, as if I'm getting data corruption whenever I issue a command to the TS-Pico that doesn't work, then we need to fix that problem first.
I'm still chugging along. Maybe when I get back into town, Ryan and I can troubleshoot together again.
Adam, excuse my brain fart moment; I was reading through the thread and mistaken your name. So let me see if I get this clear:
- You have two SD Cards; both of them work consistently with your previous V1.0 TS-Pico, and none of them work consistently on the new V1.1 board
- Mainly all the issues you're encountering involve SD Card-related functions; that is, the few other functions (getlog, getinfo, gethelp, verbose, zx48) that do not involve SD Card perform consistently? Do you notice anything odd in them?
- Let us know if you can reliably use your TS-Pico/TS2068 and the USB debugging console via Thonny.
I am trying to assess whether this could be a hardware-related issue. Any of the other beta testers faced the same issues?
Thanks! Sincerely,
Ricardo
Ryan is smarter than me, so, Ricardo, it's okay for you to mistake me for him. You probably don't want to make the opposite mistake.
For reasons I won't get into here, we had to change our vacation trip plans at the last minute. So, I'm in town. That doesn't mean I'll be using my TS-Pico, but possibly I can play around with it. Or maybe I'll just wait until next week.
Answering your questions in order:
-
Yes, I have two TS-Pico cards. The first one has remained the same as it was shipped to me. I did have issues with that TS-Pico, but these seemed to be due to the CD command. I can use it again if needed. I could also upgrade it to firmware 1.1 if you like.
-
I'm not sure if I'm only having SD card-related problems with my TS-Pico. Those seem the most obvious, but I have not tested all the non-SD-related functions of the TS-Pico because I get held back with my encounters with errors when troubleshooting microSD card problems. So much of using the TS-Pico requires the SD card that it didn't occur to me to test all of the other commands.
-
I'll let you know if I can get logging working with the TS-Pico. I guess I should move that test from the back burner to a try-it-soon test. I am sort of worried about getting issues with the TS-Pico again, but I can always just restore it again if it comes to that outcome.
Even though I'm in town, I'm not sure if I'll have time to use the TS-Pico until next week. If I post here, or on the TS-Pico discussion forum, then you'll know I snuck in a few minutes to use the TS-Pico upgrade for my T/S 2068.
Adam
Enclosed please find my curent tspico.py script (renamed to .txt to upload) and firmware.uf2 into a .zip file