AnsweredAssumed Answered

USB CDC FS (VCP) - Send Data to Host in Fault Handler

Question asked by Mike on Mar 18, 2013
Latest reply on Mar 18, 2013 by Clive One
I have an STM32F4 based board, and I'd like to (for better or for worse) use the USB port as a console port to my board.

I've already modified the CDC (VCP) Full Speed example, and have RX, TX, and VBUS sensing working as I'd like.  However, one problem with this approach is the USB bulk transfers from device to host are done via interrupt I/O.   So, if I want to print Joseph Yui's famous hard fault handler, it's not gonna happen because the hard fault interrupt will always be a higher priority than the USB port's interrupt.

So, what I'd like to do is modify the CDC (VCP) example to send data to the host using polling I/O, just like one would do if using the USART.  I've spent the last couple of days studying the USB OTG Library code, but I just don't know enough about USB, and I'm wondering if this approach is completely incompatible with the USB protocol.

Is this even possible?  Do you know of a way to make this work?

P.S. I realize there are other (better?) ways of making a console port with USARTs, Ethernet, 2nd Processor, etc..., but I want to explore this idea. 

Outcomes