I currently have quite often issue while debugging a program
I have a very simple program used to test a rain gauge (rainsensors.com).
connected to a fez portal. communication is done via Uart. so, something simple.
I can start the debug several times without issues till I got the error (see screenshot).
Device is gone and the only way the get it back in is to reboot
It doesn’t appears in TinyClr confog (last version) nor in device manager
The first trial was with VS2022 (firmware 18.104.22.16800). I switch back to VS2019 and reinstalled the firmware 22.214.171.12400 even if i don’t think this was needed) but have the same issue
I have windows 11.
I stay a while without playing with tinyClr. I had this issue in the past, but not that often
Is it a frequent behavior ?
Would it help if I delete the app using TinyClr config
Do you have a powered hub? How are you powering up your device?
The portal, with its display, draws plenty of power that USB without a powered hub may not always work properly.
Yes, I remember that;
The one I use should be ok
ha ha, yes an industrial grade USB hub should be okay!
Are you able to narrow it down some more? We need to be able to see it on our end, and the the fix would be easy!
Well, it’s getting worst.
I ran 3 debug sessin.
The two first were ok but got a windows message with the third attempt. USB Device not recognized.
As usual, I restart my computer to get it work again but it fails.
See the SC20260 back in device Manager and also in the TinyCLR Config.
But connection fails and SC20260 doesn’t appear anymore
Restart TinyClr but still no device in the list but SC20260 still in the Device manager
will try again with VS2022
Didn’t try with VS2022 but tried to connect the portal with a surface
Same here. I see the SC20260 but can’t connect
Try with a hub (another one but also industrial type) and another cable
Same. you se the device but can’t connect
Got the impression that I have something wrong with the Fez Portal and I don’t have another to test
What is throwing me off here is that you need to restart the PC! Even if a device crashed, resetting it should bring it all back.
I could finally connect after multiple attempts. delete everything and reinstall firmware
If i try now to debug (VS2022), I got the ‘Preparing to deploy assembly to the device’
It stays so for nearly one minute, then I got the message Deployment Error / An error has occured: please check your hardware
I need to try tomorrow with a feather
The last message is expected warning from vs.
About earlier comments, you said that the device works sometimes and others you need to reset the PC. I think it is best to start fresh and try to narrow it down. Like do you see this with any project? Or only return you use a certain feature, like networking? When it stops, does resetting the device bring it back to life? You can tell by having a blinking left thread at the very beginning of your code. Maybe even add a loop that doesn’t start your code till you press a button. And then when your device is reset and waiting on a button press, does it always run (blink LED) and if it does then can you redeploy to it, or at least ping from TinyCLR config tool?
I plan to do further testing by tomorrow (00:05 here)
But I tried with a feather
So no display
Code is extremely simple
- send command to rain gain to get the reading (Do it 10 times)
Result is received in MyUartOnDataReceived
- send command to only received data when rain sensor get triggered
the command is sent
it enter the event and got frozen . No error code
will check further tomorrow
send another command
I switch to a feather to avoid potential power issue
I can get the project working but redeploying solution (debug) continue to give issue; I got a prompt from windows telling that there is a problem with the device; In this case, rebooting is the only solution (So Win 11 and VS2022)
Before the incorrect USB message, I have VS2022 waiting sometimes forever for device to initialize
I switch to my surface (Win 10 and VS 2019). here is seems to work correctly; I try to 5 times in a row without issue. I didn’t got more than 2 successful attempts with the other configuration (even if I delete app between trials).
I have one Odyssey mini pc. I may do some tests tomorrow with VS2019. enough for today
We still do not know what state the device is in. You need the blink LED thread and a button to start your application.
Ok. I will try that tomorrow.
So wait for button press at start.
When done blink a led, then read rain gauge value.
Would it be ok as test ?
No. Always blink LED in a separate thread right in power up. Now add a loop at the beginning to wait for bottom press to start your application.
When your reset your device, the LED will always blink and nothing will happen till you is the button.
The blinking LED tells you that your device is ruining and your PC must be able to see it.
The button tells you that the device is now doing anything and nothing else should prevent it from working.
Ok. I will do that and will let you know the outcome
So added a timer to blink the led
Then user has to press a key
The board read sensor and if data is received it activates a relay for 1 sec
Run debug : ok for three times in a row.
Then press deploy app (same code)
VS is waiting for device to stabilise for a while then I get the windows error usb device not recognised. The last usb device you connected to this computer is malfunctioning…
If I reset the board, program is running normally. Led blinks….
Ok so we now know that the device is still running properly and there is no reason that the PC can’t redeploy. And if it can’t the problem is on the PC and not the device.
That’s weird because this is a new pc (latest gen Intel i9, SSD, 64 Gb …) No issues seen so far.
I will check without the USB Hub (and feather) who knows …
We may need Win 11 and core I9 :)))… Never tested SITCore on that.