I am currently trying to use the USB capability on a custom board using an STM32F303RD (RE was out of stock when I purchased, and the reduced ROM size should not be a problem). I use a custom board config based on the NUCLEO F303RE available in the mbed sources.
I just need a simple virtual serial port, but I cannot make it work using mbed (6.2.0 via platformio) and an example as simple as something like :
#include "mbed.h"
#include "USBSerial.h"
USBSerial serial;
int main(void)
{
while (1) {
serial.printf("I am a virtual serial port\r\n");
ThisThread::sleep_for(1000);
}
}
Does not work: it compiles ok, but the USB port is not recognized by my laptop (With errors in my syslog like āDevice not responding to setup address.ā)
The DFU works fine and I have been able to execute a basic test built from STM32Cube (based on the USB CDC tutorial), so the HW should be ok (I am using an external 8MHz crystal).
Now looking in the targets/TARGET_STM/TARGET_STM32F3/ directory, it seems there is very few code dedicated to USB FS handling.
So my question is: did I missed something or is the USB FS on the STM32F3 family actually not supported by mbed 6?
Usually, the USB is supported only on boards what have a onboard USB connector and then also boards what not have onboard connector but use same/similar chip (USB interface).
How you can see here is no F3XX target with USB tag and also in the folder of F3xx targets are missing USB HAL Drivers.
So I think I can say - NO, the USB feature is not supported on STM32F3XX targets for now.
Ok but unless Iām wrong the NUCLEO_F303ZE do have a USB connector (directly connected to the MCU I mean, in addition to the ST-Link one on the F103).
So I would have expected for the mbed USB stack to be implemented on the STM32F3 family.
Note that I have almost no knowledge of the mbed internals, Iāve started using mbed for a few nucleo based pet projects. This one is my first custom board.
Also, on here the F303ZE is listed with āUSB 2.0 full-speedā which is a bit misleading (I get why it is like that, I guess, still make it easy to get confused).
So Iāll have to wait until the USB stack is implemented (/ ported from ST Cube?) I guess to implement my serial based feature.
Iāve used nucleo f303reās definition from target/target.json as base, and I made a (partial) copy of targets/TARGET_STM/TARGET_STM32F3/TARGET_STM32F303xE/TARGET_NUCLEO_F303RE/, but it looks there is no much more help in the NUCLEO_F303ZE (unless Iām mistaken).
Yes, you are right but I also wrote āusuallyā And the description on boardās page is a summary of what the board can do not what is supported on Mbed, it is confusing.
Just for clarification. The work around boardās page and and its porting to Mbed is responsibility of Board Partner, in this case ST.
So you can try to contact STās employe @jeromecoutant. He can lead you where you can start.
Thanks Jan, Iāll ask Jerome about heir plan on this, and give a look at this library, just in case. (and yes there is some confusion on between board, MCU and mbed abilitiesā¦ not to mention mbed versions, and the gazillion examples and discussions actually referring to mbed 2 or 5
Thanks for the response, but the clock is already set up properly for the STM32F3 target (which the main part of this PR, if I understand the code right) eg. in system_clock.c (for the F303RE) or system_clock.c (F303ZE), especially in the case of an external 8MHz crystal is used.