toolchain icon indicating copy to clipboard operation
toolchain copied to clipboard

msd_Close causes the calculator to freeze with certain flashdrives.

Open TheMiningTeamYT opened this issue 1 year ago • 4 comments

          I think you've convinced me - hopefully in your program you can work around it your code for now until I get the time to fix it. Yes, please make another issue and document the drive you are using (maybe an Amazon link too)

Originally posted by @mateoconlechuga in https://github.com/CE-Programming/toolchain/issues/475#issuecomment-1922252927

Well then. If you initialize a USB flash drive using USBDRVCE and msd_Open from MSDDRVCE, then try to deinitialize that flash drive using msd_Close, with some flash drives, it will freeze and require the calculator to be reset. If you remove the msd_Close call, the calculator will not freeze. The drive I'm using is a SanDisk Cruzer Micro U3 16GB (something like this) The code I experienced this issue with can be found here. As it stands, accessing the flash drive doesn't cause the calculator to freeze, however, if you uncomment the msd_Close call in closeUSB in usb.c and rebuild, the calculator will freeze every time after the drive is accessed, when closeUSB is called. I personally suspect this error is specific to this 1 ancient flash drive, so if there's anything you'd like me to do, any data you'd like me to collect, let me know.

TheMiningTeamYT avatar Feb 01 '24 23:02 TheMiningTeamYT

By the way, I noticed in your list of supported flash drives, you have a SanDisk Ultra 32GB listed. However, when I tried plugging one of my SanDisk Ultra 32GB drives into my calculator, it caused the calculator to stop responding until I unplugged it. (As in, I was in Cesium, I plugged in the flash drive, then it stopped responding to the keyboard until the instant I unplugged it). I wonder what's up with that. I'm plugging the flash drive directly into my calculator using a USB on the go mini B to full A adapter, if that helps.

TheMiningTeamYT avatar Feb 01 '24 23:02 TheMiningTeamYT

Ok update, while attempting to gather some data on what exactly is going on, I discovered that: A: The file does actually get written to the flash drive successfully and B: The calculator does reset on it's own after a strangely long time (Possibly minutes -- I didn't catch exactly when it reset)

TheMiningTeamYT avatar Feb 02 '24 01:02 TheMiningTeamYT

More updates: I have an msd_Close call in my USB_DEVICE_DISCONNECTED_EVENT handler, as shown in the FATDRVCE examples. If I remove that, calling msd_Close no longer causes the calculator to hang until you reset, only hang until you unplug the flash drive (which is the same behavior with this flash drive in Cesium) (this is different from the behavior I observed with my SanDisk Ultra. That causes the calculator to hang as soon as it is plugged in, whereas here it's hanging when the flash drive is uninitialized.)

TheMiningTeamYT avatar Feb 02 '24 02:02 TheMiningTeamYT

I have ordered a SanDisk Cruzer Micro U3 16GB and will update this issue with findings once I get it on the 15th

mateoconlechuga avatar Feb 08 '24 05:02 mateoconlechuga