Implementing a Custom USB Device Controller Driver in Zephyr.pdf

編號:144832 PDF 47頁 2.34MB 下載積分:VIP專享
下載報告請您先登錄!

Implementing a Custom USB Device Controller Driver in Zephyr.pdf

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

7、 response to TUSB function calls19Problem StatementImplement USB device and CDC driver leveraging Zephyrs USB stackAssume Xilinx USB device controllerMAB Labs,LLC 2023 All Rights Reserved20(BRIEF)USB OVERVIEW21Device ConnectionDevice plugged into host busHost detects additionHost interrogates device

8、 Identify type and“services”it provides Load appropriate driverUSB transfer modesControlInterruptBulkIsochronous22USB TransactionToken packetHeaderSpecifies whats nextData packetOptionalPayloadStatus PacketACK(or NAK)transactionError correction23USB TransactionALL TRANSACTIONS INITIATED BY HOST!Lang

9、uage is from hosts perspective24USB PacketFieldsSync:Known pattern for clock synchronizationPacket ID(PID):Packet typeAddress:Specifies destination device on busEndpoint:Target endpoint at destinationToken PacketsIN:Host wishes to read data from deviceOUT:Host wishes to write data to deviceSetup:Hos

10、t wishes to begin control transfer25USB PacketHandshakeACK Positive acknowledgment that packet has been receivedNAK Device busy/no data presentSTALL Device requires intervention from host26USB TransactionTOKEN PACKETDATA PACKETHANDSHAKE PACKET27USB EndpointsData source/sinkDevice driver(host)EP1 OUT

11、Interrupt:“Have data on EP1 OUT”Process data in EP1 OUT bufferPlace data in EP1 IN bufferEP1 IN28Zero Length PacketsZLPHost sends OUT token to send data to EP1 OUT bufferHost sends IN token to check receipt Zero Length(Data)Packet If device has successfully received packet,responds with ACK Device p

12、rocesses data in EP1 OUT Otherwise,responds with NAK29Zero Length PacketsZLPHost waiting for response to EP1 OUT transmissionHost sends IN token,reads data from EP1 IN bufferHost sends OUT token Determine if device is ready for next transaction Zero Length(Data)Packet If device ready,response with A

13、CK Otherwise,device responds with NAK Host tries again later30USB EndpointsAll devices must support endpoint 0Receives all control and status requests during enumerationAllows host to identify Functionality provided by USB device Other endpoints available31USB EnumerationDevice Descriptor RequestUsu

14、ally,the first step during enumerationSETUP TOKENDATA=Device Descriptor RequestIN TOKENDATA=DescriptorsOUT TOKENDATA=ZLP(transaction status)MAB Labs,LLC 2023 All Rights Reserved32INITIAL APPROACH33Initial StrategyImplement USB Device callbacksLow level APIHigh level API34Initial StrategyUse Windows

15、for CDC host driverPlug In DeviceUse TeraTerm to check if characters are being echoedUse printks to test functionality35Initial StrategyDone?36TroubleshootingNeeded to independently track USB transactionsTool?37Troubleshooting38TroubleshootingUse ILAInternal Logic AnalyzerXilinx debugging toolCaptur

16、e signals in the FPGAAbsolute last resort39Initial ResultsDetermined that data wasnt being correctly transferred to the FPGAAlways sending NAKsHost would try again but would ultimately give upUnderlying Xilinx registers were not configured correctly Use ARM to interrogate Xilinx registersMAB Labs,LL

17、C 2023 All Rights Reserved40RESOLUTION41ResolutionRunning out of timeDecided to port TinyUSB to ZephyrCompletely sidestep Zephyr USB device stackCreated a new OS port for ZephyrCreated OSAL for ZephyrCreated Zephyr threads toManage transactions from FPGAManage CDC echo functionality42ResolutionWorke

18、d!43ResolutionDone?Yes,for nowMAB Labs,LLC 2023 All Rights Reserved44NEXT STEPS45RetrospectiveShould have taken time to intelligently port driverNave at the timeZephyr USB device stack different from TinyUSBNot as simple as simply copying functions overBut,happy customerOn June 21,asked for availabi

19、lity on more potential Zephyr work46Next StepsTwo optionsPort TinyUSB to ZephyrProbably unnecessary Already have a stackCorrectly incorporate Xilinx USB device driver into Zephyr stackCan use ARM core Dont have RISC-V IPCan use Zynq development board Dont have access to EnclustraPush upstream/mainline!MAB Labs,LLC 2023 All Rights Reserved47Q&Amabmab-

友情提示

1、下載報告失敗解決辦法
2、PDF文件下載后,可能會被瀏覽器默認打開,此種情況可以點擊瀏覽器菜單,保存網頁到桌面,就可以正常下載了。
3、本站不支持迅雷下載,請使用電腦自帶的IE瀏覽器,或者360瀏覽器、谷歌瀏覽器下載即可。
4、本站報告下載后的文檔和圖紙-無水印,預覽文檔經過壓縮,下載后原文更清晰。

本文(Implementing a Custom USB Device Controller Driver in Zephyr.pdf)為本站 (2200) 主動上傳,三個皮匠報告文庫僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對上載內容本身不做任何修改或編輯。 若此文所含內容侵犯了您的版權或隱私,請立即通知三個皮匠報告文庫(點擊聯系客服),我們立即給予刪除!

溫馨提示:如果因為網速或其他原因下載失敗請重新下載,重復下載不扣分。
客服
商務合作
小程序
服務號
折疊
午夜网日韩中文字幕,日韩Av中文字幕久久,亚洲中文字幕在线一区二区,最新中文字幕在线视频网站