How to custom USB Class on Zephyr RTOS with nrf52840DK?
Hello, my project is to develop an external monitor so that the PC can transfer images to my monitor via USB.
What I want to do is customize a USB class with bulk transfer functionality to transfer images. I started with the HID-mouse example with USB device_next (the new USB structure) and wanted to add a bulk transfer end point. But I don't know how to do it. the sample code for me looks so complicated. is any one has the experience with zephyr USB?
what I have done now is just duplicate the HID class from device next/class to my application. and add a CMakeLists.txt file so I can compile it separate from zephyr.
Solution:Jump to solution
With some work yes this can be achieved, check the docs here https://docs.zephyrproject.org/latest/connectivity/usb/device/usb_device.html#implementing-a-non-standard-usb-class
4 Replies
@Summer In your duplicated HID class, locate the usb_descriptor array and modify it to add a bulk endpoint.
@ZacckOsiemo any idea for this question?
Solution
With some work yes this can be achieved, check the docs here https://docs.zephyrproject.org/latest/connectivity/usb/device/usb_device.html#implementing-a-non-standard-usb-class
One will need to dig into zephyr and usb a bit to get all this working. I don't expect it will be a copy paste thing. If the code looks complicated customization is a bit of a stretch I would first start by understanding the individual classes you need for you custom class.
@Boss lady @ZacckOsiemo Thank you for the inputs. I will check out the link 🙂 Do you think use HID class to do bulk transfer for passing image is this the right direction to take? ( I tried CDC_ACM , but CDC_ACM is virtual COM port. I found it has chance of losing data)
Why wouldn't you use mass storage class?