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 USART
#include "uart.h
void UARTInit
Enabling Clock for GPIOB
RCCAHBENR U a;
Configuring RX and TX Pin
GPIOb cU UU U; Setting Mode Alternate Function for PB and PB
GPIOBOSPEEDR U UU U; Configuring speed High for PB and PB
GPIOB dUU; Setting AF for PB and PB
Enabling Clock for USART
RCCe f ;
Disabling UART for Configuring
g & ~U U;
Enabling TX & RX
USARTCR h ;
Configuration continues............
i j ; Last step of configuring USART
void UARTSendCharuintt ch
while USARTSR & ;
k ch;
uintt UARTReceiveChar
while l & holding Rx Buffer is not empty empty, not empty
;
return USARTDR;
ii Short Questions x
In UARTSendCharuintt ch function, why do we use the logic USARTSR & for the while loop?
Ans.
Which bus is being used for USART 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 TXRX pins for USART 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
