Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Printf issues on nucleoF401RE

Hello,
I’m currently using a nucleoF401RE with HAL cube drivers to control an arduino 9 axes motion shield.

I would like to send message to my pc terminal through the printf function but i have some trouble.
Since the Uart pin are not configured i have to do it myself, so, as recommended i implemented the HAL_UART_MspInit function:



GPIO_InitTypeDef GPIO_InitStruct;

__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_USART2_CLK_ENABLE();

/*Reglages des ports*/
GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

GPIO_InitStruct.Pin = GPIO_PIN_3;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);



And i set the huart handler as recommended :



huart.Instance = USART2;

huart.Init.BaudRate = 9600;
huart.Init.WordLength = UART_WORDLENGTH_8B;
huart.Init.StopBits = UART_STOPBITS_1;
huart.Init.Parity = UART_PARITY_NONE;
huart.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart.Init.Mode = UART_MODE_TX_RX;
huart.Init.OverSampling = UART_OVERSAMPLING_16;

if(HAL_UART_Init(&huart) != HAL_OK)
{
/* Initialization Error */
Error_Handler();
}



But when i’m using printf() function nothing happened... BUT if i used the function HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout) which is already implemented, i’m able to send data though the serial port.

Could you help me to “fix” the printf() function ? As i dont know how to send full words or data values with the HAL_UART_Transmit function.

Thank you very much
PMA

Tunisia

Hello Pierre-marie,

You have just to modify the _write function in your syscall.c and the ‘io_putchar’ in your main.c

just like mentioned in this topicQuestion

Regards,
Tarek


Thank you very much, i will try this !

 

Newest Forum Posts

  1. STM32 MCU model shortlisting for Making RC remote by Palvish, 2025-07-07 15:05
  2. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  9. Build a project in "release" mode by tang, 2025-02-20 10:36
  10. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35

Last-Modified Blogs