I'm trying to implement an USB serial implementation on a STM32F407 board. The USB connector doesn't have ID pin connected, Vbus pin of the USB connector doesn't go either to PA9, and also it lacks a pull-up resistor from D+ to 3.3V.
I'm trying the testhal demo for CDC and also the RT-STM32-LWIP-FATFS-USB with no success (I also have tried to set DCTL_RWUSIG to activate internal pullup). I suppose that the pullup resistance is not needed, as it seems the MCU has internal pullups managed by the driver.
Windows doesn't see any new interface, and wireshark doesn't see any interchanged byte. Must be something stupid, as I don't see that other users had problems with it.
As the USB interface is so complex, I'd appreciate any help.
STM32F407 USB-CDC not working
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: STM32F407 USB-CDC not working
Hi,
If windows does not start the enumeration sequence then it should be the missing pull-up resistor, it is what triggers the procedure. Also make sure USB GPIOs have the correct settings.
Giovanni
If windows does not start the enumeration sequence then it should be the missing pull-up resistor, it is what triggers the procedure. Also make sure USB GPIOs have the correct settings.
Giovanni
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: STM32F407 USB-CDC not working
The F4 should have it internally but host is not "seeing" it, this is why I mentioned GPIO settings.
Could you try with and F4 discovery for comparison?
Giovanni
Could you try with and F4 discovery for comparison?
Giovanni
Re: STM32F407 USB-CDC not working
rew, I saw that bit in the USB specification for the STM32F407 (bit 21 NOVBUSSENS on the OTG_FS_GCCFG), I set it with no difference. I have also tried to define NO_VBUSSENSE on the Makefile with no success (I can't find the reference for this variable in Chibios).
Could you please give me more details on where to define that variable?
Could you please give me more details on where to define that variable?
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: STM32F407 USB-CDC not working
Hi,
You can define it in the Makefile in the section for user variables.
Giovanni
You can define it in the Makefile in the section for user variables.
Giovanni
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: STM32F407 USB-CDC not working
It is a board attribute: BOARD_OTG_NOVBUSSENS
You need to specify it in board.h or in the Makefile: UDEFS = -DBOARD_OTG_NOVBUSSENS
Giovanni
You need to specify it in board.h or in the Makefile: UDEFS = -DBOARD_OTG_NOVBUSSENS
Giovanni
Re: STM32F407 USB-CDC not working [SOLVED]
Thanks fot the hints, I finally got the serial port working. What I have done and learned:
- Added "#define BOARD_OTG_NOVBUSSENS" at the USB section of halconf.h. Then the CPU doesn't wait to the Vbus sense (pin A9) to detect voltage
- The pullup resistor for D+ is not necessary, as this CPU has internal pullups and pulldown, activated when necessary
- The example "USB_CDC_IAD" on testhal was prepared for the Olimex E407, that has two USB ports (the first one SDU1 with full speed FS, and the second SDU2 with higher speed HS). My board has only the first USB attached
It works perfect. What I'm trying to solve now is a minor problem: in windows I have the correct COM Port, but also it says that there is another "Unknown device" with the same PID&VID that the working port; trying to change the controller to the one provided in the example doesn't solve (I deleted all references to SDU2)
- Added "#define BOARD_OTG_NOVBUSSENS" at the USB section of halconf.h. Then the CPU doesn't wait to the Vbus sense (pin A9) to detect voltage
- The pullup resistor for D+ is not necessary, as this CPU has internal pullups and pulldown, activated when necessary
- The example "USB_CDC_IAD" on testhal was prepared for the Olimex E407, that has two USB ports (the first one SDU1 with full speed FS, and the second SDU2 with higher speed HS). My board has only the first USB attached
It works perfect. What I'm trying to solve now is a minor problem: in windows I have the correct COM Port, but also it says that there is another "Unknown device" with the same PID&VID that the working port; trying to change the controller to the one provided in the example doesn't solve (I deleted all references to SDU2)