I'm playing around with STM32F4 Discovery board and libopencm3. I want to send data acquired from ADC channels over usb and display some charts on the computer. After doing some research on USB class codes I'm a bit confused: which one should I choose for my application? At first I was thinking that USB-CDC it the way to go, since it's easier to implement but I don't think that it's the optimal solution.
The USB CDC class is easy to implement and use, since on the PC side it creates a virtual COM port. You can easily test the interface with a program like RealTerm, which can display either ASCII or binary data. You will need to write a program to capture the data, convert it to ASCII, and save to a file for input to a spreadsheet program like Excel to do the charting.
The only gotcha is the COM port number that is assigned can't usually be predicated in advance so you have to have some sort of configuration file that specifies which one to use (once the system chooses a COM port for the USB device, it should continue to use the same one after that).
You don't mention what data rates you need to support, or how long a sample. At 115K baud, you can send one ADC sample (12 bits, expanded to 16) in a little under 175 µS, or about 5000 kHz. I'm guessing you need something faster than that. Since you have 192K RAM available, you can buffer up to 90,000 or so samples. At 44.1 kHz, that's a little over two seconds.
If you are going to sample first and then send, you might find the HID class even easier to use. It can present itself as a virtual keyboard, so there is no software to write on the PC side. You can open up a program like Excel, and as long as the firmware in the STM32F4 is sending the data as ASCII characters followed by a carriage/line feed for each sample, each line will be entered as an additional row in the spreadsheet, ready to graph.