-
Notifications
You must be signed in to change notification settings - Fork 3k
STM32F1 USBDevice #13406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STM32F1 USBDevice #13406
Conversation
@Allmoz, thank you for your changes. |
@Allmoz as this is actually a target update please change the PR type to patch. Also please fill in an actual summary for the PR rather than just quoting something else, thank you. |
Thanks @adbridge , done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with NUCLEO-F103RB:
- USB-DP connected to PA12
- USB-DM connected to PA11
- 1.5KOhm pull up to USB-DP PA12
targets/targets.json
Outdated
@@ -1280,7 +1280,8 @@ | |||
"device_has_add": [ | |||
"CAN", | |||
"SERIAL_ASYNCH", | |||
"FLASH" | |||
"FLASH", | |||
"USBDEVICE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we can't add it there, as USBDEVICEmeans you have an USB connector.
This can be only defined in each target (in you custom_target.json)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted
Maybe you could also check and add my commit in your PR ? :-) |
@jeromecoutant , ohhh i wanna test it so bad. does it fix that the USB issue that is not recognized after programming unless you connect->disconnect->connect? Sure I will add it. |
This PR cannot be merged due to conflicts. Please rebase to resolve them. |
af73fb5
to
a22f3e5
Compare
Awesome, it works on the STM32F103C8 and STM32F103RE. To achieve that behavior i was using:
Checked and added :) @adbridge with @jeromecoutant commit this turns also into a "[x] Feature update" ? |
The feature is already there, this is just enabling it for a target - it is a patch update. Thanks @Allmoz for the contribution. |
Will these changes apply to STM32F103CB as well? |
I think so |
CI started |
Jenkins CI Test : ❌ FAILEDBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
@Allmoz |
I'll schedule CI soon |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 2 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
Once we release the next Mbed OS version, we'll merge this. |
still can't use USBSerial on bluepill (STM32F103C8T6) board. |
you need to have the device declared in your custom_target.json:
the pin map in your custom PeripheralPins.c : //*** USBDEVICE *** MBED_WEAK const PinMap PinMap_USB_FS[] = { and the pin names in the custom PinNames.h
|
https://os.mbed.com/users/hudakz/code/mbed-os-bluepill/shortlog/ |
it can work successful, I added the clock source configuration in the med_app.json like this: |
has this been tested with ARMC6 compiler? A testprogram with USBMIDI is running on a Bluepill when compiled with gcc, but when I compile it MbedStudio, it produces a hardfault. |
I'm having trouble to get it to work with STM32F103RB target. I get no result in my UART port and USBSerial doesn't work either.
@jeromecoutant Have you tested it with this target? |
Yes... as said in a previous comment:
|
and #13522 |
@jeromecoutant Thanks for the update. I've used the USB6B1 chip but I haven't connected the pull-up resistor. But the code crashes for me. Also, the console doesn't work either to read the details of the exception. Now I will try to add the pull-up resistor and see if it works and report here. |
I added the Pull-up resistor and it works fine. I have two questions:
|
you can use USB with bare-metal, just add "drivers-usb" to the requires list. The USB device classes have defaults in the constructor, the first is 'connect_blocking'.
but you have to call usbserial.connect() later to connect. But this should be discussed in the Mbed forum. |
After mbed6.4 released, the USBSerial con't work on bluepill (stm32f103c8t6). All configration don't changed |
Hi,
Its true for me too, but this should on its own issue. could you make that new issue? |
Summary of changes
As requested in #13350
Assignation of the USB low priority interrupts for the USB interrupt for the STM32F1 target family. This should enable USB capability in F103 ( and hopefully in F102, and F105/F107 also).
Modified MCU_STM32F103x8 target files to add the needed peripheral definitions and clock configuration (same as NUCLEO_STM32F103RB now) to enable USBDEVICE on MCU_STM32F103x8 based boards.
Tested on a STM32F103C8 and STM32F103RE.
Tested on a NUCLEO_F103RB by @jeromecoutant
Impact of changes
Migration actions required
Documentation
None that I know
Pull request type
Test results
Reviewers
@jeromecoutant I'm not sure if adding it to the full STM32F1 is ok since I only tested it for STM32F103C8 and STM32F103RE.
I suppose "Test results" is "Covered by existing mbed-os tests", please confirm.
Best regards