New ! CDC : Revengeance

This page is a collection of interesting information about the USB CDC library and mythe VCP library I built on top of it. Check it out once in a while, it’s probably going to grow every time I work with a new STM32 family, find a bug or add a feature.

CDC : Revengeance

2 thoughts on “New ! CDC : Revengeance

  1. Thank you for publishing the CDC library. It is very helpful in itself and I learned a bit while setting it up. One thing that would make it even stronger is to add the DMA for transmit from the device. I think that often the USB I/O is used as a debug or terminal interface for a device. Often a menu must be refreshed and sent out. This can be time consuming without DMA. On the other hand, the terminal (PC) side is often sending only one or two characters such as menu selections or maybe a setting value of a few digits. So, receive might not need DMA in that case. With UARTS, using DMA for transmit is fairly easy. I’m hoping the same is true for USB.

    I’m going to try to get that working after I finish with a work project but it might be a great addition for your blog too!

    1. Hello Red, I’m glad my code (and hopefully my endless prose) was helpful to you. Your assessment of how a debug UART terminal interface works is spot on. As it happens, I have published my own on GitHub (I just haven’t had time to write about it here). Guess what : it does uses DMA on the STM32->PC lane. In the case of USB, things are actually much simpler if you’re using my VCP library. Remember two things : first, you get to tell CubeIDE and my library how big your VCP buffers are, so you can make the transmit buffer and vcp_send function capable of handling your entire menu in one go. Second, the VCP library is asynchronous. All it does is put your data into a USB “IN” endpoint so the host can read it. You shouldn’t need DMA as transfers happen at the speed of the STM32, not the speed of a UART. The only constraint then becomes the size of your buffers, and you can easily adjust that… unless your STM32 is short on SRAM, of course.

      Let me know how this goes !

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.