Skip to main content
Visitor II
July 19, 2024
Solved

custom board with stm32g0 as USB device isn't working

  • July 19, 2024
  • 1 reply
  • 1829 views

Hello everyone,
I am working on a custom board equipped with the STM32G0B1RE microcontroller. I did not design this board, but it has the following characteristics:

- the microcontroller is powered at 1.8V,

- the USB pins are enabled with the following configuration:

seba21_0-1721372076394.png

 

seba21_1-1721372094468.png

And the USB device mode and configuration:

seba21_4-1721372316967.png

 

On the hardware level, the board does not have any ESD protection, but the USB data lines go directly into the microcontroller, according to the following schematic:

seba21_2-1721372158767.pngseba21_3-1721372253739.png


I tried connecting the board to the PC to send data via USB and simply used these two lines of code found online:

#include "usb_device.h"

#include "usbd_cdc_if.h"

....

char *data = "USB CDC\n";

...

int main(void)

{

...

MX_USB_Device_Init();

...

while(1) {

CDC_Transmit_FS(data, strlen(data));

HAL_Delay (1000);

}

}


However, the communication does not work, and the PC always says "USB device not recognized."
How can I get this to work?


PS: unfortunately, the board does not have an HSE but only an HSI. Here is the USB clock tree:

seba21_5-1721372447908.png

Thank you all!

 

    This topic has been closed for replies.
    Best answer by AScha.3

    Hi,

    >How can I get this to work?

    Not at all , at 1.8V . 

    USB needs 3.3V supply , because signal level is 3v3. 

    +

    For reliable USB connection usually a crystal as clock source is needed, as given in ds , note:

    AScha3_0-1721373607967.png

    So : no USB here, until you have a crystal/HSE and 3V VDD supply .

    1 reply

    AScha.3Answer
    Super User
    July 19, 2024

    Hi,

    >How can I get this to work?

    Not at all , at 1.8V . 

    USB needs 3.3V supply , because signal level is 3v3. 

    +

    For reliable USB connection usually a crystal as clock source is needed, as given in ds , note:

    AScha3_0-1721373607967.png

    So : no USB here, until you have a crystal/HSE and 3V VDD supply .

    seba21Author
    Visitor II
    July 19, 2024

    I feared this.
    I had the same problem with the FDCAN module and I had to use voltage level translators.
    Could such an approach work for the USB as well?

    Thank you!

    Super User
    July 19, 2024

    Maybe your the first, to try it ... :)

    (I never seen such a idea , because if want/need USB , usually everybody sets the system to state, where USB is working out of the box. )

    And unknown: will the on-chip USB unit work at 1.8V ? This is experimental - try it, but dont be surprised, if its not working at all.