‎2020-08-09 03:03 PM
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:
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
‎2020-08-09 03:23 PM
> 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.
‎2020-08-09 03:49 PM
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!
‎2020-08-09 04:32 PM
> 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.
‎2020-08-09 06:38 PM
I'd never noticed the ctrl-click prompt before, that's a great tip - thanks!