Question: i ) Configure the functions in the . C file below for USART 1 . #include uart.h void UART _ Init ( ) {

i) Configure the functions in the .C file below for USART1.
#include "uart.h"
void UART_Init()
{
// Enabling Clock for GPIOB
RCC->AHB1ENR |=(1U << a)_______);
// Configuring RX and TX Pin
GPIOb)_______-> c)________|=(2U <<12U)|(2U <<14U); // Setting Mode Alternate Function for PB6 and PB7
GPIOB->OSPEEDR |=(3U <<12U)|(3U <<14U); // Configuring speed High for PB6 and PB7
GPIOB-> d)_________|=(7<<24U)|(7<<28U); // Setting AF7 for PB6 and PB7
// Enabling Clock for USART1
RCC->e)_________|=(1<< f)_________ ;
// Disabling UART for Configuring
g)__________ &= ~(1U <<13U);
// Enabling TX & RX
USART1->CR1|= h)_______ ;
Configuration continues............
i)_______|= j)_______ ; // Last step of configuring USART1
}
void UART_SendChar(uint8_t ch)
{
while (!(USART1->SR & (1<<7))) ;
k)___________= ch;
}
uint8_t UART_ReceiveChar()
{
while (!(l)____________ & (1<<5)))// holding Rx Buffer is not empty ///0= empty, 1= not empty
;
return USART1->DR;
}
ii) Short Questions 1 x 4=4
In UART_SendChar(uint8_t ch) function, why do we use the logic (!(USART1->SR & (1<<7))) for the while loop?
Ans.
Which bus is being used for USART1? Which other USARTs could we use from that bus?
Ans.
What was the last step of configuring USART? Why is it necessary to write that command?
Ans.
Which alternate function are we using for this configuration? Name one other pair of TX/RX pins for USART1 from that alternate function that we could have used? [Use the alternate function table to answer]
Ans.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!