What software engineers should be aware of when programming hardware
Learning hardware programming as a software engineer
First of all, it is important to understand pinout (arrangement) in order to understand hardware programming. Similar boards often have the same pinout, but the pinout itself may not contain the information needed for programming, for example, if some of the pins are restricted, and the actual board model number It is also important to check the board platform and firmware pin definitions from.
Once you know the pinouts, you need to figure out which pins play what role and what to use. The most basic pins are called digital pins and are responsible for transmitting on / off information such as whether a button is pressed.
However, if you need more control, you must use analog pins. The signal output from the analog pin is converted from an analog signal to a digital signal using a converter called an ADC and read, but the accuracy of the conversion varies depending on the resolution of the device. For example, ESP32 has a resolution of 12 bits, so it can only represent digital signals up to 4096 levels. Since analog signals are converted to digital signals, it is not possible to output a true and accurate signal, but analog signals can be expressed using a technique called PWM that changes the time width of the ON state. You. Analog pins are used to get accurate data from the sensor or to dimm the LEDs.
In addition to digital and analog pins, there are communication pins that allow devices to communicate. The communication pins have several interfaces such as UART for direct communication, I2C for internal communication on board, SPI and 1-Wire for communication between devices.
If you do not care whether it is a pin used by the device itself or a pin that controls the device, it may lead to unexpected operation. There is no problem if the built-in LED flashes by mistake, but the on-board flash memory may be broken. In the case of ESP32, there are also touch pins that can detect whether a person is touching, and DACs that can output analog signals by controlling the voltage.
With software, it is possible to easily replace a part of the program with a new one, but it is not always easy with hardware. It states that the entire device must be assembled from scratch, while at the same time checking for device compatibility and possible failures. Tools and breadboards like EasyEDA can be used to investigate and test compatibility and failure issues. Also, if you use the text editor Visual Studio Code or PlatformIO provided as an extension of Atom , you can execute tests on the local machine as well as connected devices and upload programs to the device. I can do it.
A new generation ecosystem for embedded development
Software problems rarely start burning your PC, but hardware mistakes such as using the wrong pins or switching relays at the wrong time can cause serious damage. To prevent this damage, carefully design, fuse expensive or critical parts to prevent overvoltage failure, and prepare sockets for fragile parts to save soldering time. Vrampe says it's important to do that.