"Waiting for device to initialize"

Out of the blue, with no apparent reason, Visual Studio got stuck on “Waiting for device to initialize.”

The app is correctly deployed on the device (SCM20260E) and it runs properly after reset. But it doesn’t run right after deployment from Visual Studio and the debugging remains stuck on that last log.

Same with old versions of the app, even if I didn’t make significant changes (or likely no changes at all) since the last debug session that worked properly maybe a minute before.
The same happens with a new project with a single line in it.
I have two development boards, and tried on the backup one. Same.
On one of the two boards I tried updating the firmware, even if the previous one was working before the problem. And of course also tried erasing the app, with that.
I tried updating the visual studio extension (even if the previous one was working).
I tried removing the USB driver, then reconnecting and letting it appear again.
I tried a dev environment on a virtual machine. Same.

Win10 and Visual Studio 2022 both up to date.

I never had that issue before, and now I’m stuck with no idea.


What version please? Does it work before?

Are you deploying by usb or serial?

Seems deploying into external flash?

Can you try different usb cable, port?

Seems we were not able to reproduce here:

I’m pretty sure you cannot reproduce that, because - as I said previously - everything was working fine till a minute before, and has been working fine for months.
It seems like something got suddenly corrupted, but two distinct boards behave the same. The same with a separate dev environment in a virtual machine. And the same with a new sample project or old working versions of the app.

Deploying USB (usb-c). Unfortunately, no other ports to try, but that could be an idea. But consider that the deployment happens perfectly, and the port has no problems when connecting to other devices.

Not certain if deployment happens on external flash (“Total deployment size is 1.117.728 bytes.”). No mention in the logs. But I’d guess external (I remember previous logs mentioning remaining space too high for internal).

VS extension:
Firmware: and (two boards, both now not working, but working before the “corruption”)
We’re currently using the libraries, not packages:

There could be two issues, so we will get into one at the time: Usb or external flash.

With a small project, there is no need external flash. You can deploy new firmware so it will disable external as default setting. If it works, then you can enable external flash.

Still use same project, add resource (about ~1MB) so it will be deploy to external flash, otherwise it still use internal flash because it is small project.

If everything just work then the problem could be usb.

For the USB, I just managed to try a different port. Same.

For the external flash I’m not sure what you’re suggesting.
I already tried uploading both a tiny new project and the dev app. Same result for the two.
But consider that the size of the app I’m working on didn’t change between before and after the “corruption”. Also, the same problem happens on two distinct boards, both previously working, so it’s certainly not a hardware thing.

The only thing in common between all the tests I did is now the usb driver, on which I’ve no apparent control (I tried uninstalling, but it’s always the old one from Microsoft).



I don’t think there is usb problem because you can ping / connect to tinyclr.

For the external flash I’m not sure what you’re suggesting.

External heap = External memory
External Deployment = External Flash

Try to use tool config, do Erase All, and reflash firmware again. That will bring the device back to default setting. Then deploy small application, but “Hello world” as I did.

let us know what you see.

Did that and it seems that it can enter debug, with the sample app:


But that way, the dev app cannot upload:

I know :). So far usb good, your pc good, extension good.

Now you need to check on extend heap and try with small application. Only extend heap for now.

Let us know what you see.

Extended just the heap. The small test app is still working.

OK, now this time to enable extend deployment.

then try with small application, if it works then you can try with your large app.

With external deployment, the small app still works. The large app, still doesn’t. It uploads, but debugging doesn’t start.
Small app:
Large app:

Now, you deploy again, with large app, do not change anything in your code, just hit deploy.

Do you still see “Erasing sector…”?

If you can share to us the project, we can investigate. I think the external deployment flash has something wrong or your application has something. Did you use Erase all before, some cases it will help.

You can try simple project with “hello world” above but add ~1MB of resource. Just pick some files, change extension to .bin and add into resource.

Sorry for the “erasing” in the screenshots.

The first screenshot was taken when trying the small app after having tried the large app, because I forgot the screenshot on the first successful attempt. The first attempt did not have “erasing” in it.

The second screenshot was from the large app. No erasing, there.

Unfortunately, I cannot share the large app. But consider that a minute before the breakdown, it worked. And I tried previous versions, that were previously certainly working, and now don’t.

Tried the small app with around 1mb of resource added. Still works.

“Erase application” already tried, but no changes. And also “erase all” before attempts with firmware update.

Can you take a screenshot where it says erasing or writing… Add few more thing make sure the test project is bigger than your app.

With 1mb it was still a bit smaller than the large app:

Tried with a larger resource (around 1.7mb) and it’s now larger than the large dev app. But still working.

Then the problem could be something in your project, did you change anything after it worked?
Can you just add something large than 4k to your project, same as you add resouce on test project. Probably your project has special size cause a bug we dont know yet. So add something to get different size and 4k so the end sector will be different.

But I guess something in your project cause issue.

I tried adding a resource of 37k to the dev app. Still nothing.

The dev app uploads but no debug. If I reset the device, the app starts on the device and works properly, but no debug is possible from Visual Studio.

Consider, as I said before and tested before submitting this topic, that also previous versions of the app can no more debug (and they could previously, of course). If it was something changed in the app, I’d expect the previous working versions still working, at least with a total erase, or with one of the two dev boards.

Something likely happened between one debugging session and the next (the app was working just a few seconds before, in the previous debug session) and from that point on, no version - also previous ones! - worked.

I really have no idea and I get it’s hard for you too to have hints. I appreciate your support with this and thanks for your time till now. Any other idea would be most welcome.

Did you change debug / release mode by accident? That is last thing I can guess.