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 I/O driver for the KL05Z board. The objective of this exercise is to implement interrupt-based serial communication with the KL05 UART using circular FIFO queues for receiving and transmitting serial data. An interrupt service routine (ISR) and serial character I/O driver are written and integrated with the circular FIFO queue operations test program from Lab Exercise Seven, and they are run on the KL05Z board.
Prelab Work
1. 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 register(s) and PSR has changed value after return.
- GetChar: Dequeues a character from the receive queue, and returns it in R0.
- PutChar: Enqueues the character from R0 to the transmit queue.
2. Following the specifications in this exercise and the notes you have taken in lecture, write the ISR that handles UART0 transmit and receive interrupts: UARTO_ISR. You must write the ISR so that no registers have changed value after return. (Note: the Cortex-M0+ automatically preserves R0-R3, R12, LR, PC, and PSR for ISRs.)
3. Write the change required in the KL05 vector table to "install" UARTO_ISR.
4. Write the subroutine Init_UARTO_IRQ to initialize the KL05 as discussed in class and presented in the class notes for interrupt-based serial I/O with UART0 through port B pins 1 and 2 using this format: one start bit, eight data bits, no parity, and one stop bit at 9600 baud - the same format and speed as previous lab exercises but with interrupts instead of polling. This subroutine should configure UART0, should initialize the UART0 interrupt in the NVIC, and should initialize the receive and transmit queue management record structures (RxQRecord and TxQRecord) for 80-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 Init_UARTO_Polling that has been used since Lab Exercise Five, and modify it to use interrupts instead of polling, including changing UART0 initialization to support UARTO_ISR and calling InitQueue from Lab Exercise Seven to initialize the receive and transmit queue management record structures.)
This exercise develops a serial I / O driver for

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!