《ZDS2023 - Overview of CAN subsystem in Zephyr.pdf》由会员分享,可在线阅读,更多相关《ZDS2023 - Overview of CAN subsystem in Zephyr.pdf(29页珍藏版)》请在三个皮匠报告上搜索。
1、#EMBEDDEDOSSUMMITOverview of CAN Subsystem in ZephyrNavin Sankar Nallampatti Velliangiri,Next Big Thing AGAgenda What is CAN Features and Application CAN Bus Architecture CAN Subsystem in Zephyr Sample application Userspace toolsWhat is CAN Controller Area Network Developed by Robert Bosch ISO 11898
2、 Multi-master serial and broadcast bus Message based protocol Speed:125kbps-1Mbps https:/en.wikipedia.org/wiki/CAN_busCAN Features Multi-Master and Multi-Node Architecture Reliable Message Transmission Arbitration and prioritization Built in Error Detection Low cost Uses twisted pair wiresCAN Applic
3、ations Automotive Aerospace and Aviation Industrial Automation Building Automation Medical Devices Dominant-Logic 0 Recessive-Logic 1Signallinghttps:/ Bus Architecturehttps:/ Message The CAN bus is a broadcast type of bus All nodes can hear all transmissions.Provides local filtering to listen to int
4、ended messages Four different types of message frameData FrameRemote FrameError FrameOverload FrameCAN Message Framehttps:/ CAN vs CAN FDFeaturesClassical CANCAN FDData Rateupto 1Mbpsupto 8 MbpsPayload Size8 bytes payload/frame64 bytes payload/frameNetwork Lengthupto 40 MetersLimited to few metersCo
5、mpatibility Classical CAN is not compatible with CAN FDCAN FD is backward compatible with Classical CANCAN in the Zephyr Driver ModelApplicationCAN DriverCAN TransceiverExternal deviceSoC/SPICAN CONTROLLERCAN_TXCAN_RXSocketCAN Supports BSD Socket API Compatible with Linux SocketCAN implementation In
6、tegrated with Zephyr Networking stackSocketCANApplicationCAN DriverCAN TransceiverExternal deviceSoC/SPICAN CONTROLLERCAN_TXCAN_RXNetworking CoreAdd a CAN controller in Zephyr Compatibility Devicetree/shield Driver implementation Sample and test casesDevice tree exampleDevice driver:declare the driv
7、erDevice driver:init functionDevice driver:apisApplication:Obtaining the deviceApplication:Set TimingApplication:Sending(blocking api)Application:Sending(non blocking api)Application:Receiving(callback)Application:Receiving(msgq)Userspace tools in linux The can-utils package provides basic tools to display,record,generate and replay CAN traffic.Useful for debugging,testing,simple prototyping Key Tools:cansendcandumpcangencanplayercansniffercanlogservercansend:send a single framecandump:display,filter and log data to files#EMBEDDEDOSSUMMITThank you!