cancel
Showing results for 
Search instead for 
Did you mean: 

How does USB Host CDC data communication work?

Pilot B
Associate II
Posted on April 18, 2018 at 02:11

Hello everyone,

I'm trying to get USB Host CDC working on STM32F407-DISC board. I'm using USB library version 2.2.0.

So far, I got enumeration working fine by connecting a CDC device. I'm able to send data to the CDC device. But the data is wrong. For example, the data was sent is 'Hello'(it should be '48 65 6C 6C 6F'). But the CDC device received something like '00 00 00 00 AF'. I suspect the line coding caused the issue. But I'm not sure.

Some questions:

1. Does the line coding matter? 

2. I found this in the code:

phost->device_prop.speed = HPRT0_PRTSPD_FULL_SPEED;

I guess at the beginning, both the host and device use 'Full Speed'(12M/s). Is it correct?

3. D

uring enumeration, 

USB Host get the device line coding '

115200 8N1

'. I also called CDC_SETLineCoding() by using the same line coding '115200 8N1'. The CDC_SETLineCoding() is to set the device's line coding? Or is it to set the Host's line coding? Or Both?

4. If CDC_SETLineCoding() is not for setting Host's line coding, then what function is to set Host's line coding?

Thanks everyone!

3 REPLIES 3
Pilot B
Associate II
Posted on April 18, 2018 at 07:07

Is this related to system clock?

I have these, are they okay?

#define HSE_VALUE    ((uint32_t)8000000)

#define PLL_M      8 

Thanks everyone!

Pilot B
Associate II
Posted on April 18, 2018 at 18:02

Hi everyone,

I'm currently stuck at USB Host CDC data communication.

I'm able to enumerate a device. I'm able to even send the data to the device. But the data is wrong.

Could you please give some advice if you know anything?

Thanks!

Pilot B
Associate II
Posted on April 19, 2018 at 00:45

Does anyone know what could cause the wrong data was sent?

I attached the project. Please help take a look at it.

________________

Attachments :

USB-Host-CDC-Sample.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HxgV&d=%2Fa%2F0X0000000b0t%2FAURYjVoIJoyDpMnzxQVugtLFQ7xs9lyOqeIgCoWgBwk&asPdf=false