2016-05-25 01:54 PM
Hi.
Quite often I need USB CDC driver which could be found in Cube Middleware package for communication between PC and uC. It works, but there is a big mess in those functions. I wonder, if it is possible to rewrite my own drivers, with register based code, which could probably be a lot smaller, more transparent and perhaps also faster. Does anyone have any experience with that? USB peripheral looks quite complicated to me. Much more than SPI or USART.Thanks #usb2016-05-25 05:01 PM
Of course. The only limits are the limits of your coding abilities.
You'll obviously need to weigh the benefit of having a ''nice'' library over one that ''looks quite complicated'' but works and see if it's worth your time. I would recommend actually using the library that already exists before embarking on your own coding journey. You may learn something in the interim on why it's implemented the way it is.You may find that USB is just inherently more complex than that of UART and SPI, hence the additional complexity.You can consider writing a wrapper library that handles the interface with the more complicated USB functions and just exposes a cleaner interface you're looking for.