1、1Implementing a Custom USB Device Controller Driver in ZephyrMOHAMMED BILLOOZephyr Developer Summit 20232THE SPEAKEREmbedded Software ConsultantDesign WorkMedical devicesScientific InstrumentsAutomotiveDefenseConsumer ElectronicsExperience/ExpertiseRTOS-based systems ZephyrEmbedded Linux/The Yocto P
2、rojectQtMohammed Billoo(mabmab-) SPEAKERTraining/WorkshopsVirtualOn-site/In-personwww.mab-BIOS FOOD Newslettermabmab-4AgendaProject OverviewSystem ArchitectureProblem StatementBackground(Very brief)USB PrimerInitial ApproachChallenges FacedTroubleshooting Tools/StepsResolutionNext StepsRetrospective
3、Q&AMAB Labs,LLC 2023 All Rights Reserved5PROJECT OVERVIEW6System ArchitectureEnclustra XU5 BoardZynq Ultrascale+MPSoC FPGAProduction readyUART ConsoleEthernet7System ArchitectureARM(hard block)RISC-V CoreRISC-V MemoryXilinx USB Controller(hard block)Xilinx UART Controller(hard block)ConsoleDebugging
4、8Existing SystemHard ARM CoreUART ConsoleEthernetUSB CDC9Existing SystemFreeRTOS-based Implementations“Final”Blinky USB CDC NetworkDebugging Access to RISC-V Memory Network10USB CDC in FreeRTOSTinyUSBUSB Host/Device StackTargeted for Embedded Systems Memory Safe No dynamic allocations Thread Safe In
5、terrupts deferredCross-platformOpen-source11TinyUSBCustom ImplementationCustom Implementation12TinyUSBOS Abstraction Layer(OSAL)RTOS-specific implementationsosal.h13TinyUSBOS Abstraction Layer(OSAL)RTOS-specific implementationsosal_freertos.h14TinyUSBMCU-specific Implementationtusb_option.h15TinyUSB
6、MCU-specific Implementationtusb_option.h16TinyUSBMCU-specific ImplementationCustom addition17Existing SystemTinyUSB customizationtusb_config.h18Existing SystemApplicationEchoTask to receive data over USB CDC and transmit the same dataMCU portInterrupt handlersWrite to appropriate Xilinx registers in