cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H747I-DISCO Virtual Com via USART

Najati
Associate II

I may be reading the disco board manual incorrectly, but it leads me to believe that I should be able to write to USART1 and have it show up on the virtual com port in windows.

I have my logic analyzer tapped into pins PB14/PB15, which are thankfully exposed on the STMod+ connector, and the logic analyzer is able to see the expected data coming across the pins.

I've tried:

  1. Configuring just the USART (not the USB VCP middleware), sending via HAL_UART_Transmit
  2. Configuring the USART and USB VCP middlewareand sending via HAL_UART_Transmit
  3. Configuring the USART and USB VCP middlewareand sending via CDC_Transmit_FS
  4. Configuring just the USB VCP middlewareand (not USART) sending via CDC_Transmit_FS

If I do 1 or 2, I can see the data coming out of the USART pins via the logic analyzer. When I do 3 or 4, CDC_Transmit_FS returns USBD_BUSY as it seems like the USB CDC isn't fully initialized. I found another post about this and apparently there used to be a bug in the library, but I tried adding timeouts and messing without other stuff and nothing that seemed reasonable had any results.

Ideally I can just use USART1 and HAL_UART_Transmit and get that stuff to come out of the Virtual COM Port - is that how it's supposed to work? I have a USB->RS232 adapter coming in the mail tomorrow, which'll help me diagnose further, but I figure I'd ask to see if my expectations around the VCP are reasonable.

Cheers,

Najati

4 REPLIES 4
TDK
Guru

> it leads me to believe that I should be able to write to USART1 and have it show up on the virtual com port in windows.

This is correct.

> I've tried:

You only need to configure the USART and use HAL_UART_Transmit. The UART to USB bridge is taken care of by the ST-Link chip.

> I have my logic analyzer tapped into pins PB14/PB15

Looks like the VCP on the board is on PA9/PA10.

0693W000003OnQSQA0.png

If you feel a post has answered your question, please click "Accept as Solution".
Najati
Associate II

Ah! Of course! Don't know why I assumed that USART1 only had one option for output pins :downcast_face_with_sweat:

Thanks for the quick response - that solved it! =)

Is there an easy way to find what pins can be chosen for each function (e.g. USART1_RX/USART1_TX). It's easy enough to see what functions are available for a pin, I'd love to be able to see which pins are options for a given function.

Cheers and thanks!

TDK
Guru

> Is there an easy way to find what pins can be chosen for each function

In my opinion, the easiest way is to open STM32CubeMX with your chip, configure USART1, then Ctrl+Click on each pin to see the alternatives.

You can also search for "usart1_tx" and similar in the datasheet.

If you feel a post has answered your question, please click "Accept as Solution".
Najati
Associate II

I'd never noticed the ctrl-click prompt before, that's a great tip - thanks!