Switching Between WinUSB and MassStorage USB Modes

Can I understand, with fresh Windows, no matter win10 or 11, Pro or Home, everything just work? And we are on the same page now ?

For usb register delete, I am using this: View any installed/connected USB device on your system (nirsoft.net). Right click and select “Uninstall selected device”

Yes, at least for one specific instance of hardware.
The next test would be to install a new OS build on one of the PCs that currently has problems, if it fixes it then the problem is a software one, if not it is a hardware incompatability.
I can do that, basically just swapping a SSD, but it will have to wait until I get back.

1 Like

Sound better, we just sent a firmware update to you, please try and let us know the test result.

Hi Dat,

Improvements with 2.2.1.1000
I spent most of yesterday testing 2.2.1.1000 on various PCs, with mostly good results.
On one PC it took a long time (sometimes over a minute) for the drive to show up in Explorer, although it appeared immediately in Device Manager and USBDeview. I counted that as working.

Another one giving problems is a newish Dell PC, the problem with it is strange. If the device has been running in MassStorage since power-on, it will work immediately on the PC. however if it has ever been in WinUSB mode since power-on, it won’t ever appear in Explorer. The MassStorage (not WinUSB) device appears in Device Manager under “USB Devices” instead of “Disk Drives”, and stays there.
In USBDeview all the settings look correct for a MassStorage device. At this stage I’m treating this one as an outlier and keeping my “Reboot to MS mode” workaround as a configuration option.

Faster Response
This morning I installed 2.2.1.2000 and ran through the tests again. The PC that was taking over a minute to bring up the drive in Explorer now shows it almost immediately, big improvement, thanks!

Loss of “Eject”
One difference between the two versions, under 2.2.1.1000 if you tried to “Eject” a drive from Explorer it would change the device to “Suspended” state, and Windows would lock the drive to allow it to be removed. You could use the “Suspend” to change modes on the device.
Under 2.2.1.2000 you don’t get the “Suspend” state on Eject (although you still do if you unplug it), and Windows puts up a dialog saying it was unable to eject the device.

ADC Interaction
One other thing I’ve noticed while testing, there seems to be a side-effect between starting MassStorage mode and the ADC reading. Could this be caused by an incorrect register setting somewhere?

We have a task running every 100mS that does a couple of analog reads, one for battery voltage and one for a 2.5V external reference. Quite often (but not always) when changing to Mass Storage mode we get:

MassStorage Started
    #### Exception System.InvalidOperationException - CLR_E_INVALID_OPERATION (13) ####
    #### Message: 
    #### GHIElectronics.TinyCLR.Devices.Adc.Provider.AdcControllerApiWrapper::Read [IP: 0000] ####
    #### GHIElectronics.TinyCLR.Devices.Adc.AdcChannel::ReadValue [IP: 0012] ####
    #### AnodeMeter.Hardware.PhysicalBatteryCharge::PowerMonitor [IP: 006a] ####
Exception thrown: 'System.InvalidOperationException' in GHIElectronics.TinyCLR.Devices.Adc.dll

This probably happened with older firmware too, it has just become more obvious with current testing.
ADC channels being read are AdcController1.PC0 and AdcController3.PF9

Overall I’m very happy with the improved firmware, and I’m pushing these out ASAP.
Thanks for all your help!
David

1 Like

Yes, I think I know what “something” is. Glad to know it works.

Can you try to test on fresh machine? On my test, with all fw versions, I don’t get any even when “Eject”, I was thinking I should add something for this case, that will be better but it is not important because we have “disconnect” (or de-attach). And between 2.2.1.1000 and 2.21.2000 just one line of code, and that line is executed only when ms.Disable(). So make sure test same SDcard, same PC.

It could be because when you test old version, take 1 minutes. Let say issue is 20%, meaning 10 test in 10 min you can see only two times. Now it is about 5- 10 seconds on new version, for 10 tests in 2 minute you still see two times, that make you think it happens more often.

Anyway, if you try catch and read again OK, and this issue is not bother you, we will put it in lower priority.

Want Mass Storage
MassStorage changed to Attached 0.319 Sec
MassStorage changed to Suspended 0.323 Sec
MassStorage Started 0.327 Sec
MassStorage changed to Default 0.420 Sec
MassStorage changed to Address 0.516 Sec
MassStorage changed to Configured 0.544 Sec
MassStorage changed to Suspended 23.846 Sec

This is with new build PC, test code on Portal prints out device state events.
The change to “Suspended” occurs when you right-click Eject on the drive on the PC.
Also when you unplug the device, but can’t see that on Portal as it powers off when unplugged!

Yesterday this was happening with 2.2.1.1000 but not 2.2.1.2000, today after test PC was rebooted overnight it works with 2.2.1.2000, so I’m happy. No time to investigate more!

It could be because when you test old version, take 1 minutes. Let say issue is 20%, meaning 10 test in 10 min you can see only two times. Now it is about 5- 10 seconds on new version, for 10 tests in 2 minute you still see two times, that make you think it happens more often.

I didn’t think it happened more often, just that I was seeing it more as I was actively debugging the MassStorage changes.

Anyway, if you try catch and read again OK, and this issue is not bother you, we will put it in lower priority.

Yes, I was doing that anyway, so it wasn’t a problem.
I just thought that if a side-effect of starting Mass Storage was an error in ADC reading, which should be unrelated, that could be a pointer to an underlying problem which could be more serious.

On a separate matter, since installing firmware 2.2.1.1000 and 2.2.1.2000, I’ve been getting this message from TinyCLR Config:

Yes, that is because you are using older tinyclr config. The latest one is available on our download page today.

Got it, all good now.

Is there any chance for the next version TinyCLRConfig could remember the last Key used, or just fill it in with all 00-00-00… ? It is a pain having to Cut & Paste the same thing in every time.

Same with the version of the created app, could it default to the last one used (or incremented by1) to save having to look it up?