STM32_UART_BareMetal
uart.c File Reference
#include "uart.h"
#include "rcc.h"
#include "gpio.h"
Include dependency graph for uart.c:

Functions

int __io_putchar (int ch)
 
void USART3_Tx_Init (void)
 
void UARTx_Write (USART_TypeDef *USARTx, uint8_t val)
 
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)
 
uint16_t UARTx_ComputeDivider (uint32_t PerpihClock, uint32_t Baudrate)
 
void UARTx_SetTransferDirection (USART_TypeDef *USARTx, uint32_t Direction)
 

Function Documentation

◆ __io_putchar()

int __io_putchar ( int  ch)

Retargeting part of implementation of printf.
From now on, USART3 will be used

Parameters
[in]chcharacter to be sent
Here is the call graph for this function:

◆ 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: