PV198 – One-chip Controllers, SPI / Dávid Danaj 1 PV198 – One-chip Controllers UART PV198 – One-chip Controllers, SPI / Dávid Danaj 2 Content 1.What is UART 2.What is it used for 3.How does it work 4.FRDM-K66F UART 5.USB to UART Bridge 6.Application § PV198 – One-chip Controllers, SPI / Dávid Danaj 3 What is UART §UART – Universal Asynchronous Receiver-Transmitter § §Serial communication § PV198 – One-chip Controllers, SPI / Dávid Danaj 4 What is it used for §Intra-board communication § §Sensors §GPS §Bluetooth §Modems § § § § § How does it work – Scheme PV198 – One-chip Controllers, SPI / Dávid Danaj 5 RX TX GND UART1 RX TX GND UART2 How does it work PV198 – One-chip Controllers, SPI / Dávid Danaj 6 §2 wires (Receive – RX, Transmit – TX) §1 to 1 communication §Works without clock signal §Requires same settings for devices (baud rate, parity, etc.) §Asynchronous §Full-duplex How does it work – Message PV198 – One-chip Controllers, SPI / Dávid Danaj 7 K66 Sub-Family Reference Manual How does it work – Message PV198 – One-chip Controllers, SPI / Dávid Danaj 8 http://www.circuitbasics.com/basics-uart-communication/ How does it work – Settings PV198 – One-chip Controllers, SPI / Dávid Danaj 9 §Baud rate (typical 9600 – 115200) §Number of data bits (8 – 9) §Number of stop bits (1 – 2) §Parity bit (disabled / odd / even) § § FRDM-K66F UART §5 UART modules §RS-485 support §Hardware flow control (RTS/CTS) §9-bit UART support §Interrupts §DMA support §TX/RX FIFO § PV198 – One-chip Controllers, SPI / Dávid Danaj 10 USB to UART Bridge §Silicon Labs – link §Might be needed to install driver § § § § 11 PV198 – One-chip Controllers, SPI / Dávid Danaj Application §Create an application that reads data from UART and sends the data back to PC §Update your code to rotate received character +2 PV198 – One-chip Controllers, SPI / Dávid Danaj 12 Application – Step-by-step guide 1.Setup pin routing (done in template) 2.Setup UART peripheral (done in template) 3.Connect “USB to UART bridge” to a board (based on pin routing) 4.When “USB to UART bridge” is connected to a PC, it appears in Device Manage in “Ports (COM & LPT)” as “COM” port. 5.Open terminal application (or Terminal view in MCUXpresso IDE) and connect to correct COM port with your UART settings PV198 – One-chip Controllers, SPI / Dávid Danaj 13 Application – Step-by-step guide PV198 – One-chip Controllers, SPI / Dávid Danaj 14 Application – Step-by-step guide PV198 – One-chip Controllers, SPI / Dávid Danaj 15 Application 2 §Open Python3 §Use import Serial §Using Serial send string to device §Check if device correctly encrypted string PV198 – One-chip Controllers, SPI / Dávid Danaj 16 Homework §On device side you will receive 3 characters §These 3 characters represent RGB values in order §Your goal is to set LED color correctly according to received values PV198 – One-chip Controllers, SPI / Dávid Danaj 17