stm32-rs / stm32-usbd-examples

stm32-usbd examples for different microcontrollers
48 stars 19 forks source link

stm32f303vc example works erratically on Mac #9

Closed bobgates closed 4 years ago

bobgates commented 4 years ago

On a Mac, if I use cargo run to compile and load the example program into an stm32f3discovery board, via opened, I find that sometimes macOS 10.14 Mojave finds the USB serial device, as /dev/cu.usbmodemTEST1, and sometimes it doesn't. I've seen the behaviour repeatedly: quit out of gdb, use cargo run to reload, device is not found. Try a few times, mostly not found. Then - found again. I'm not making changes to the code in between.

Looking in the System profile, it reports the connected device as present on the USB bus quite reliably, but the driver doesn't always see it.

Any clues? This behaviour is making it difficult to develop the usb code, because when it doesn't work, I don't know if it is me or the tools? Is it a Mac thing? I'm thinking a Mac thing because the System Information sees the device, but there is no driver in /dev.

Maybe I need to force the Mac to look for the device?

Okay: more. When I'd lost the device in /dev, I checked to see if it was visible in System Information. It is there, but where it used to appear as "Serial Port", it now appears as "Communication Device". Unfortunately, when it reappears as "Serial Port", it doesn't automatically appear back in /dev. In fact, it seems to make no difference - the device appears in /dev independently of being given the correct name in System Information.

I am at a loss.

Disasm commented 4 years ago

Have you tried cargo run --release? Debug builds are too slow.

bobgates commented 4 years ago

Thanks! That did it. Thanks for your help.