Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TM4C123 Datasheet here: http://www.ti.com/lit/ds/symlink/tm4c123gh6pm.pdf // Initialize UARTO void serial_init)I //1. Set up GPIO //A. Configure GPIO module associated with UARTO // i. Turn on clock

TM4C123 Datasheet here: http://www.ti.com/lit/ds/symlink/tm4c123gh6pm.pdf

image text in transcribed

image text in transcribed

image text in transcribed

// Initialize UARTO void serial_init)I //1. Set up GPIO //A. Configure GPIO module associated with UARTO // i. Turn on clock for GPIO Port A SYSCTL RCGCGPIOR= SYSCTL RCGCGPIOR I Ob 00 0001; // 0x01 - // ii. Enable alternate function for PAO, PA1 and set functionality GPIOPORTA.AFSELR I= BITI I BIT0); // UARTO TX and RX GPIO FORTA_PCTL_R 0x - - ; //Set port A pins 0&1 tokala // iii. Set digital or analog mode, and pin directions GPIO-PORTA. DENR l= (BITI I BITO); //Set pins 0 & 1 digital mode GPIO PORTA DIR R-BTO; // Set pin 0 {RX) to input GPIO PORTA DIR R I= BIT1; // Set pin 1 (Tx) to output // 2. Set up UART device // A. Configure UART functionality, frame format and Baud speed //Disable UART0 device while we set it up UART0CTLRUARTCTL UARTEN; - - - // Set desired UART functionality UARTO CTL R = 0bO 01000000000; // Receive enable, TX disabled //Set baud rate (9600 Baud) UARTO-BAD-R= 104: //16,000,000 / (16 * 9600) = 104.16666 UARTO EBRD_R 11: / .1666 64+511.16666 UART 0 CC R = 0; //Use system clock as UART clock 3our ce //Set frame format: use frame format specified in Question 1 UART 0_LCRH-R = Ob // B. Setup UARTO interrupts UART 0-ICR-R != 0b00010000; // Clear RX interrupt status flag UARTO IM R 0b00010000: / Enable RX interrupts 1 3. NVIC setup A. Configure NVIC to allow UART interrupts NVIC-PRI IR I= Ox00002000; //Set UARTO IRQ pri to 1 {bits 15-13) NVIC ENOR I= 0x //Enable UARTO IRQ (IRO 5) - // B. Bind UARTO interrupt requests to user' s Interrupt Handler IntRegister (INT UARTO, My UARTO Handler); //Re-enable UARTO UARTOCTLR= UARTO CTL R | 0x01; IntMasterEnable: //Globally allows CPU to service interrupts - - // Initialize UARTO void serial_init)I //1. Set up GPIO //A. Configure GPIO module associated with UARTO // i. Turn on clock for GPIO Port A SYSCTL RCGCGPIOR= SYSCTL RCGCGPIOR I Ob 00 0001; // 0x01 - // ii. Enable alternate function for PAO, PA1 and set functionality GPIOPORTA.AFSELR I= BITI I BIT0); // UARTO TX and RX GPIO FORTA_PCTL_R 0x - - ; //Set port A pins 0&1 tokala // iii. Set digital or analog mode, and pin directions GPIO-PORTA. DENR l= (BITI I BITO); //Set pins 0 & 1 digital mode GPIO PORTA DIR R-BTO; // Set pin 0 {RX) to input GPIO PORTA DIR R I= BIT1; // Set pin 1 (Tx) to output // 2. Set up UART device // A. Configure UART functionality, frame format and Baud speed //Disable UART0 device while we set it up UART0CTLRUARTCTL UARTEN; - - - // Set desired UART functionality UARTO CTL R = 0bO 01000000000; // Receive enable, TX disabled //Set baud rate (9600 Baud) UARTO-BAD-R= 104: //16,000,000 / (16 * 9600) = 104.16666 UARTO EBRD_R 11: / .1666 64+511.16666 UART 0 CC R = 0; //Use system clock as UART clock 3our ce //Set frame format: use frame format specified in Question 1 UART 0_LCRH-R = Ob // B. Setup UARTO interrupts UART 0-ICR-R != 0b00010000; // Clear RX interrupt status flag UARTO IM R 0b00010000: / Enable RX interrupts 1 3. NVIC setup A. Configure NVIC to allow UART interrupts NVIC-PRI IR I= Ox00002000; //Set UARTO IRQ pri to 1 {bits 15-13) NVIC ENOR I= 0x //Enable UARTO IRQ (IRO 5) - // B. Bind UARTO interrupt requests to user' s Interrupt Handler IntRegister (INT UARTO, My UARTO Handler); //Re-enable UARTO UARTOCTLR= UARTO CTL R | 0x01; IntMasterEnable: //Globally allows CPU to service interrupts

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

How does roaming work?

Answered: 1 week ago

Question

Define $e$nsus ad idem c/ pro quo

Answered: 1 week ago