Skip to content
RED SAGSkills
easyEmbedded Systems Engineer interview question

What GPIO modes does a typical microcontroller pin support, and when would you use each?

What the interviewer wants to hear

  • Input with pull-up, pull-down or floating
  • Push-pull output for driving LEDs and logic
  • Open-drain output for shared lines like I2C
  • Alternate function to connect the pin to a peripheral
  • Analog mode for ADC/DAC and lowest power

Model answer

Most MCU pins can be digital inputs, digital outputs, alternate function or analog. As an input I choose a pull-up or pull-down so the pin never floats, for example a pull-up for a button to ground. For outputs, push-pull drives the line both high and low, which suits LEDs and chip selects, while open-drain only pulls low and needs an external pull-up, which lets several devices share a line like I2C or an interrupt line. Alternate function hands the pin to a peripheral such as UART, SPI, a timer or PWM output. Analog mode connects the pin to the ADC or DAC and disables the digital input buffer, which is also the lowest-power setting for unused pins. I also set output speed and drive strength, because fast edges cause noise and EMI.

Can you answer it under time pressure?

Take a timed easy round and get scored on every answer.

Start mock interview

More easy Embedded Systems Engineer questions