cnlohr/rv003usb: CH32V003 RISC-V Pure Software USB Controller ·
Ever wanted a 10 cent USB low-speed capable processor? Well, look no further. RV003USB allows you to, in firmware, connect a 10 cent RISC-V to a computer with USB. It is fundamentally just a pin-change interrupt routine that runs in assembly, and some C code to handle higher level functionality. The bootloader version of the tool can create a HID device, enumerate and allow execution of code on-device in 1,920 bytes of code. Basic HID setups are approximately 2kB, like the Joystick demo. The core assembly code is very basic, having both an interrupt and code to send. Additionally only around 250 lines of C code to facilitate the rest of the USB protocol. The core assembly code is standardized, and there is also a c file code, to handle different functionality with hid feature requests, control setup events, interrupt endpoints (send and receive) are all done in. It shows both how to be a normal USB device, as well as how to write programs to run on your PC that can talk to your USB dev