cancel
Showing results for 
Search instead for 
Did you mean: 

UART stm32F767ZI

Samuel1
Associate III

Hello everybody,

i wanted to send data from realterm serial to the stm32F767ZI but it dose not work. i cant see any message on my terminal. The same code is working good with STMF446re. The UART2 with STM32F4446re is connected to the USB Port. but with stm32F767ZI i am not sure and i searched in datasheet to find any info but i did not find. please i need your help.

#[UART/USART]​ #I2C​ 

3 REPLIES 3

Perhaps try looking at the F7 HAL code examples?

The NUCLEO-F767ZI likely uses a different USART and pins.

//****************************************************************************
 
void OutChar(char c)
{
  while((USART3->ISR & USART_ISR_TXE) == 0); // Wait for Empty
  USART_RS232->TDR = c; // Send Char
}
 
//****************************************************************************
 
void USART3_Init(void) // USART3 PD8/PD9 NUCLEO VCP
{
  GPIO_InitTypeDef GPIO_InitStruct = { 0 };
  UART_HandleTypeDef UartHandle = { 0 };
 
  __USART3_CLK_ENABLE();
  __GPIOD_CLK_ENABLE();
 
  /* UART RX/TX GPIO pin configuration  */
  GPIO_InitStruct.Pin       = GPIO_PIN_8 | GPIO_PIN_9;
  GPIO_InitStruct.Mode      = GPIO_MODE_AF_PP;
  GPIO_InitStruct.Pull      = GPIO_PULLUP;
  GPIO_InitStruct.Speed     = GPIO_SPEED_HIGH;
  GPIO_InitStruct.Alternate = GPIO_AF7_USART3;
 
  HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
 
  /*## Configure the UART peripheral ######################################*/
  /* Put the USART peripheral in the Asynchronous mode (UART Mode) */
  /* UART1 configured as follow:
      - Word Length = 8 Bits
      - Stop Bit = One Stop bit
      - Parity = NO parity
      - BaudRate = 115200 baud
      - Hardware flow control disabled (RTS and CTS signals) */
  UartHandle.Instance        = USART3;
 
  UartHandle.Init.BaudRate   = 115200;
  UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
  UartHandle.Init.StopBits   = UART_STOPBITS_1;
  UartHandle.Init.Parity     = UART_PARITY_NONE;
  UartHandle.Init.HwFlowCtl  = UART_HWCONTROL_NONE;
  UartHandle.Init.Mode       = UART_MODE_TX_RX;
 
  UartHandle.Init.OverSampling   = UART_OVERSAMPLING_16;
#ifdef UART_ONE_BIT_SAMPLE_DISABLE
  UartHandle.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
#endif
 
  if (HAL_UART_Init(&UartHandle) != HAL_OK)
  {
    /* Initialization Error */
    Error_Handler();
  }
}
 
//****************************************************************************

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

Assuming you are using the same UART and that is valid on the same port/pinno combinations then it is almost certainly the alternate function setting.

For example UART 5 on the H743 and F767 can both be PB12/PB13 but one is GPIO_AF14_UART5 and the other GPIO_AF8_UART5

S.Ma
Principal

Compare the UART register description in the reference manuals to see if both come from the same design IP version.

SPI has 3 versions, UART probably 2+ (one on the H7 has FIFOs)