Which statement correctly compares the maximum data transfer speeds of SPI and UART?
Think about clocked vs asynchronous communication.
SPI uses a clock signal which allows it to transfer data faster than UART, which is asynchronous.
Given the UART configuration below, what is the total number of bits transmitted per data frame (including start, data, parity, and stop bits)?
/* UART config: 1 start bit, 8 data bits, no parity, 1 stop bit */
// Calculate total bits per frameCount all bits including start and stop bits.
UART frame includes 1 start bit + 8 data bits + 0 parity bits + 1 stop bit = 10 bits total.
Consider this SPI master code snippet controlling two devices. What will be the output on the chip select (CS) pins if the master communicates with device 2?
/* SPI Master controls two devices: CS1 = GPIO pin for device 1 CS2 = GPIO pin for device 2 */ void select_device(int device) { if (device == 1) { CS1 = 0; // active low CS2 = 1; } else if (device == 2) { CS1 = 1; CS2 = 0; } } select_device(2);
Remember chip select is active low.
To select device 2, CS2 is set low (0) and CS1 is set high (1) to deselect device 1.
Which statement best describes the full duplex communication capability of UART and SPI?
Consider how data lines are used in each protocol.
SPI uses separate lines for sending and receiving data, enabling full duplex. UART uses separate lines for transmit and receive and can support full duplex, but it is asynchronous. However, in many implementations UART is considered half duplex due to practical constraints.
Given a UART configured for 9600 baud with a clock frequency of 16 MHz, what is the approximate baud rate error percentage if the UART baud rate register is set to 103?
/* Baud rate = Clock / (16 * (UBRR + 1)) Clock = 16,000,000 Hz UBRR = 103 */ // Calculate actual baud rate and error percentage
Calculate actual baud rate then compare to 9600.
Actual baud rate = 16,000,000 / (16 * (103 + 1)) = 16,000,000 / 1664 ≈ 9615 baud. Error = (9615 - 9600) / 9600 * 100% ≈ 0.156%, closest to 0.06% option.