UART Cross Connect Polling
Overview
The purpose of the project is to transfer one byte of data from UART 1 to UART 4 and to transfer a different
byte in the opposite direction. Your code must confirm that the received byte matches the transmitted byte.
This project cross connects UARTs 1 and 4 using the wiring diagram shown on slide 10 (the bottom diagram) in
Chapter 22 UART. Using 2 jumper cables connect the 4 pins as shown in
that diagram. For sample code refer to the three scanned pages (534, 535, and 536) from the textbook in myCourses.
Setup
Use the sample code. Create a new project or warm over an existing project. Be sure to include the
startup_stm32l476xx.s file that we have used in every project so far.
U1-4 Template zip file
Requirements
When testing this I strongly recommend that you become proficient in using the Keil debug. I would set a breakpoint
at the beginning of the code I want to test and then single step through it to see that the values are correct.
- Your code must do the following:
- Initialize the GPIO pins and the two UARTs. Refer to the sample code in the PDFs or the textbook.
- Send a byte from UART1 by loading 0x5A into the its transmit register.
- Wait for that transmit operation to complete by checking the corresponding transmit status bit.
- Now wait for the UART4 receive status register to indicate that a byte was received
or for a time-out.
- For the time-out you can use either a system timer (SysTick) or a counter that causes the code
to exit the wait on status bit. Your time-out should be about 0.5 seconds.
- Test1: Read the received byte and confirm that the value is 0x5A.
- Test2: Now send the value 0x35 from UART4 to UART1 using the same approach but the opposite UARTs (of course).
- If Test1 fails light the Red LED.
- If Test2 fails light the Red LED.
- If both pass light the Green LED.
- Be sure to exactly follow the instructions in the uart_crosspolling.c file!
- Add a feature to use a joystick button to cause you to re-run these two tests and update the LEDs.
- TIP: The LED and joystick demo
has joystick code that you can copy.
References
Rubric and Late Policy
Rubric is defined in the demo sheet
Submission
- Submit only uart_crosspolling.c to the UART Cross Connect Polling dropbox
- In class demo of your code is required with a CA or the instructor.
- Do not change any other files!