How to start with Microcontrollers?
Table of Contents
What is Microcontroller?
Microcontroller is a kind of an integrated circuit, which is used in the development of every electronic device around us. From avionics industry for the development of spacecrafts, missiles, rockets, satellites, to the car industry for the development of automotive cars, luxury cars, Electric vehicles, sports bikes not only this but even in medical industry for development of medical equipment’s like ECG’s, vaccine’s, optical equipment’s and even in music and entertainment industry for the development of speakers, mikes, audio amplifiers, stage lights to shooting camera. Also, microcontrollers you find around in our day-to-day life (white goods) in devices like Refrigerators, Ovens, Electric tandoor, grinders, hair dryers, Fans, AC’s etc. Even in consumer electronics televisions, mobile phones, tabs, smart watches, projectors, printers these are also developed with the help of microcontrollers.
Not only this but even in heavy machines like cranes, JSB, construction vehicles, metros, railways there is need of microcontrollers for their development.
So, you see, if you literally take any electronic/electrical gadget device around you there would be a microcontroller in it in one way or another, from food technology to medical technology to smart homes to smart cities to aircrafts, ships, boats, yachts to electronic meters and list will never end.
Thus, the need of microcontrollers and its knowledge is growing from day by day, as for the development of any embedded device of any kind of industry, there would be a need for microcontrollers.
How do microcontrollers accomplish that?
Microcontroller is an innovative technology that has revolutionize the world and made the electronic items so much feasible for us. Though microcontrollers have been in world since 1960’s. But there are many new inventions and development still going on this field. Well microcontroller is just like a human being.
Just like human beings can do any kind of work same way microcontrollers can be used in any kind of industry to make any kind of gadget.
Analogy of Microcontrollers!
Just like human beings have brain where processing of all data is done microcontrollers have CPU. In the CPU(Central Processing unit), all the processing of data, speed of execution is done. Thus CPU’s are the brain of the microcontrollers. Often the word CPU is used interchangeably with processor/core.
Just like human beings use some form of language to communicate with outside world like English, Spanish, Hindi and etc. Same way microcontrollers use different communication protocols (UART, I2C, SPI, CAN, LIN, cryptography, I2S, CSI 1-wire, and many other) and digital/analog signals(GPIO, PWM, ADC, DAC, TIMERS) to communicate with the outside world.
Just like human beings have different body parts to interact with outside world, microcontrollers have different peripherals which are used to interact with outside world. For each Communication Protocol and digital/analog signals that are stated above there is some corresponding peripheral in microcontrollers.
Just like in human being’s brain sends signals to body parts, same way in microcontroller for using peripherals some configurations and programming has to be done to use them, this is called peripheral coding/drivers. That would be explaining in below sections.
Now some sensors and modules are connected to Microcontrollers as an intermediate between the outside world and microcontrollers. And these sensors and modules communicate with specified communication protocols.
- Just like we human beings have memories of our life, past and things to do, according to which we act and do our daily work. Exactly same way microcontrollers too have memories, difference is just this memory is programmable. According to the program written on these microcontrollers they work. So, it’s like programming the human beings (with Smily emoji). That would be explaining in below sections.
Connecting the analogy of microcontrollers!
Microcontrollers are connected to different sensors and modules according to the industry in which they are being used. Microcontrollers communicate with these sensors and modules by some communication protocol via the peripherals of the MCU. Sensor and modules act as an intermediate between the microcontrollers and world, to get information from the outside world that is input to the microcontrollers(input). Then this data is processed and analyzed by the CPU (brain of MCU), where all these calculations, processing, operations are done. And then information is sent from the microcontrollers(output) to corresponding sensors and modules to show results or control the outside world. And That’s how microcontrollers can be used to make any electronic gadget of any Industry.
Practical usecases of microcontrollers
Having the understanding of communication protocols and peripherals of the microcontrollers one can make electronic gadgets for number of industries.
- Wearable Technology: Microcontrollers are used for development of smart watches. Microcontroller is connected with different sensor/modules like RTC3231 for time monitoring, heart rate sensor, oxygen sensor for checking body vitals, screen display, Wi-Fi/ BLE module for connectivity, 3-D accelerometer sensor for step counting(pedometer). Now these devices communicate with microcontroller via some communication protocol via the peripheral of the MCU.
- Time monitoring(RTC3231) communicates via I2C protocol, so it is connected to MCU via I2C peripheral.
- Heart Rate sensor (SEN-11574/AD8232) communicates via analog signal, so it is connected to MCU via ADC peripheral.
- oxygen sensor (MAX30100) communicates via I2C protocol, so it is connected to MCU via I2C peripherals.
- OLED screen display(SSD1306) communicates via SPI protocol, so it is connected to MCU via SPI peripheral.
- Wifi/BLE module communicates via UART protocol, so it is connected to MCU via UART peripheral.
- 3-D accelerometer (LSM303D) communicates via I2C protocol, so it is connected to MCU via I2C peripheral.
- Industrial Automation (Smart Energy meter): Microcontrollers are used in development of Smart energy meters. Microcontroller is connected to sensor/module like HLW8012 for AC Power measurement, INA219 for DC Power measurement, Wifi/BLE module for IoT connectivity, RS232 industrial communication support, SD-Card for data recording/storage. Now these devices communicate with microcontroller via some communication protocol via the peripheral of the MCU. Like
- AC Power measurement sensor (HLW8012) communicates via Digital PWM signals, so it is connected to MCU via Timer peripheral.
- DC Power measurement sensor(INA219) communicates via I2C protocol, so it is connected to MCU via I2C peripheral.
- Data Recording/Storage( SD card module, W25Q flash memory) communicates via SPI protocol, so it is connected to MCU via SPI peripheral.
- OLED screen display(SSD1306) communicates via SPI protocol, so it is connected to MCU via SPI peripheral.
- Wi-Fi/BLE module communicates via UART protocol, so it is connected to MCU via UART peripheral.
- RS232 is done using UART protocol, so it is connected via UART peripheral.
- Automotive: use of microcontrollers in automotive industry is immense now days. hundreds of MCU are used in a car. To give idea of one such example is electric immoblizer. To explain in simple way. Electric immoblizer is an electronic device used in automotive. It switches on the engine of car, only if electronic authenticated key is used to on the car. For this functionality, RFID tags are used in car keys. So electric immobilizer has broadly 2 sensor/modules. One RFID module like MFRC522 and a high voltage relay/optocoupler to on the engine of car via MCU. Now these devices communicate with microcontroller via some communication protocol via the peripheral of the MCU. Like
- RFID module (MFRC522) communicates via SPI protocol, so it is connected to MCU via SPI peripheral.
- Relay/Optocoupler communicates via digital On/OFF signals, so it is connected to MCU via GPIO peripheral.
- Avionics: Drones are small aerial bots that are extensively used now days in avionics industry. For the development of Drones there is use of Microcontrollers. Microcontroller is connected to sensor/Module like accelerometer sensors(ADXL345) for axis control of drone, barometric sensor((BMP280) for pressure & altitude measurement, Time of flight sensor(VL53L0X) used for distance mapping and 3D imaging technology, Camera sensor(IMX214) for capturing images and videos, Temperature sensor(DHT11) for monitoring temperature variations as drone flight high, GPS module(NEO-^m) for Drone tracking and GPS coordinates, RF transceiver chips(HM10) for Controlling drone via remote. Now these devices communicate with microcontroller via some communication protocol via the peripheral of the MCU. Like
- Accelerometer (ADXL345) accelerometer sensor can communicate via I2C and SPI protocol, so it is connected to MCU via either one peripheral (I2C or SPI).
- Barometric sensor (BMP280) communicates via I2C peripheral, so it is connected to MCU via I2C peripheral.
- Camera sensor (IMX214) communicates via CSI protocol, so it is connected to MCU via CSI peripheral.
- Temperature sensor (DHT11) communicates via one-wire digital protocol, so it is connected to Timer peripheral.
- GPS module (Neo 6M) communicates via UART protocol, so it is connected to UART peripheral.
- RF transceiver chips (HM10) communicates via SPI protocol, so it is connected via SPI peripheral.
t
Microcontroller Vendors/Semiconductor Companies
Microcontrollers are designed and developed by the Semiconductor Companies. These Companies designs the microcontrollers for different industries (listed above), where these microcontrollers are used for product development.
Semiconductor industry is multi-billion-dollar industry, companies are as big as google, amazon & Microsoft (some are even larger than that).
Name of Semiconductor companies:
- NXP Semiconductors
- Renesas Semiconductors
- STMicroelectronics
- Texas Instruments
- Nordic Semiconductors
- Silicon Labs
- Marvel Semiconductors
- Microchip
- Intel
- QUALCOMM
- AMD Semiconductors
- ARM Processor
- Nvidia
- Analog Devices
Semiconductor companies not only designs and develop the microcontrollers but instead many other electronic/integrated chips (ASICS, memory chips, sensor chips, IoT chips, discreate electronics, development boards and etc.)Apart from just electronic chips, these companies develop the Software packages, Software Tools, Software Applications (ML, AI based), Hardware tools and also do Core RnD on the next upcoming technologies in the fields like of Automotive, IoT, Avionics, Industrial Automation and list will never end.
Designing of microcontrollers is done via VLSI/VHDL technology and then programming on those microcontrollers to build the applications is done via Embedded Software/Firmware Develpment.
To give a practical use case, you guys must have heard of Arduino. Well Arduino is a development, in which there is microcontroller Atmega 328. This microcontroller is designed and developed by Microchop technologies semiconductor company. Another is NodeMCU, which is also a development board, which has ESP8266 IoT MCU which is designed and developed by Espriff Systems. Most of the hobbyist and students are aware of only these 2 controllers, but there are number of other microcontrollers which are designed and developed. Like STM32 Blue Pill, is a development board which has STM32F103 MCU is ARM Core Based Microcontroller developed and designed by STMicroelectronics. Another is Teensy development boards which has I.MX1062 microcontrollers designed and developed by NXP semiconductors.
At the gettobyte, you are going to find content and tutorial series on different microcontrollers of different vendors. explaining how to use those Industrial microcontroller and tutorials on how to use the peripherals of Industrial microcontrollers to come out of Arduino environment. And get industry ready skills and knowledge in microcontroller field’s
Categories in Microcontrollers
Now like there are categorization in human beings in terms of color, features, gender kind of same way there are categorization in microcontroller in terms of:
- Which CPU architecture and CPU core is used (RISC-V, ARM, CISC, Power architecture, 8-bit architectures), every CPU architecture has some features and specs. Every human has unique brain and only 1 bran, but different microcontrollers can have same CPU core.
- Bit size of microcontroller (8/16/32 bit Microcontrollers), it’s kind of like amount of data that microcontroller can process. 32 bit can process more data and 8 bit would process less data.
- Then depending on peripherals support microcontroller has, more peripheral support it has a greater number of applications can be built from it by connecting different sensors/modules to it.
- Microcontroller’s has memory , as in the end we have to write some program to control the microcontroller, that program is written inside the microcontroller memory. So, amount of memory microcontrollers has (Flash Memory, RAM, SRAM and etc.), depending on that too there is categorizations in microcontroller.
- Support of Software Development Kit and Hardware Development kit for the corresponding microcontroller.
Chronology to start with microcontrollers
Okay, so lot has been talked about Microcontrollers. Now how to get started with it and in what chronology. Well Microcontroller technology is very vast and has many exciting/interesting topics. Best way to start learning about microcontrollers is by doing Embedded Software/Firmware Development.
From the Embedded Software/Firmware developer, below defined is the best way to start with the microcontrollers:
- First is take any MCU of any specific vendor (let’s say NXP Semiconductors S32K144 MCU) and then get its development board and debugger/programmer of that MCU. You can get development board and hardware debugger of many different MCU’s from gettobyte website.
For NXP S32K144 MCU, buy this breadboard compatible eval board, it can be programmed via externa JTAG debugger. Get to know about Pinout and pins description of the MCU.
- And then setup is its SDK. So understand what Software Development Kit is, why is it needed. Software Development Kit comprises of IDE, code configuration tools, peripheral drivers and software debugging tools.
For NXP S32K144 MCU, Install the S32 Design Studio IDE, Freemaster debugging tool and software package of S32K1 for peripheral drivers(Real Time Drivers). Viewers can refer to S32 DS IDE getting starting blog, for getting to know
- After that understand the microcontroller architecture, the processor architecture of the MCU. Different kind of interrupts and faults in the MCU.
Reading the S32K144 Reference manual and Datasheet. First 2-3 chapters of both the docs and try to understand terminologies, keywords which are written, features and specs of S32K144.Then S32K144 MCU has ARM Cortex M4 architecture, so understanding, about ARM architecture and various components in it from its technical reference manual. Refer to this blog for S32K144 MCU understanding
- After that, understanding the basic peripherals and communication protocols of the MCU so that one can get to know how application build around MCU. Theoretical understanding of the communication protocol, digital/analog signals and then relating how is that theory being implemented in MCU by understating the peripheral drivers of that MCU. Every MCU vendor provide the peripheral driver for the corresponding MCU by the name of different names: Real Time drivers, Device drivers and etc.
NXP S32K144 MCU has number of peripheral. NXP does provide peripheral drivers for the peripheral of the S32K144 MCU by the name of Real Time Drivers. I have written well formatted blogs on all the peripherals of s32K144 MCU by explaining the demo example of peripheral drivers, features of corresponding peripheral in MCU. Refer from here. At gettobyte you can find peripheral driver tutorial on number of Industrial controllers.
- Now connect different sensors & modules to corresponding peripheral and make the sensor/module run via microcontroller. In this we need to understand at first the working principal of that sensor/module and then understand from its datasheet about how to control that sensor/module via microcontroller so as to run it and then writing its device driver. Device driver is a program written to interface difference sensor/module with microcontroller.
Connect different type of sensor and modules to MCU. At gettobyte their are proper tutorial series on how to connect sensor/module with any MCU. Have connected number of different sensor/module to NXP S32K144 MCU. Refer to sensor and module section to start.
Different Components in the microcontroller
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.
Now best way to understand about the microcontrollers is to have the analogy of Microcontroller like a human body. Microcontrollers are kind of a man-made human beings which are created by humans to ease their work and do things in fast and efficient way.
Like our body has various body parts, through which we interact with the outside world. Same way-out Microcontrollers have Hardware IPs called as peripherals, through which they can interact with outside world.
In our body there are body parts like: legs, hands, nose, eyes, ears, fingers, arms and etc. In microcontroller there are peripherals like: GPIO, UART, I2C, SPI, TIMERS, ADC, Clock, Sleep modes, RTC, CAN, LIN and many other.
Each body part has certain specifications, features, working principal, theory and things to do. Like for picking up things we use fingers and there are 10 fingers by birth, legs are used for walking and there are 2 legs. Exactly same way out each peripherals has certain specification, features, working principal and theory. Like I2C peripheral is used for doing I2C communication, in which there is use of 2 pins called as SDA and SCL. SPI peripheral is used for doing SPI communication, in which there is use of 4 pins: SCL, CE, MOSI, MISO.
Body parts are made-up off, cells, biological tissues and they are attached to our body via bones. Peripherals are made up off an electronic circuit using resistors, capacitors, op-amps, transistors, digital-analog electronics and miniaturized so small using the VLSI-VHDL technology that these circuits are made to fit inside the tiny chips called microcontrollers.
Now for using body parts, certain configurations have to be done like some biological signals. Like to pick the glass only one hand is made to use, so these signals are sent by brain to the hand via biological signals through muscles and nerves. Same way-out for using the peripherals of MCU, there are configurations has to be done to enable those peripherals and configure them on how the peripherals should be used. That thing is done via registers inside the microcontroller. Registers are basically memory spaces inside the microcontroller over which we write 0 or 1 to configure the peripherals. One can say basically we configure the peripheral circuits for using peripherals by writing 0 & 1 in microcontroller defined memory regions called as peripheral registers. These configurations are software controlled and are termed as peripheral coding/BareMetal coding. For every peripheral their are different registers(memory spaces). We configure these peripheral registers using C/CPP language. So as to do that knowledge of programming, peripheral registers, understanding of that corresponding peripheral is required
The skills and technology of configuring these peripheral registers is called Embedded Firmware development. And
I guess concept of peripherals might have cleared in your head, as for developing different applications and projects which are stated above concept and understanding of these peripherals plays very crucial role. As with these peripherals we can connect n number of things like: GPS modules, GSM modules, Display screens, sensors, Wifi modules, led lights and etc.
Now just like in our body, brain is our central system. Without which we cant function and inside the brain only all the processing of data is done. Same way-out Microcontrollers has CPU as its central system, where processing of all the data is done. Also called as processor/core.
Data which comes from outside world and corresponding to which actions has to be taken this.
How to understand peripherals of MCU.
- About registers in microcontroller for peripheral configuration
- Pick any MCU which you like
- Now pick its datasheet or reference manual.
- Go to section of the peripheral which you wanna learn….
- Now at first just read and understand the peripheral theory from internet. Get basic understanding, overview and applications of the peripheral.
- Now understand the features which are listed under that corresponding Peripheral in the MCU reference manual.
- That is the best way to learn about peripherals and understand it practically. As by reading the features you will be get the
List of blogs to read to start with the journey
Next Blog To Read
More Blogs to read to get started with MCU's
ADC in AVR
Table of Contents Introduction to Analog To Digital Conversion (ADC) Microcontrollers as we know of today are digital devices that is they only understand digital signals but our world is not digital and produces many analog signals as well. Here comes the role of ADC. Analog to Digital converter as the name suggests is used to convert any analog signal to digital so that microcontroller can read that signal. AVR microcontroller have inbuilt ADC on all bits of PORTA. In this blog we will be discussing about all the registers and bits necessary to use ADC on AVR. ADC on AVR Now let us use this ADC of AVR and convert analog signals to digital and read them. Block Diagram for using ADC on AVR: Let us discuss these steps in detail to understand use of ADC in AVR STEP – I : Basic Setup 1) Setting up pre-scalar for ADC frequency We know that digital signal are at fixed moment or instances of time while analog are continuous in time. So when we convert analog signal to digital signal we need to decide that on how many instances of time we need to take value of signal so that we can create a digital counterpart of signal. In the image above the green line depicts analog signal and blue lines make up digital signal. Now we need to decide that for ADC how many blue lines we need. The no. of blue lines in a second is called sampling frequency. AVR has a counter which counts from 0 till 65536 and turns back to 0 and counts again. We will tell AVR that every time you count 16 times then put 1 blue line of digital signal according to analog signal. This thing is known as pre-scalar. If we set up a pre-scalar of 8 means we say to AVR that after every 8 times you count add 1 reading of digital signal. Preferred and generally used pre-scalar value is 16. ADCSRA i.e. ADC Control and Status Register A has bits 2,1,0 which decide the prescalar for ADC. You can refer table below which is taken from datasheet to select value for ADC pre-scalar: Lets see code for setting 16 bit pre-scalar. For 16 bit pre-scalar we need to only set bit ADPS2, so we will set 1 to ADPS2 bit in ADCSRA register. ADCSRA |= (1<<ADPS2); 2) Setting up resolution for ADC Resolution is nothing but a technical term for maximum value that we will be taking up as digital value. As we convert analog signal to digital we convert it to numbers where a number will represent the maximum analog input value i.e. if we set max input to 5v then digital value of all inputs equal to greater than 5v will be that number. Similarly a number is assigned to minimum value and the range between those numbers represent the values between minimum to maximum input voltage set. Now 8bit resolution means 0-255. The question comes up how? It has a simple answers. 8 bit resolution means that the converted value will have 8 binary digits. So now minimum value of 8 digit binary number is 00000000 which is 0 in decimal and highest value is 11111111 which is 255 in decimal hence the 8 bit range is 0 – 255. Here 255 represent 5V (Maximum voltage input) and 0 represents 0V. This makes up 256 digits for 0 volt hence we can calculate: 5V/256 = 0.0195V This implies that every number represents 0.0195 V. So 1 in digital value is equal to 1*0.0195V = 0.0195V. Similarly 25 means 25*0.0195V = 0.4875 V and so on… Similarly 10 bit has 10 digits so range becomes from 0(0000000000) – 1023(1111111111). And now if we select maximum output voltage to be 5V then 1023 means 5V but for every count precision increases, so: 5V/1024 = 0.00488V Hence every count represent 0.00488V and as shown above now 25 count will mean 25*0.00488 = 0.122V. Enough theory!!! Now lets see how to write code and select the resolution (range) we need for our ADC. AVR has a 10bit ADC. We can obtain both 8 bit values and 10 bit values from ADC for AVR. To set resolution we need to use ADMUX register of our microcontroller. ADMUX stand for ADC Multiplexer selection register. For 8 bit mode, set ADLAR bit of ADC to 1. ADMUX |= (1<<ADLAR); For 10 bit mode, clear ADLAR bit i.e. make it 0. ADMUX &= ~(1<<ADLAR); 3) Setting up ADC reference voltage Reference voltage is the voltage level which will be considered as maximum voltage by our ADC and at any voltage level equal to or greater than reference voltage, we will get the maximum value after conversion. The maximum value that we discussed above is same ad known as reference voltage as ADC takes this voltage as reference to work. Reference voltage can be set using ADMUX register. Bit 7 and bit 6 decide the reference that we are going to use according to the following table fetched from the datasheet. a) AREF(00) – We give the reference voltage to AREF pin, i.e. PIN 32. b) AVCC(01) – The reference voltage is considered as power connected to VCC. AVCC is Analog VCC which is optional to give for better ADC functionality. If you leave it empty then also nothing happens. It also suggest to add an external capacitor between AREF and GND so that there is no noise in ADC due to AREF pin. c) Internal 2.56V(11) – This provides a fixed internal reference voltage of 2.56V to ADC. It also has suggestion of adding a capacitor in similar way as above so that there is no noise from AREF Pin. For AREF mode, clear REFS0 and REFS1 i.e. make them both 0 ADMUX &= ~(1<<REFS0); ADMUX &= ~(1<<REFS1); For AVCC mode, set REFS0 ADMUX |= (1<<REFS0); For Internal 2.56V, set both REFS0 and REFS1 i.e. make them both 1 ADMUX |= (1<<REFS0);
Implementation of BLE on STM32WB55
Table of Contents About GPIO Peripheral The pins which can be configured by the software at runtime to perform various functions are called GENERAL-PURPOSE INPUT/OUTPUT (GPIO) pins. With the help of software one can program the GPIO pins mainly as: Digital Output It compares the external voltage signal with a predefined threshold. Digital Input It controls the Voltage of the pin Analog Function It performs ADC (Analog to Digital Conversion) or DAC (Digital to Analog Conversion) Other Functions or Alternate Functions It makes the pin to perform other functions like PWM output, timer-based captures, external interrupts, and various other interfaces like SPI, I2C, UART communications. Before coming to the Schmitt Trigger Understanding, have a quick recap of Pull Up, Pull Down and Open Drain Configurations from MPU6050 Implementation blog Implementation of MPU6050 with STM32 – gettobyte GPIO Input: Schmitt Trigger GPIO Output Speed Slew Rate GPIO Input: Schmitt Trigger A SCHMITT TRIGGER is a device which uses a voltage comparator to convert a noisy or slow signal edge into a clean and desirable edge instantaneously. For a real time system, the external signals do not change instantly, due to slower slew rate which depends on inheritance parasitic capacitance, resistance or an inductor at the input side. As the processor chip has a Schmitt Trigger, it increases the slew rate and increases the noise immunity for the signals which are captured. Let us understand the implementation of the Schmitt Trigger. It consists of a voltage comparator with positive feedback. The output Vout depends between two input voltage V+ and V–. If V+ > V–, Vout is quickly saturated to VSAT, otherwise Vout = 0 For an ideal op-amp, the current flowing through resistor R3 is zero and thus we have Vref = V– The op-amp output Vout has two saturation values, as shown below Vout = VSAT if V– <V+ 0 if V– < V+ However, V+ depends on Vout and Vin· Therefore, Vout depends on both the input Vin and the recent history of Vout· Such an effect is called hysteresis. Using KCL, assuming that the current flow in the non inverting input terminal of op-amp is zero, Vin – V+ /R2 = V+ – Vout / R1 On solving the above equation we will get, Vin = R2Vout + R1Vin / R1 + R2 At the time instant when Vout transits from one saturation value to the other saturation value, we have V+ = Vref Thus, Vref = R2Vout + R1Vin / R1 + R2 Solving further we get, Vin = (1 + R2/ R1)Vref – (R2/R1)Vout As discussed earlier, Vout has only two possible values. If Vout = 0 initially and Vin increases, we can obtain the trigger high threshold VTH at which Vout transits to VSAT: VTH = (1 + R2/R1) Vref – (R2/R1)*0 = (1 + R2/R1)Vref On the other hand, if Vout = VSAT initially and Vin decreases, we can obtain the trigger low threshold VTL at which Vout transits to 0: VTL = (1 + R2/R1) Vref – (R2/R1)VSAT Vout can be determined by comparing it with two thresholds VTH and VTL. When Vin climbs through VTH , Vout is rapidly switched to the upper limit VSAT· Conversely, once Vin falls below VTL, Vout makes a transition to the lower limit. Note that VTH > VTL , i.e., the threshold for switching to high is greater than the threshold of switching to low. A Schmitt trigger when compared, Provide a better boise rejection. Larger threshold for switching high and low for switching. Immune to undesired noise. GPIO Output Speed Slew Rate The SLEW RATE of a GPIO pin is the speed of change of output voltage with respect to unit time. Slew Rate = ΔV/ Δt In simple words, If the GPIO pin changes from LOGIC LEVEL 0 to LOGIC LEVEL 1, the voltage changes from 0V to 5V in just 5µs, then the slew rate is simply 1V/µs. The higher the slew rate, the shorter time the output voltage takes to rise or fall to desired values. Therefore, a higher slew rate allows faster speed at which the processor can toggle the logic level of a GPIO pin. A shorter rise and fall time allows a GPIO pin to change its logic value more rapidly. A high slew rate can result in significant electromagnetic interference (EMI), also known as radio frequency interference (RFI), to nearby electronic circuits. This is due to the large-amplitude and high-frequency harmonics produced by a fast-rising and falling signal, which can cause malfunctions in a victim circuit through radiation, conduction, or induction. To reduce EMI disturbance, a slower slew rate is generally preferred. GPIO IN STM32WB Each GPIO port has 4 32-bit Configuration Registers (GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR and GPIOx_PUPDR) 2 32-bit Data Register (GPIOx_IDR and GPIOx_ODR) A 32-bit Set/Reset Register (GPIOx_BSRR) A 32-bit locking Register (GPIOx_LCKR0 and 2 32-bit Alternate Function Select Register (GPIOX_AFHR and GPIOX_AFLR) Main feature sog GPIO are Output states: push-pull or open drain + pull-up/down Speed selection for each I/O Input states: floating, pull-up/down, analog Fast toggle capable of changing every two clock cycles Highly flexible pin multiplexing allows the use of I/O pins as GPIOs or as one of several peripheral functions GPIO Functional Description The port bit of GPIO can be configured by the software depending upon the hardware characteristics in various modes such as: Input floating Input pull-up Input-pull-down Analog Output open-drain with pull-up or pull-down capability Output push-pull with pull-up or pull-down capability Alternate function push-pull with pull-up or pull-down capability Alternate function open-drain with pull-up or pull-down capability Each I/O port bit is freely programmable, however the I/O port registers have to be accessed as 32-bit words, half-words or bytes. The purpose of the GPIOx_BSRR register is to allow atomic read/modify access to any of the GPIOx_ODR registers. In this way, there is no risk of an IRQ occurring between the read and the modify access. The above diagram shows the basic structure of a
UART Peripheral in STM32F103
For the people looking to start with STM32 and looking for its full tutorial blog series on different peripherals of the STM32 Microcontrollers. In This blog get to know about, UART HAL API’s, how to generate the UART code and demo examples based on UART peripheral of STM32.
What is Altium CircuitStudio?
Altium Circuit Studio is an entry-level but professional PCB design suite. Which offers interactive automated routing, intuitive ECAD-MCAD collaboration, integrated SPICE simulations, and unparalleled design efficiency at an affordable price point. Often compared to KiCad because of the small difference in price point. Altium CircuitStudio comes with a perpetual licence fee of $495. With its native 3D, version control and over 300,00 component library and the Altium promise. This software will definitely prove to be better than others in its class. Opening up this software showcases a deliberately minimal interface that requires lesser resources to run on your computer. This showcases the demographic this product is aimed towards. Exactly as it says on the box entry-level professionals or freelancers or undergraduate students. This is not a full-professional product which is made evident by some things like, not being able to multi-object drag and drop, remapping hotkeys (this is a very mouse-heavy program), and no.DbLib support. CircuitStudio is unable to define its place, for a perpetual license fee of $495 you get 90% of the features of Altium Designer but those last 10% are the real challenge, this means that software is limited to designing low-level PCBs, which can be good for a freelance, but the price at which you get this software may just be too high for a graduate student willing to pay $120 per year for the Altium Designer student version, but without the ability to sell your designs, which CircuitStudio offers. The best thing which circuit studio offers at this price point is the Altium component library. This software is a good investment to start your PCB design and schematic journey while getting hands-on lessons and tutorials straight from the Altium community. Author: Kunal Gupta
Author: Kunal Gupta
Author