-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STM32Cube USB VCP #38
Comments
Yep, used extensively on a PyBoard (STM32F405) with USB VCP. Also used on an RP2040 Raspberry Pi Pico with USB. Check out this video: Source code for the MicroPython firmware changes: https://github.com/kentindell/canhack/tree/master/pico/micropython |
The monitor framework has been used to build the CANPicoCtrl GUI: the host is all in Python, talking to the Pico, with its monitor in Python. https://kentindell.github.io/2022/05/11/canpicoctrl/ The monitor software for host and target is included in the branch https://github.com/min-protocol/min/tree/mincan I'll merge this and tidy everything up when I've got the Linux implementation super robust (right now the pyserial hangs on close() if there's a write timeout, so I'm changing the discovery of a monitor to a ping, with a timeout). The framework should be very useful for anyone wanting to do command/response from a host app. |
Oh, how nice of you! Thanks! |
Are there any public repositories with this? |
No, but it's obsolete compared to the Pico implementation using TinyUSB. |
I have to manage STM32F103C8T6 using STM32CubeIDE. |
Take a look at how MIN is stitched in to the MicroPython Pico framework: it doesn't touch anything but the callbacks, and if your IDE has USB support it should be straightforward to glue it together in a similar way. |
I'm overwhelmed, actually :(
|
If you look in rp2_min.c you'll see a couple of static functions: usb_write and usb_read. These push bytes to/from USB. In the Pico case, it uses the TinyUSB library that's instantiated by MicroPython (the Pico SDK has TinyUSB support too, and I guess the STM32 SDK also does, so it will look similar). The MIN callbacks are also in there: min_tx_space just says "yeah, 1K free", min_tx_byte pushes a byte into a local buffer, min_tx_start clears the local buffer, and min_tx_finished pushes the local buffer into TinyUSB (via the local push function). The function min_poll is called from the Python recv() code, which pulls the bytes from the USB drivers, which is how MIN is driven. The interesting callback is min_application_handler, which in this case creates a bunch of Python objects on the heap to pass into Python-world. But that's where your application code would go to handle incoming MIN frames. MIN is entirely polled, so no interrupts. And the TinyUSB interface is polled too (there are interrupts in the background that feed the USB API but I don't go anywhere near those and let MicroPython deal with it all). |
Hi,
Is there any experience with MIN protocol outside Arduino? I'm having trouble adapting it to the middleware supplied by STM32CubeIDE. Shouldn't be too difficult; unfortunately, I'm a newbie.
Sorry, I did some Google research, didn't find anything.
The text was updated successfully, but these errors were encountered: