-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Description of defect
I am trying to use the USBSerial on a STM32F303RD based custom board and I cannot make the USB enumerated by the (linux) host.
The USB connection on the PCB seems to be properly done since I'm using it to DFU upload the firmware.
It uses an external 8MHz crystal and runs at 72MHz.
Since there is no official support for the F303RD, I've used the F303RE to inherit from, overloading the rom size.
The board description is
{
"HP34970_FP_F303RD": {
"inherits": [
"MCU_STM32F303xE"
],
"device_has_add": [
"USBDEVICE"
],
"mbed_rom_size": "0x60000",
"bootloader_supported": true,
"device_name": "STM32F303RE"
}
}
Target(s) affected by this defect ?
STM32F303RD on a custom board.
Toolchain(s) (name and version) displaying this defect ?
I'm using platformio with:
- framework-mbed 6.60900.210318 (6.9.0)
- tool-dfuutil 1.9.200310
- tool-openocd 2.1100.0 (11.0)
- tool-stm32duino 1.0.1
- toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
What version of Mbed-os are you using (tag or sha) ?
6.9.0
What version(s) of tools are you using. List all that apply (E.g. mbed-cli)
n/a
How is this defect reproduced ?
Since the version of mbed shipped wit platformio does not come with latest fixes related to this problem (as described in #14736 and #14763 and other issues), I've added the to missing lines in USBPhy.c:
__HAL_PCD_ENABLE(&hpcd); //<!------ added as per #14736 - Does not fix issue on F401
HAL_PCD_Start(&hpcd); //<!------ I added this - This makes the USB device work as expected
But still no luck: any simple example code for the USBSerial like:
#include "stdio.h"
#include <mbed.h>
#include <string>
#include "def_hp34970_fp.h"
#include <USBSerial.h>
USBSerial pc2(false); // PA_11 USB_DM, PA_12 USB_DP (with 1.5k pull-up)
void setup() {
// tried with or without explicit call to init and connect
pc2.init();
pc2.connect();
pc2.printf("Something\r\n");
}
int main()
{
setup();
while(true)
{
ThisThread::sleep_for(500ms);
pc2.printf("New loop\r\n");
}
}
ends up with the host giving:
[3885831.159503] usb 1-2: USB disconnect, device number 34
[3885833.683992] usb 1-2: new full-speed USB device number 35 using xhci_hcd
[3885833.812057] usb 1-2: device descriptor read/64, error -71
[3885834.052036] usb 1-2: device descriptor read/64, error -71
[3885834.288005] usb 1-2: new full-speed USB device number 36 using xhci_hcd
[3885834.420066] usb 1-2: device descriptor read/64, error -71
[3885834.659958] usb 1-2: device descriptor read/64, error -71
[3885834.768007] usb usb1-port2: attempt power cycle
[3885835.184035] usb 1-2: new full-speed USB device number 37 using xhci_hcd
[3885835.184278] usb 1-2: Device not responding to setup address.
[3885835.392149] usb 1-2: Device not responding to setup address.
[3885835.599840] usb 1-2: device not accepting address 37, error -71
[3885835.731923] usb 1-2: new full-speed USB device number 38 using xhci_hcd
[3885835.732120] usb 1-2: Device not responding to setup address.
[3885835.940115] usb 1-2: Device not responding to setup address.
[3885836.147876] usb 1-2: device not accepting address 38, error -71
[3885836.148015] usb usb1-port2: unable to enumerate USB device
PS: this board is a replacement front panel for the HP34790 I'm working on as described here: https://whatever.sdfa3.org/hp-34970a-data-acquisition-unit-part-5.html