cancel
Showing results for 
Search instead for 
Did you mean: 

Is anyone done USART in STM32L4R9I-DISCO Discovery Kit please share ... I have trouble doing LPUSART

ukn.1
Associate II

UART_HandleTypeDef hlpuart1;

///init///

hlpuart1.Instance = LPUART1;

  hlpuart1.Init.BaudRate = 256000;

  hlpuart1.Init.WordLength = UART_WORDLENGTH_8B;

  hlpuart1.Init.StopBits = UART_STOPBITS_1;

  hlpuart1.Init.Parity = UART_PARITY_NONE;

  hlpuart1.Init.Mode = UART_MODE_TX_RX;

  hlpuart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;

  hlpuart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;

  hlpuart1.Init.ClockPrescaler = UART_PRESCALER_DIV1;

  hlpuart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;

  hlpuart1.FifoMode = UART_FIFOMODE_DISABLE;

 uint8_t Test[] = "Hello World !!!\r\n"; //Data to send

  if (HAL_UART_Transmit(&hlpuart1,Test,sizeof(Test),100)!= HAL_OK)

  {

    Error_Handler();

  }

4 REPLIES 4

If it use GPIOG bank makes sure that is enabled/powered, there is a special setting to enable VddIo2

U​se strlen rather than sizeof as latter also counts NUL

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ukn.1
Associate II

that is working when I use it alone but when I used embedded wizard UI along with that code then it will not work for me

I don't trust Wizards, they're a mercurial bunch..

  /* Enable voltage range 1 boost mode for frequency above 80 Mhz */
  __HAL_RCC_PWR_CLK_ENABLE();
  HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST);
  HAL_PWREx_EnableVddIO2(); /* IOSV bit MUST be set to access GPIO port G[2:15] */
  __HAL_RCC_PWR_CLK_DISABLE();

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ukn.1
Associate II

Ok

​Let me check it

Thanks for your support ​