2024-11-24 11:00 AM - edited 2024-11-24 11:33 AM
Hello,
I am new to stm programming. I got a STM32L496G-DISCO board and I wanted to create a new project. When I try to configure the pins i have a lot of yellow triangle warning icons and some of the fields are purple which can not be changed. I don't know if that is normal or am I doing something wrong. I tried an simple UART code and it doesn't work. It keeps on shutting down automatically and this appears the second I compile "
Verifying ...
Download verified successfully
Shutting down...
Exit."
Solved! Go to Solution.
2024-12-02 06:43 AM - edited 2024-12-02 06:49 AM
Hello,
As I can see from your screenshots, you started the project from a board instead of the MCU part number and you selected to initialize all the available peripherals. Here no need to configure USART2 as it was already configured by CubeMx with "initialize all the peripherals" option.
According to the board schematics: USART2_Tx: PA2 and USART2_Rx: PD6:
Which is confirmed with CubeMx:
As USART2 is connected to the STLINK-Virtual comport, you can use STLINK as UART- to-USB bridge.
But you need to check all the UART parameters: baudrate, parity etc ..
2024-11-24 11:26 AM
UART1 is connected to the STMOD+, USART2 is tunneled to the host via ST-LINK USB VCP, see board schematics, so USART2 should work.
On a DISCO board (in contrast to Nucleo) most pins are already routed on the PCB and thus have a dedicated purpose. Generally hover over the red/yellow marks and read the explanations. Cross check with the board schematics. Yellow means: not every config of that peripheral is possible because of pin conflicts, but at least one specific config is still possible. Red means: no config of a peripheral is possible because they all will generate pin conflicts.
hth
KnarfB
2024-12-02 06:30 AM
Hi, sorry for replying so late, I coudn't test it till now. I have changed to USART2 and i keep having the exact same problem when I compile it "
"
Verifying ...
Download verified successfully
Shutting down...
Exit."
" and nothing on my PuTTy program. I only used this for the code "
while (1)
{
/* USER CODE END WHILE */
HAL_UART_Transmit(&huart2, tx_buffer, 27, 10);
HAL_Delay(1000);
/* USER CODE BEGIN 3 */
}
"and i declare tx_buffer as "uint8_t tx_buffer[27]="Welcome to BinaryUpdates!\n\r";". I also attached a photo with the configuration of USART2
2024-12-02 06:43 AM - edited 2024-12-02 06:49 AM
Hello,
As I can see from your screenshots, you started the project from a board instead of the MCU part number and you selected to initialize all the available peripherals. Here no need to configure USART2 as it was already configured by CubeMx with "initialize all the peripherals" option.
According to the board schematics: USART2_Tx: PA2 and USART2_Rx: PD6:
Which is confirmed with CubeMx:
As USART2 is connected to the STLINK-Virtual comport, you can use STLINK as UART- to-USB bridge.
But you need to check all the UART parameters: baudrate, parity etc ..