This project provides a simple device driver for UART communication between boards running on the TM4C123GH6PM microcontroller. The project aims to facilitate computer-to-board communication using UART. The mini-project has a terminal interface that allows the user to send and receive data from the board. The project only has mode 1 that allows
Note: src/inc folder contains the source code and header files used for the UART device driver. The folders are only used for organization purposes. The entire project can be found in the Keilv5_proj folder.
V-1.1 update: The project now has a terminal interface that allows the user to send and receive data from the board. The project only has mode 1 that allows the user to change the color of the onboard LED and the brightness of the onboard LED.
V-1.2 update: The project now cycles through colors in a round robin fashion order when Switch 2 is pressed and relays each change to PC serial terminal 1. When a color is picked and shared with MCU2 via SW1, both MCU 1 will enter an idle state, awaiting color codes from MCU 2 and vice versa. This exchange between MCUs is a continuous process. To terminate Mode 2, send a ^ symbol from PC serial terminal 1.
- UART Initialization
- Data Transmission
- Data Reception
- Board to Board Communication via UART1
- TM4C123GH6PM microcontroller
- Keil uVision IDE
- Tera Term VT
- Clone the repository.
- Open the Keilv5_proj folder project in Keil uVision 5.
- Build the project.
- Turn on TM4C123GH6PM board 1 and upload the compiled code to your TM4C123GH6PM board 1.
- Communicate with the board using a tera terminal like interface with BAUD rate 57600.
- Select Mode 1 to change the color of the onboard LED and brightness of the onboard LED.
Pin | Usage |
---|---|
PF4 | Onboard Switch 1 |
PF3 | Onboard LED 3 (Green) |
PF2 | Onboard LED 2 (Blue) |
PF1 | Onboard LED 1 (Red) |
PF0 | Onboard Switch 2 |
Pin | Usage |
---|---|
PA1 | UART0 Tx (Transmit) |
PA0 | UART0 Rx (Receive) |
Pin | Usage |
---|---|
PD7 | UART2 Tx (Transmit) |
PA6 | UART2 Rx (Receive) |
Pin | Usage |
---|---|
PC7 | UART3 Tx (Transmit) |
PC6 | UART3 Rx (Receive) |
In Mode 1, only MCU1 and PC serial terminal 1 partake in the communication process.
- Communication between MCU1 and PC serial terminal 1:
57600
- MCU2 remains in an idle state.
- PC serial terminal 2 consistently displays its starting message.
- PC serial terminal 1 exhibits the "Mode 1 menu".
- Once option
1
is chosen from the Mode 1 menu, MCU1 begins communication by prompting PC serial terminal 1 to choose an LED color for display on MCU_1.- Available color choices:
r
: Redg
: Greenb
: Bluep
: Purpley
: Yelloww
: Whited
: Dark
- Available color choices:
- Upon user input of a color letter (followed by a carriage return):
- MCU1 updates its LEDs to the specified color.
- A confirmation message returns to PC serial terminal 1.
- For instance, if
r
is selected, the message will be:Red LED is on
- For instance, if
- The Mode 1 menu reappears on PC serial terminal 1.
- On selection of option
2
from the Mode 1 menu, a new prompt appears on PC serial terminal 1 asking for a decimal number. - This entered number determines the duty cycle, ranging from
0%
to100%
. - A PWM (Pulse-Width Modulation) signal, based on the duty cycle, is generated. This signal controls the brightness of the current LED(s).
- A confirmation message is then sent to PC serial terminal 1, after which the Mode 1 menu re-emerges.
- By selecting option
3
from the Mode 1 menu, the system concludes Mode 1 operations. - PC serial terminal 1 then displays its main menu.
In Mode 2, all four members of the communication system are actively involved.
- PC serial terminal 1 ↔ MCU1, MCU2 ↔ PC serial terminal 2:
57600
- MCU1 ↔ MCU2:
38400
- MCU1 uses
UART2
to communicate with MCU2. - MCU2 uses
UART3
to communicate with MCU1.
MCU1 will initiate the communication. To terminate the mode at any given time, a user can input the symbol ^
at PC serial terminal 1. MCU1's UART0 RX interrupt will capture this termination request.
Both PC terminals will display messages, setting the initial context for the user.
- Use
SW2
on MCU1 to cycle through colors on a color wheel in a round robin fashion. - On every color change, PC serial terminal 1 should update to show:
- Once a color is selected on MCU1 and sent to MCU2 by pressing
SW1
, MCU1 enters an idle state. It awaits a color code from MCU2. - Both PC serial terminals will display updated messages to reflect this change.
- For MCU2, every LED color change should update PC serial terminal 2 to display the current color.
- After MCU2 selects its color and sends it to MCU1 via the
SW1
button, MCU2 then goes idle, awaiting a color code from MCU1.
These steps (1 to 4) are repeated continuously during the operation of Mode 2.
To exit Mode 2, sending a ^
symbol from PC serial terminal 1 to MCU1 will suffice. Remember that MCU1 UART0 RX interrupt is required to detect this termination request.
After Mode 2 concludes:
- All LEDs on both MCUs are turned off.
- The two PC serial terminals return to the main menu.