Programming UART ports

Description

Superior Embedded Systems Mind Map on Programming UART ports, created by Artur Assis on 13/06/2022.
Artur Assis
Mind Map by Artur Assis, updated more than 1 year ago
Artur Assis
Created by Artur Assis about 3 years ago
2
0
1 2 3 4 5 (0)

Resource summary

Programming UART ports
  1. Review Questions
    1. Answers
    2. Definition: UART serial port registers of Freescale ARM KL25Z are configured in order to transmit and receive data serially.
      1. Freescale ARM chips come with up to 3 on chip UART ports (UART0 - UART2).
        1. UART0
          1. Ex. In the Freescale FRDM, UART0 port is connected to the OpenSDA (Open Serial Debug Adaptor), which is connected to a USB connector.
            1. When the USB cable connects the PC to the FRDM board, the device driver at the host PC establishes a virtual connection between the PC (as COM port) and the UART0 of the KL25Z device (as UART0).
            2. Baud clock and oversampling
              1. How is it calculated?
                1. Formula
                  1. SBR is the concatenation UART0_BDH:UART0_BDL (13 bits).
                    1. OSR (oversampling rate) is the D4-D0 of UART0_C4.
                      1. OBS: if OSR < 7, BOTHEDGE of UART0_C5 must be set.
                    2. Solved Examples
                    3. Related registers
                      1. SIM_SOPT2 register
                        1. Register used to configure the source of the Baud rate generator clock for UART0. It selects from the output of FLL, PLL, the external oscillator, or the internal oscillator.
                        2. UARTx_BDH and UARTx_BDL
                          1. UARTx_C4
                          2. Bald rate error
                          3. Control and Status Unit
                            1. Registers
                              1. UARTx_C1
                                1. 8-bit register that is used to select the data frame size (choose bit M for 8-bit or 9-bit frame size), if there will be parity bit, and what the type of parity bit is, among other functions.
                                2. UARTx_C2
                                  1. 8-bit register used to configure if transmit (TE)/receive (RE) is enabled or not, and the rest of the bits are used for interrupt driven serial communication.
                                  2. UARTx_S1
                                    1. It is the most important UART status register. It monitors the arrival of data among other things. We monitor (poll) TC flag that all the bits of last byte are transmitted. We monitor (poll) the RDRF flag to see if a byte of data is received. The TDRE flag indicates that the data register is empty and ready to accept another byte.
                                3. Receive/Transmit unit
                                  1. Register
                                    1. USART_D
                                      1. It is the USART Data Register, where data is stored before transmitting and after receiving.
                                        1. Advanced: There are actually 2 separate registers with the same address and the same name, for transmitting and receiving data. Writing to the memory address leads to write to the transmit register and reading from the memory address return the received data.
                                    2. Enabling clock
                                      1. To enable clock for peripheral UART0, set the bit D10 of register SIM_SCGC4
                                      2. I/O pins used for UART
                                        1. It is necessary to set up I/O pins for the alternate functions of TxD and RxD signals
                                  2. OpenSDA
                                    1. Main functions:
                                      1. 1. Programming (downloading) using OpenSDA Programming software;
                                        1. 2. Debugging using JTAG;
                                          1. 3. Use as a virtual COM port;
                                    2. UARTx
                                      1. Groups of registers in UART peripherals
                                        1. Configuration Registers
                                          1. Must be initialized before using the UART peripheral. This set some parameters for communication including: baud rate, word length, stop bit, serial interrupts (if needed).
                                            1. UARTx_BDH (Baud Rate High)
                                              1. UARTx_BDL (Baud Rate Low)
                                                1. UARTx_C1 (control 1)
                                                  1. UARTx_C2 (control 2)
                                            2. Transmit and receive register
                                              1. To send data, we simply write to the transmit register (UART_D). The received data is stored in the receive register (UART_D). The data is transmitted through serial transmit pin (UARTx_TX) and received through serial receive pin (UARTx_RX).
                                                1. UART_D (transmit/receive register)
                                                2. Status Register
                                                  1. Contains flags that show the state of sending and receiving data, including: existence of new received data, error in received data, sending unit ready for new data, etc.
                                                    1. UARTx_S1 (status register)
                                                  2. Clock
                                                    1. Transmitter
                                                      1. Operates on the clock that runs at the BAUD RATE.
                                                        1. 1 clock, 1 bit transmitted
                                                      2. Receiver
                                                        1. Detects the falling edge of the starting bit
                                                          1. Oversampling
                                                            1. Runs in a faster clock than baud rate.
                                                    2. Useful steps for LAB
                                                      1. Transmitting data
                                                        1. Receiving Data
                                                        Show full summary Hide full summary

                                                        0 comments

                                                        There are no comments, be the first and leave one below:

                                                        Similar

                                                        Italian: Basics
                                                        Selam H
                                                        01 Long Term causes of the French Revolution
                                                        Holly Lovering
                                                        IB Economics: International Trade
                                                        Han Zhang
                                                        Command Words
                                                        Mr Mckinlay
                                                        SAT Sample Essay - Failure/ Success
                                                        nedtuohy
                                                        STEM AND LEAF DIAGRAMS
                                                        Elliot O'Leary
                                                        Psychology flashcards memory
                                                        eharveyhudl
                                                        chemistry: c2
                                                        kristy baker
                                                        el centro comercial
                                                        Pamela Dentler
                                                        Specific topic 7.5 Timber (Stock forms)
                                                        T Andrews