PCBA (Printed Circuit Board Assembly) refers to the process of mounting electronic components on a printed circuit board (PCB) to form a complete electronic product.PCBA is fundamental to the electronics industry, as nearly all electronic devices are composed of PCBA. The quality and performance of PCBA directly affect the lifespan, speed, stability, and reliability of electronic products.The design and manufacturing of PCBA is a complex process that requires multiple revisions and optimizations to achieve the best results. Therefore, version management of PCBA is essential for distinguishing different design stages, tracking issues and improvements, matching software functionality with customer requirements, and more.Version management of PCBA helps developers and maintainers better control and manage the lifecycle of PCBA.There are several ways to manage PCBA versions, and this article will introduce six of them:
-
GPIO Pull-Up and Pull-Down Resistor Method
-
I2C GPIO Expansion Method
-
AD Sampling Voltage Method
-
Flash Storage Method
-
EEPROM Storage Method
-
OTP Storage Method

1. GPIO Pull-Up and Pull-Down Resistor Method

This method utilizes the CPU’s GPIO (General Purpose Input Output) pins, by connecting different pull-up and pull-down resistors, to represent different PCBA versions.
As shown in Figure 1, if there are four GPIO pins, it can represent 16 different versions, from 0000 to 1111, corresponding to V0 to V15. The CPU only needs to read the GPIO pin levels to determine the current PCBA version.

The advantages of this method are:
1. Low cost, requiring only a few resistors, which can be done for a few cents.
2. Simple implementation, as it only requires reading GPIO levels.
The disadvantages of this method are:
1. It occupies CPU’s GPIO resources; if PCB and BOM (Bill of Materials) versions need to be managed simultaneously, more GPIO pins are required.
For example, to represent 8 PCB versions and 8 BOM versions, at least 6 GPIO pins are needed, which is a waste for CPUs with limited GPIO.
2. Care must be taken in selecting resistors to avoid excessive leakage current or unstable levels.
2. I2C GPIO Expansion Method
This method uses an I2C (Inter-Integrated Circuit) expansion chip to increase the number of GPIOs for PCBA version management.As shown in Figure 2, if an 8-bit I2C expansion chip is used, it can represent 256 different versions, from 00000000 to 11111111, corresponding to V0 to V255. The CPU only needs to read the registers of the expansion chip via the I2C bus to determine the current PCBA version.
The advantages of this method are:1. It resolves the issue of insufficient GPIO resources, allowing for more PCBA versions to be represented.2. Implementation is not complex, requiring only I2C communication.The disadvantages of this method are:1. It increases hardware costs; the price of I2C expansion chips ranges from 0.5 to 2 yuan, which can be a significant expense for low-cost products.2. Care must be taken regarding the speed and stability of the I2C bus to avoid communication errors or interference.
3. AD Sampling Voltage Method
This method utilizes the CPU’s AD (Analog to Digital) pins, by connecting a voltage divider circuit to produce different voltage values, thereby representing different PCBA versions.As shown in Figure 3, if a 3.3V power supply is used, different voltage values can be generated by adjusting the resistor values of R1 and R2, such as 0.5V, 1V, 1.5V, etc. The CPU only needs to sample the AD to determine the current PCBA version.
The advantages of this method are:1. Only one AD pin is needed for PCBA version management; if the CPU has spare AD pins, only two resistors are required, making it very low-cost.2. The resistor values can be adjusted to flexibly set different voltage ranges, representing more PCBA versions.The disadvantages of this method are:1. Not every CPU has AD pins, and they are also relatively scarce resources; if the CPU lacks AD pins or they are already occupied by other functions, this method is not applicable.2. Care must be taken regarding voltage accuracy and stability to avoid errors and interference.
4. Flash Storage Method
This method utilizes a reserved segment of storage space in Flash (Flash Memory) to save PCBA version information.As shown in Figure 4, a byte of data can be written to a specific address in Flash to represent the PCBA version. The CPU only needs to read the data from Flash to determine the current PCBA version.
The advantages of this method are:1. The hardware cost is nearly zero, and it does not occupy any CPU resources; the Flash space used for version information is negligible.2. The PCBA version can be flexibly set and modified through software, without the need to modify hardware circuits.The disadvantages of this method are:1. Reliability is the biggest issue; if Flash is damaged, software upgrades erase Flash, or electromagnetic interference causes data loss, then the PCBA version information will also be lost.
2. It must be set to read-only to prevent erroneous operations.

5. EEPROM Storage Method

This method utilizes a reserved segment of storage space in EEPROM (Electrically Erasable Programmable Read-Only Memory) to save PCBA version information.
As shown in Figure 5, a byte of data can be written to a specific address in EEPROM to represent the PCBA version. The CPU only needs to read the data from EEPROM via I2C or SPI bus to determine the current PCBA version.

The advantages of this method are:
1. The hardware cost is relatively low; EEPROM prices range from 0.1 to 0.5 yuan, and it does not occupy too many CPU resources, requiring only an I2C or SPI bus.
2. The PCBA version can be flexibly set and modified through software without the need to modify hardware circuits.
3. Reliability is relatively high; EEPROM data can be erased and rewritten multiple times, is less likely to be lost, and is not affected by electromagnetic interference.
The disadvantages of this method are:
1. Care must be taken regarding the write cycles of EEPROM to avoid exceeding its lifespan and causing data corruption.
2. Attention must be paid to the speed and stability of EEPROM to avoid communication errors or interference.
6. OTP Storage Method
This method utilizes an OTP (One Time Programmable) chip to save PCBA version information.As shown in Figure 6, a byte of data can be written to a specific address in the OTP chip to represent the PCBA version. The CPU only needs to read the information from the OTP chip via I2C or SPI bus.
The advantages of this method are:1. Low hardware cost; the price of OTP chips ranges from 0.01 to 0.1 yuan, and it does not occupy too many CPU resources, requiring only an I2C or SPI bus.2. The highest reliability; data in OTP chips can only be written once and will not be lost, and are not affected by electromagnetic interference.The disadvantages of this method are:1. Inflexibility; once data is written to the OTP chip, it cannot be modified. If the PCBA version changes, the OTP chip needs to be replaced or another method must be used to indicate the new version.
2. Care must be taken regarding the speed and stability of the OTP chip to avoid communication errors or interference.

Conclusion
This article introduced six methods for identifying PCBA hardware versions via software: GPIO pull-up and pull-down resistor method, I2C GPIO expansion method, AD sampling voltage method, Flash storage method, EEPROM storage method, and OTP storage method.Each of these methods has its advantages and disadvantages, and designers should choose the appropriate method based on their product characteristics and requirements. Generally speaking, if GPIO pins are sufficient, the GPIO pull-up and pull-down resistor method is recommended; if the CPU has spare AD pins, the AD sampling voltage method is recommended; if both GPIO and AD are insufficient, consider using the I2C GPIO expansion method or EEPROM storage method; finally, consider the Flash storage method or OTP storage method.Identifying PCBA hardware versions via software can help developers and maintainers better control and manage the lifecycle of PCBA.How about it? Did everyone understand? If you have any original technical articles related to electronic design or others, feel free to submit them to us, and we will select the best ones for publication, and you will receive a reward for your article!
Friendly Reminder:
Due to recent changes in WeChat public platform push rules, many readers have reported not seeing updated articles in time. According to the latest rules, it is recommended to frequently click on “Recommended Reading, Share, Collect,” etc., to become a regular reader.
Recommended Reading:
-
Xiaomi Car, It’s Getting Serious!
-
Unexpectedly, the Kirin 9000s Comes from This Mysterious Park!!
-
Communication Giant Exposed Layoffs: Cutting the Entire Guangzhou R&D Team!
Please hit 【Read】 to give the editor a leg up!
