USB-CDC raw communication
Posted: Mon Oct 21, 2013 5:23 pm
Hello,
I would like to use the USB-CDC on an STM32F4 to do some data transmission.
Most demos use a test suite or shell with chprintf to show if it works.
The demonstrator shell works fine.
But I'd like to do some raw read/write access, first of all a simple echo application, returning all data which was received via USB-CDC.
Analysing the shell and test suites, I think chSequentialStreamWrite and chSequentialStreamRead would be the correct interfaces for what I want to do, bit I'm not sure about that. Are these functions a good choice?
If so, the the first step for my echo application would be to check if there's data available using chSequentialStreamRead, and then transmitting the received buffer with chSequentialStreamWrite. This could be done in an low priority thread infinite loop.
A better choice would be callback functions when reception/transmission is over, but I haven't seen how to do that. Is it possible?
Before I go into a wrong direction, do you think have I decided to use the correct functions?
Thank you!
Ruwe
By the way, in ARMCM4-STM32F407-LWIP-FATFS-USB / mcuconf.h there a two things I wonder about:
1. The section 'MAC driver system settings' exists twice with the same defines
2. Are there two OTG devies in the F4, and if so, are both of them used for the demo? From my understanding, it uses only one device mode.
#define STM32_USB_USE_OTG1 TRUE
#define STM32_USB_USE_OTG2 TRUE
I would like to use the USB-CDC on an STM32F4 to do some data transmission.
Most demos use a test suite or shell with chprintf to show if it works.
The demonstrator shell works fine.
But I'd like to do some raw read/write access, first of all a simple echo application, returning all data which was received via USB-CDC.
Analysing the shell and test suites, I think chSequentialStreamWrite and chSequentialStreamRead would be the correct interfaces for what I want to do, bit I'm not sure about that. Are these functions a good choice?
If so, the the first step for my echo application would be to check if there's data available using chSequentialStreamRead, and then transmitting the received buffer with chSequentialStreamWrite. This could be done in an low priority thread infinite loop.
A better choice would be callback functions when reception/transmission is over, but I haven't seen how to do that. Is it possible?
Before I go into a wrong direction, do you think have I decided to use the correct functions?
Thank you!
Ruwe
By the way, in ARMCM4-STM32F407-LWIP-FATFS-USB / mcuconf.h there a two things I wonder about:
1. The section 'MAC driver system settings' exists twice with the same defines
2. Are there two OTG devies in the F4, and if so, are both of them used for the demo? From my understanding, it uses only one device mode.
#define STM32_USB_USE_OTG1 TRUE
#define STM32_USB_USE_OTG2 TRUE