2023-01-14 07:25 AM
My code is simply :
HAL_Delay(100);
HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_5);
uint8_t buffer[] = "Hello, World!\r\n";
CDC_Transmit_FS(buffer, sizeof(buffer));
But nothing...
> The led is blinking.
> The VCp is define via *.IOC with no error.
> Compilation without error.
I see a VCP but i think is the st-link debugger VCP.
It's right ?
Do you have advice for me ?
Solved! Go to Solution.
2023-01-14 09:28 AM
ok, i have unterdand.
NO vcp by configure VCP port BUT juste by UART2 !
char buffer[]="Hello\r";
HAL_Delay(100);
HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_5);
HAL_UART_Transmit(&huart2, (unsigned char *)&buffer, 6, sizeof(buffer));
2023-01-14 07:56 AM
You'd need to have soldered on a USB connection to get one directly from the STM32L152
The primary USB connection is for the ST-LINK/V2 and connects to the STM32F103 on the board.
To use the ST-LINK VCP you'll need to output to the connected UART
2023-01-14 08:03 AM
Maybe good for beginer is STM32 microcontroller debug toolbox - Application note
and for your code chapter 7
2023-01-14 08:57 AM
hummm, sure BUT !
on page we can read :
"Embedded versions usually supports the following additional features:
• Virtual COM port interface on USB. (VCP)
• Mass storage interface on USB".
It's not very clear
2023-01-14 08:58 AM
idem page 68
STM32 Virtual COM port driver STM32 Virtual COM Port Driver (VCP) is a feature supported by ST-LINK/V2-B embedded in most of recent hardware kits (refer to Section 2.1: Hardware development tools on page 9). It is a RS232 emulation through ST-LINK USB connection. On the PC side, this requires driver software package (STSW-STM32102) included in STLINK driver (STSW-0009). Once the target is connected, it is seen as a serial port on the PC. An example is presented in Figure 47.
2023-01-14 09:28 AM
ok, i have unterdand.
NO vcp by configure VCP port BUT juste by UART2 !
char buffer[]="Hello\r";
HAL_Delay(100);
HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_5);
HAL_UART_Transmit(&huart2, (unsigned char *)&buffer, 6, sizeof(buffer));
2023-01-14 09:40 AM
The last parameter is a timeout, not a length, use strlen() to count characters in strings.
2023-01-14 11:21 AM
Your best answer isnt very best. Primary VCP configured port CDC is for USB interface on target MCU, not for onboard STLink debuger.
Secondary &buffer isnt normal addr , right is &buffer[0] or only buffer etc.