Question: This exercise develops a serial I / O driver for the KL 0 5 Z board. The objective of this exercise is to implement interrupt
This exercise develops a serial IO driver for the KLZ board. The objective of this exercise is to implement interruptbased serial communication with the KL UART using circular FIFO queues for receiving and transmitting serial data. An interrupt service routine ISR and serial character IO driver are written and integrated with the circular FIFO queue operations test program from Lab Exercise Seven, and they are run on the KLZ board.
Prelab Work
Based on the specifications below and the notes you have taken in lecture, rewrite the following subroutines from prior lab exercises to work with receive and transmit queues rather than the UART data registers. You must write the subroutines so that no register other than output parameter registers and PSR has changed value after return.
GetChar: Dequeues a character from the receive queue, and returns it in R
PutChar: Enqueues the character from R to the transmit queue.
Following the specifications in this exercise and the notes you have taken in lecture, write the ISR that handles UART transmit and receive interrupts: UARTOISR. You must write the ISR so that no registers have changed value after return. Note: the CortexM automatically preserves RR R LR PC and PSR for ISRs.
Write the change required in the KL vector table to "install" UARTOISR.
Write the subroutine InitUARTOIRQ to initialize the KL as discussed in class and presented in the class notes for interruptbased serial IO with UART through port B pins and using this format: one start bit, eight data bits, no parity, and one stop bit at baud the same format and speed as previous lab exercises but with interrupts instead of polling. This subroutine should configure UART should initialize the UART interrupt in the NVIC, and should initialize the receive and transmit queue management record structures RxQRecord and TxQRecord for character queue buffers RxQBuffer and TxQBuffer, respectively using InitQueue from Lab Exercise Seven. You must write the subroutine so that no registers have changed value after return. Suggestion: copy InitUARTOPolling that has been used since Lab Exercise Five, and modify it to use interrupts instead of polling, including changing UART initialization to support UARTOISR and calling InitQueue from Lab Exercise Seven to initialize the receive and transmit queue management record structures.
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
