STM32_UART_BareMetal
uart.h File Reference
#include <stdint.h>
#include "stm32h7xx.h"
Include dependency graph for uart.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define UART3_TX   (1U << 8)
 
#define USART3_EN   (1U << 18)
 
#define USART3_WIDTH_8b   (0U << 0)
 
#define USART3_PARITY_NONE   (0U << 0)
 
#define USART3_STOPBITS_1   (0U << 0)
 
#define USART3_DUPLEX_FULL   (0x3 << 3)
 

Functions

uint16_t UARTx_ComputeDivider (uint32_t PerpihClock, uint32_t Baudrate)
 
void UARTx_Config (USART_TypeDef *USARTx, uint32_t DataWidth, uint32_t Parity, uint32_t StopBits)
 
void UARTx_SetBaudrate (USART_TypeDef *USARTx, uint32_t PeriphClock, uint32_t Baudrate)
 
void UARTx_Write (USART_TypeDef *USARTx, uint8_t val)
 
void UARTx_SetTransferDirection (USART_TypeDef *USARTx, uint32_t Direction)
 
void USART3_Tx_Init (void)
 

Macro Definition Documentation

◆ UART3_TX

#define UART3_TX   (1U << 8)

◆ USART3_DUPLEX_FULL

#define USART3_DUPLEX_FULL   (0x3 << 3)

◆ USART3_EN

#define USART3_EN   (1U << 18)

◆ USART3_PARITY_NONE

#define USART3_PARITY_NONE   (0U << 0)

◆ USART3_STOPBITS_1

#define USART3_STOPBITS_1   (0U << 0)

◆ USART3_WIDTH_8b

#define USART3_WIDTH_8b   (0U << 0)

Function Documentation

◆ UARTx_ComputeDivider()

uint16_t UARTx_ComputeDivider ( uint32_t  PerpihClock,
uint32_t  Baudrate 
)

USART generic baudrate divider calculation method.

Parameters
[in]PeriphClockPeripheral Clock frequency [Hz]
[in]BaudrateSelectected baudrate for USART
[out]BaudDivCalculated baudrate divider based on clock and desired baudrate
Here is the caller graph for this function:

◆ UARTx_Config()

void UARTx_Config ( USART_TypeDef *  USARTx,
uint32_t  DataWidth,
uint32_t  Parity,
uint32_t  StopBits 
)

USART generic configuration method.

Parameters
[in]USARTxUSART Handler
[in]DataWidthWidth of data (refer to USARTx_CR1)
[in]ParityEnable of disable parity check (refer to USARTx_CR1)
[in]StopBitsNumber of stop bits (refer to USARTx_CR2)
Here is the caller graph for this function:

◆ UARTx_SetBaudrate()

void UARTx_SetBaudrate ( USART_TypeDef *  USARTx,
uint32_t  PeriphClock,
uint32_t  Baudrate 
)

USART generic baudrate selection method.

Parameters
[in]USARTxUSART Handler
[in]PeriphClockPeripheral Clock frequency [Hz]
[in]BaudrateSelectected baudrate for USART
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UARTx_SetTransferDirection()

void UARTx_SetTransferDirection ( USART_TypeDef *  USARTx,
uint32_t  Direction 
)

USART generic tranmission selection method.

Parameters
[in]USARTxUSART Handler
[in]DirectionTransmission direction [Half Duplex, Full Duplex] (refer to USARTx_CR1)
Here is the caller graph for this function:

◆ UARTx_Write()

void UARTx_Write ( USART_TypeDef *  USARTx,
uint8_t  val 
)

USART generic write method.
Applicable for both cases, when FIFO is disabled or enabled.

Parameters
[in]USARTxUSART Handler
[in]valValue to be sent over USART (refer to USARTx_ISR and _TDR)
Here is the caller graph for this function:

◆ USART3_Tx_Init()

void USART3_Tx_Init ( void  )

USART3 initialization for transmission purposes.
For STM32H723 nucleo board, following pins are used:

  • PD8 for Tx
  • PD9 for Rx
Here is the call graph for this function:
Here is the caller graph for this function: