Docsity

Computer engineering Fall 26 midterm practice problems, Study Guides, Projects, Research of Computer Engineering and Programming

Toggle sidebar
bg1
CPEG222 FALL 2026 MIDTERM PRACTICE PROBLEMS
These problems are for practice only and are not graded. They may be in a style similar to the midterm
but are not guaranteed to be the same questions.
I. Acronyms
Write out the acronym.
ADC
DMA
I2S
LSE
RISC
CPU
CMSIS
AF
DRAM
IDE
MCU
RTOS
HSI
HSE
AHB
EEPROM
IMU
NVIC
SPI
LED
IVT
APB
FPU
IR
PLL
SRAM
RCC
PWM
CAN
GPIO
ISA
PROM
SSD
USB
USART
CISC
HAL
ISR
PSRAM
UART
DAC
I2C
II. Short Answer
What is the port and pin of the USER button?
What is the port and pin of the blue LED (LD2)?
What is the number of discrete output levels of a 12-bit ADC?
What GPIO register sets or resets output pins in a single write?
What GPIO register holds the current state of the input pins?
What RCC register enables the clocks for the GPIO ports?
How many bits are needed in the GPIOx_MODER to configure one pin?
What interrupt handler is shared by EXTI lines 5 through 9?
III. Bit Manipulation
Perform the operation(s) and answer in hexadecimal (32-bit hex answer).
1. 0xFFFF 0000 & 0x1234 5678 = 0x__________________________
2. 0xFFFF FFFF & ~(0x0000 0F00) = 0x__________________________
3. 0x0000 00C0 >> 1 = 0x__________________________
4. (0x1 << 8) | (0x2 << 12) = 0x__________________________
5. (0x0000 00FF & ~(0x3 << 2)) | (0x1 << 2) = 0x__________________________
IV. Code Reading
Describe in one sentence what each line does on the Nucleo-144 board.
1. RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN;
2. GPIOB->BSRR = (1 << 7);
3. TIM2->CR1 |= TIM_CR1_CEN;
4. GPIOB->ODR ^= (1 << 0);
5. if (GPIOC->IDR & (1 << 13)) { ... }
CPEG222 Fall 2026 Midterm Practice Page 1
pf2

Partial preview of the text

Download Computer engineering Fall 26 midterm practice problems and more Study Guides, Projects, Research Computer Engineering and Programming in PDF only on Docsity!

CPEG222 FALL 2026 MIDTERM PRACTICE PROBLEMS

These problems are for practice only and are not graded. They may be in a style similar to the midterm but are not guaranteed to be the same questions.

I. Acronyms

Write out the acronym.

ADC DMA I2S LSE RISC CPU CMSIS

AF DRAM IDE MCU RTOS HSI HSE

AHB EEPROM IMU NVIC SPI LED IVT

APB FPU IR PLL SRAM RCC PWM

CAN GPIO ISA PROM SSD USB USART

CISC HAL ISR PSRAM UART DAC I2C

II. Short Answer

What is the port and pin of the USER button? What is the port and pin of the blue LED (LD2)? What is the number of discrete output levels of a 12-bit ADC? What GPIO register sets or resets output pins in a single write? What GPIO register holds the current state of the input pins? What RCC register enables the clocks for the GPIO ports? How many bits are needed in the GPIOx_MODER to configure one pin?

What interrupt handler is shared by EXTI lines 5 through 9?

III. Bit Manipulation

Perform the operation(s) and answer in hexadecimal (32-bit hex answer).

  1. 0xFFFF 0000 & 0x1234 5678 = 0x__________________________
  2. 0xFFFF FFFF & ~(0x0000 0F00) = 0x__________________________
  3. 0x0000 00C0 >> 1 = 0x__________________________
  4. (0x1 << 8) | (0x2 << 12) = 0x__________________________
  5. (0x0000 00FF & ~(0x3 << 2)) | (0x1 << 2) = 0x__________________________

IV. Code Reading

Describe in one sentence what each line does on the Nucleo-144 board.

  1. RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN;
  2. GPIOB->BSRR = (1 << 7);
  3. TIM2->CR1 |= TIM_CR1_CEN;
  4. GPIOB->ODR ^= (1 << 0);
  5. if (GPIOC->IDR & (1 << 13)) { ... }

CPEG222 Fall 2026 Midterm Practice Page 1

V. GPIOx_MODER Register

Reset value: 0xA800 0000 for port A, 0x0000 0280 for port B, 0x0000 0000 for other ports

Bits 2y:2y+1 MODERy[1:0]: Port x configuration bits (y = 0..15). These bits are written by software to configure the I/O direction mode.

00: Input (reset state) 01: General-purpose output mode 10: Alternate function mode 11: Analog mode

  1. To set all of port C to analog, you would use GPIOC->MODER = 0x__________ (32-bit hex)

2.To set PB0 and PB7 to output, you would use GPIOB->MODER |= 0x__________ (32-bit hex)

  1. To clear the mode bits for PB14, you would use GPIOB->MODER &= ~(0x__________)(32-bit hex)
  2. To set PC6 to alternate function, you would use GPIOC->MODER |= 0x__________ (32-bit hex)

VI. Timer Configuration

  1. Assume a 16 MHz timer clock. You need TIM4 (a 16-bit timer) to generate an update event every 2 ms. a) What value do you write to TIM4->PSC so the counter ticks every 1 μs? b) Using the PSC from (a), what value do you write to TIM4->ARR for a 2 ms period?
  2. Assume a 16 MHz timer clock. TIM2 is a 32-bit timer. a) Can TIM2 generate an update event every 500 ms with PSC = 0? Explain. b) If so, what value do you write to TIM2->ARR?
  3. Assume a 16 MHz system clock. SysTick is a 24-bit down-counter with no prescaler. a) What value do you write to SysTick->LOAD to generate an interrupt every 1 ms? b) What is the longest interrupt period SysTick can produce from a single reload? c) You need an LED to toggle every 2 seconds. Explain why SysTick can't do this with one reload, and how you would do it instead.

CPEG222 Fall 2026 Midterm Practice Page 2