BeagleBoard/GSoC/2022 Proposal/PRU-based USB stack

=Proposal Template= About Student: Seak Jian De Mentors: Jason Kridner, Shreyas Atre Code: NatworkManger DBus Wiki: https://elinux.org/BeagleBoard/GSoC/2022_Proposal/bb-config_improvements_%26_GPIO_Benchmarking GSoC: bb-config improvements GPIO Benchmarking

=Status= This project is currently just a proposal.

=Proposal= Completed all the requirements listed on the ideas page. the code for the cross-compilation task can be found here submitted through the pull request #158.

About you
IRC: Jian De Github: https://github.com/Fred-JD School: Universiti Teknologi Malaysia Course: 3rd Year Electronics Engineering Country: Malaysia Language: English, Mandarin, Malay Typical work hours: 4PM - 11PM UTC +8 Previous GSoC participation: First year apply gsoc.

Project Name
PRU-based USB stack

Description
It should be possible to write a USB stack for PRU. The PRU-controlled USB interface should be able to work either as device or a host. The goal would be to minimize the latency for USB peripherals, specifically audio, HID and MIDI devices used for musical instruments, to integrate into the Bela.io software environment.

USB Concept
Transfer Types
 * Control Transfers
 * Bulk Transfers
 * Interrupt Transfers
 * Isochronous Transfers

USB Protocol Descriptors
 * Each device contains Descriptors which contain information about the device.

Interfaces
 * USB devices publish their endpoints as part of an Interface.

Endpoints
 * USB pipes are opened to Endpoints. Devices publish Endpoint descriptors to enable clients to query what endpoint are available and what characteristics they have. Endpoint descriptors contain information about the I/O direction (IN which is from the device to the host or OUT which is from the host to the device), the transfer type (Control, Bulk, Interrupt, or Isochronous) and the maximum supported packet size.

Pipes
 * Communication between the host and a USB device is performed through Pipes.

PRU-USB Host


USB Host Core Layer This layer containing functions to manage USB peripherals and the USB bus. This layer interface between USB Host Controller (OHCI/EHCI). The functions in this layer are:
 * USB Task
 * Initialize USB host stack and Host Controller Hardware


 * Config Descriptor
 * Host send setup request


 * Event Managements
 * Handle Host event and executes enumeration


 * Host Standard Request
 * Send Control Request
 * Set Device Configuration
 * Get Device Configuration
 * Get Descriptor
 * Get Device Status
 * Clear Endpoint Stall
 * Set Interface Alt Setting
 * Get Interface Alt Setting
 * Get Device Descriptor

USB Class Driver This is a layer containing functions that are class specific for the application. Class Driver will be supported is :-
 * Audio Class Definition
 * HID Class Definition
 * MIDI Class Definition

The design concept is inspired from: LUFA (USB stack for AVR) RTUSB-32

Timeline
Provide a development timeline with a milestone each of the 11 weeks and any pre-work. (A realistic timeline is critical to our selection process.)

Experience and approach
In 5-15 sentences, convince us you will be able to successfully complete your project in the timeline you have described.


 * In my first year of University I have passed the 3 month junior training program by ROBOCON UTM which include basic programming, basic electronics and basic Mechanisms.
 * * I have built a line following robot with dsPIC30f4011 microcontroller. Solder and design my own hardware with the PIC microcontroller. Understand about GPIO, PWM, UART, ADC/DAC. I have experience in C programming and know how circuit connection with breadboard. photo.
 * * I have build a custom PCB to control robotic pneumatic valve with Altium designer. photo


 * I have build a flutter mobile app which read and display sensor value from Bluetooth module with Maker Uno (similar with Arduino Uno). Then store the value on AWS with MQTT protocol.\
 * I have build Footfall Counter with openCV github
 * In order to successfully to complete the projects, I will start it early which start to work with the technology before official code period so I have extra time for debug and testing.

Contingency
What will you do if you get stuck on your project and your mentor isn’t around?

Misc
Completed all the requirements listed on the ideas page. the code for the cross-compilation task can be found here submitted through the pull request #158.

Suggestions
Is there anything else we should have asked you?