6 years, 4 months ago.

Can I use USBDevice Library?

I'd like to use USBSerial using PA13, PA14, but it seems that L073 is not registered in the USBDevice library, but can somehow be used?

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32L073RZT6 microcontroller.

2 Answers

6 years, 4 months ago.

I am just a beginner, so my answer must be taken with caution. For me, yes you can use the usb serial as shown below (example running on NUCLEO-L073RZ board) but may be not with pins PA13 and PA14. On the NUCLEO-L073RZ board these pins are not useable. It also seems not possible to use them as USB wires with other boards. The section "pin descriptions" of the data sheet (pages 42 and next) does not mention usb function for these pins.


Serial pc(SERIAL_TX, SERIAL_RX); DigitalOut myLed(LED2);

int main() { int i = 1 ; myLed = 0 ; pc.printf("Hello World!\n"); while(1) { char c = pc.getc(); Read hyperterminal wait (1) ; pc.printf("This program runs since %d seconds.\n", i++) ; if ( (i % 2) == 0){ myLed = 1 ; } else { myLed = 0 ; } } }

Thank you Hervé DELACOURT. However, since it is planned to finally use the ST-LINK part separately, I do not want to use SERIAL_TX / SERIAL_RX and I would like to try using pure USB. Signal lines are out on the connector, and since USB pin was mentioned in PinNames.h, I am happy if it can be used. L4xx is registered in the library but there is a reason why L0xx is not registered · · ·

posted by Takahito Niino 19 Jul 2017
6 years, 4 months ago.

Dear Takahito Niino,

USB pins are PA_11 and PA_12 (as stated in the document mentionned by Hervé Delacourt). The pins PA_13 and PA_14 are not related to USB.

ST team does not support the USB on this device because the NUCLEO 64 pins board does not have a USB plug. You could however easily port it from the STM32L072.

I have checked in the TARGET_NUCLEO_L073RZ that the USB system clock is correctly set.

You can use feature/unsupported.USBDevice/targets/TARGET_STM/USBHAL_STM32L072CZ.h as a reference.

Let use know how it goes.

Kind regards