How to identify and use Microcontrollers’ pins¶
All microcontrollers have multiple pins and each pin is assigned for some specific task. It is therefore very important to know the pin configuration of each microcontroller before using it. Some of the common features of microcontroller pins are as follows.
- A Digital Input to receive digital values externally;
- A Digital Output is to send a digital signal to other devices;
- An Analog to Digital Converter (ADC) converts the continuous physical quantity (usually voltage) to digital numbers that represents the quantity amplitude;
- A Digital to Analog Converter (DAC) converts the digital data to analog signal;
- Input / Output pins helps in communicating with external devices using I2C, UART, SPI, SDIO protocols;
- Other types of microcontroller.
In order to set each pin’s function, user must set the functionality in the software by setting value in registers (it is similar to setting the functions in machine but machine has buttons or switches, but microcontroller has no button or switch, so we must set them by the software directly into the memory). It is the manufacturer who decides which pin is allowed to do what function(s). Although this document explain how to look pin function of microcontroller of type STM32F4, this technique can be applied to other types of microcontroller as well. Some basic things to note in a microcontroller are:
- Consider the board use: which type of microcontroller. (Which brand, which number?);
- Which package that microcontroller used. (How many pins, which body type?);
- How many pins of that package and its functions. (What is the function of each pin?).
Figure 1‑1: How to analyze pins of microcontroller?
It can be observed that datasheet plays a fundamental role in finding information about the pins. In advanced microcontrollers, user might need to consult more than one relevant document together to extract the correct information.
Figure 1‑2: To check microcontroller belongs to which family
Figure 1‑3: To see which model of microcontroller STM32F407VG and with how many pins
Figure 1‑4: MCU STM32F407VG pins functionality
Figure 1‑5: To see which pin is 29 on the board
- STM32F4DISCOVERY Discovery kit for STM32F407/417 line Data brief http://www.st.com/st-web-ui/static/active/en/resource/technical/document/data_brief/DM00037955.pdf
- STM32F4DISCOVERYDatasheet http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00037051.pdf