### 5. PS UART

We have been using the PS, but not PS peripherals via MIOs yet! This demonstrates PS UART, as well as how to use the Xilinx embeddedsw library. 

In `uart.py`, a Vivado configurator-like text array is used to disable/enable desired peripherals. We enabled the UART and SD Card (unused here) by setting `_` to `1` in the array. 115200 is the default baud rate. 

In Vivado, maximum UART baud is 921600. Want higher? Just set `'baud':3000000` in the configuration. 3M or 8M baud would just work, the FT2232 USB-UART can also handle that. 


```
# Run GenZ
$ export PYTHONPATH=../..
$ ./uart.py
# Prepare BSP folder for PYNQ-Z1
$ git clone https://github.com/regymm/embeddedsw --depth=1
$ cp -a embeddedsw/lib/sw_apps/zynq_fsbl/misc/{muzy4,pynqz1}
# Copy the BSP files generated by GenZ
$ cp ps7_init_uart/* embeddedsw/lib/sw_apps/zynq_fsbl/misc/pynqz1
# Compile elf with Xilinx open source embeddedsw library
$ make BOARD=pynqz1 -C embeddedsw/lib/sw_apps/hello_world/src
# Launch the compiled hello world ELF on hardware, no bitstream needed
$ source /opt/Xilinx/Vivado/2019.1/settings64.sh
$ ../../xsct_tools/run_elf_7030.tcl ps7_init_uart/ps7_init.tcl x embeddedsw/lib/sw_apps/hello_world/src/hello-world.elf

# These texts will be printed in ttyUSB1: 
Hello World
Successfully ran Hello World application
```

>  For even higher bauds, UG585 page ~619 has information about how UART clocks and divisors work. 

> When using EMIO UART, there's no need to set the parameter array, but an entry like `'uart1': {'baud':115200}` is required. 
