6269 views|13 replies

9

Posts

1

Resources
The OP
 

Can stm32f407 be used as a USB host to receive serial port data? [Copy link]

 

Netizens, now I have a GPS device, it outputs data directly through the USB interface, I just take a USB data cable, connect it to my computer, and I can see the corresponding GPS data through the serial port debugging assistant.

My current idea is to directly use the USB interface of F4 to receive GPS data. Is it feasible?

This post is from stm32/stm8

Latest reply

Did you finish it? Can you give me some engineering tips? Thank you very much!   Details Published on 2020-5-17 16:27
 

9702

Posts

24

Resources
2
 

It seems that you need to write your GPS driver on STM32, which may be troublesome.

This post is from stm32/stm8
 
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 

9

Posts

1

Resources
3
 
littleshrimp posted on 2020-3-8 10:29 It seems that you need to write your GPS driver on STM32, which may be troublesome.

The GPS originally had a serial output, but the manufacturer added a USB interface for ease of use. Is the driver you mentioned the TTL-USB driver implemented on the microcontroller?

This post is from stm32/stm8

Comments

Check whether the module uses the internal microcontroller's USB directly, or uses a USB-to-serial port chip such as CH340. If it is the latter, you can find information online about connecting STM32 to CH340 via USB HOST.  Details Published on 2020-3-8 10:37
 
 

9702

Posts

24

Resources
4
 

Here is a routine for USB host to control virtual serial port, you can learn about it

STM32Cube_FW_F4_V1.24.2\Projects\STM324x9I_EVAL\Applications\USB_Host\CDC_Standalone

CDC_Standalone.rar (104.49 KB, downloads: 55)

This post is from stm32/stm8
 
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 

9702

Posts

24

Resources
5
 
cqut面码Published on 2020-3-8 10:33 The GPS originally had a serial port output, but the manufacturer added a USB interface for ease of use. Is the driver you mentioned the ttl-us ...

Check whether the module uses the internal microcontroller's USB directly, or uses a USB-to-serial port chip such as CH340. If it is the latter, you can find information online about connecting STM32 to CH340 via USB HOST.

This post is from stm32/stm8
 
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 

9

Posts

1

Resources
6
 
littleshrimp posted on 2020-3-8 10:37 You can see whether the module directly uses the USB of the internal microcontroller, or uses a USB to serial port chip on the original basis, such as CH340...

OK, thank you for your idea. I will try it.

This post is from stm32/stm8
 
 
 

1w

Posts

142

Resources
7
 

Generally speaking, "serial port" refers to RS232 serial port, not USB. Serial port debugging assistant is based on such serial port instead of USB. Both ends of the serial port cable are 9-pin or 25-pin D-type ports. The "USB serial port cable" supported by the serial port debugging assistant is different from this. It has a USB serial port bridge chip inside. The GPS module connected with such a "USB serial port cable" is a serial port. You only need to confirm whether the level specification is RS232 or TTL, and then communicate with the serial port of the MCU.

There are also GPS devices with USB interfaces, which are plug-and-play. The operating system can automatically identify the device type, but the serial port assistant cannot communicate with it. If it is such a USB device, the MCU needs to have a USB host interface, and you need to write your own driver or use a supported operating system.

This post is from stm32/stm8
 
Personal signature上传了一些书籍资料,也许有你想要的:http://download.eeworld.com.cn/user/chunyang
 
 

9

Posts

1

Resources
8
 
chunyang posted on 2020-3-8 20:11 Generally speaking, "serial port" refers to RS232 serial port, not USB. Serial port debugging assistant is based on such serial port instead of USB. Both ends of the serial port line are...

Thanks for the reply, I see that a ch340 is used internally for ttl to usb conversion. What I mean is, if there is a usb host on the microcontroller, do I need to write a ch340 driver myself to read and write?

This post is from stm32/stm8

Comments

If you must use CH340 to generate a virtual serial port on the USB Host, you will need a driver, either by writing your own or finding a ready-made driver. But the MCU obviously has a native serial port, and using the serial port is much simpler and cheaper, so why do you have to go against USB?  Details Published on 2020-3-9 20:19
 
 
 

1w

Posts

142

Resources
9
 
cqut面码 posted on 2020-3-9 20:09 Thanks for the reply, I saw that a ch340 was used to convert ttl to usb. What I mean is that if there is a usb host on the microcontroller, ...

If you must use CH340 to generate a virtual serial port on the USB Host, you will need a driver, either by writing your own or finding a ready-made driver. But the MCU obviously has a native serial port, and using the serial port is much simpler and cheaper, so why do you have to go against USB?

This post is from stm32/stm8

Comments

I may have underestimated the trouble of USB programming.  Details Published on 2020-3-11 20:57
 
Personal signature上传了一些书籍资料,也许有你想要的:http://download.eeworld.com.cn/user/chunyang
 
 

4005

Posts

0

Resources
10
 

The trouble with USB port is the device driver, description table and so on, you have to handle it yourself, F4 can be a USB host.

This post is from stm32/stm8

Comments

Is it possible to make a hardware replacement solution, GPS device (usb) + F407 board (usb female port); make a usb female port to serial port module on the board and solve the power supply problem, how  Details Published on 2020-3-11 20:57
 
 
 

423

Posts

0

Resources
11
 
huo_hu posted on 2020-3-10 21:26 The trouble with the USB port is the device driver, you have to handle the description table and other things yourself, F4 can be a USB host.

Is it possible to come up with a hardware replacement solution?

GPS device (usb) + F407 board (usb female port);

How to make a USB female port to serial port module on the board and solve the power supply problem?

This post is from stm32/stm8
 
 
 

423

Posts

0

Resources
12
 
chunyang posted on 2020-3-9 20:19 If you must use CH340 to generate a virtual serial port on the USB Host, of course you need a driver, you can write it yourself or find a ready-made driver. But the MCU obviously has...

I may have underestimated the trouble of USB programming.

This post is from stm32/stm8
 
 
 

4005

Posts

0

Resources
13
 

"I just take a USB data cable, connect it to my computer and use the serial port debugging assistant to see the corresponding GPS data."

First, check what kind of USB device is on the computer. If the driver is not installed, it is most likely a serial port. That will be easy.

This post is from stm32/stm8
 
 
 

104

Posts

0

Resources
14
 

Did you finish it? Can you give me some engineering tips? Thank you very much!

This post is from stm32/stm8
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list