What is STM32 ? STM32 is a family of 32-bit Microcontrollers and development boards manufactured by ST Microelectronics which offer very high performance for a relatively low price. All STM32 microcontrollers are based on ARM Cortex-M processor which make them much better in terms of computing power than most of the common microcontrollers/microcontroller development boards which are available in the market. These microcontrollers also have been provided with software support by ST for developers for free. If you have experience with microcontrollers like Arduino, this is a great step forward in understanding microcontrollers in depth. The STM32 framework allows you to control all peripherals and allows you to tweak them as per your wish, whereas in Arduino IDE, when you program in C++, it comes with in-built functions and libraries which don’t allow you to understand the backend working behind everything. This is very crucial, as it allows you to use the microcontroller to its full potential. STM32 FAMILY The STM32 family of microcontrollers is vast and expansive, offering a variety of options for the consumer to choose from. The family of microcontrollers is broadly classified into 4 categories- High performance ST offers a series of microcontrollers which have the fastest code execution time, high speed data transfer and relatively higher flash memory. Along with this, the feature the most advance peripherals that ST offers. This makes these controllers very useful for real-time applications such as running an RTOS. STM32H7x The H7 series controllers are based on the ARM Cortex M7 offering very high speeds of upto 550Mhz. The microcontroller series comes in two variants, single core and dual core. Dual core H7 series controllers come with an ARM Cortex M4 core as well as an ARM Cortex M7 core which allows for processing work distribution, very useful for applications requiring many peripherals where response time is critical. The dual Core variants also come with an inbuilt SMPS as well. The single core series comes with an ARM Cortex M7 core with clock speed between 220-550Mhz, depending upon the variant. STM32F7x The F7 series controllers are based on the ARM Cortex M7, Thanks to an L1 (level 1) cache, the series delivers the maximum possible theoretical performance of the Cortex-M7 core. Cache memory temporarily stores instructions frequently accessed by the processor STM32F4x – The F4 series is based on the ARM Cortex M4. These controllers have less processing power then H7 and F7 series but still come with advanced peripherals and high flash memory. A very useful line of microcontrollers which offer a wide variety of features and come at a relatively lower cost than that of an F7/H7 controllers. The F4 series is broadly divided into 3 segments- 1.F4 Advance line- Offers up to 180Mhz of clock speed and a maximum of 2 Mb of dual bank flash memory, with advanced peripherals, consisting of communication buses such as QSPI. 2.F4 foundation line- Offer lower flash memory (between 512Kb-1Mb) , with few controllers offering advance peripherals and features such as camera interface and Ethernet MAC. 3.F4 Access line- This line of F4 controllers consists of entry level controller which can be termed ‘High Performance’. These controllers come with lower clock speeds, lower RAM but feature very good power efficiency, while also not compromising on peripherals. Wireless The main focus of the STM32Wx microcontroller family is wireless connectivity. They cover sub-GHz as well as 2.4Ghz frequency range operation The STM32 wireless MCUs are further divided into 2 categories– STM32WB These MCUs have a dual core processor unit, Cortex M4 & Cortex M0+, which allows for processing distribution, making it a great candidate for real-time processing and execution. The MCU series is based on STM32L4 architecture, which offers dynamic voltage scaling, reducing the power consumption of the device. They also support BLE 5.3, Open Thread and Zigbee protocols, making them a great choice for IOT applications, providing a lot of functionality onboard the chip itself. STM32WL These MCUs also come with a dual core processor unit like the STM32WB series, and some variants also come with a single ARM Cortex M4 as their processing unit. The key highlight of this series of microcontrollers is that not only do they work as a general purpose microcontroller, but also come with an integrated sub GHz radio supporting LoRa WAN which makes it a great choice for smart home applications, utilities, logistics, Industrial IOT etc. Ultra-Low Power – STM32 ultra-low-power microcontrollers offer designers of energy-efficient embedded systems and applications a balance between performance, power, security and cost effectiveness. The portfolio includes the STM8L (8-bit proprietary core), the STM32L4 (Arm® Cortex®-M4), the STM32L0 (Arm® Cortex®-M0+) and the STM32L1 (Arm® Cortex®-M3). The STM32L5 MCU (Arm® Cortex®-M33) with its enhancedsecurity features is the latest addition to this rich portfolio. The new STM32U5 series combines the latest and most efficient Arm Cortex-M33 core with an innovative 40 nm platform that reduces energy consumption to the bone, while increasing performance. The series also adds the state-of-the-art features which are required in today’s applications,including advanced cyber security with hardware-based protection, and graphics accelerators for rich graphical user interfaces. The STM32L5 series enhanced security features leverage Arm® Cortex®-M33 and its TrustZone® for Armv8-M. Thanks to this new core and a new ST ART Accelerator™ (also supporting external memory), the STM32L5 reaches an 443 CoreMark. The STM32L4 series offers the excellence of ST’s ultra-low power platform with an additional performance dimension by providing 100 DMIPS with DSP instructions and Floating-Point Unit (FPU), more memory (up to 1 Mbyte of Flash memory) and innovative features. The STM32L4+ series extends STM32L4 technology by offering higher performance (120 MHz/409 CoreMark executing from internal Flash memory), larger embedded memories (up to 2 Mbytes of Flash memory and 640 Kbytes of SRAM), and rendering advanced graphics without compromising ultra-low-power consumption. The STM32L0 series offers a genuine energy-saving solution for entry-level applications. Available in tiny packages down to 14 pins and with a wide range of Flash memory densities from 8 to 192 Kbytes, the STM32L0 features ultra-low power consumption in a competitive portfolio. Mainstream– The mainstream microcontrollers are more general-purpose boards
Hola Amigos!! Welcome you all to Gettobyte platform. I am firmware developer and when I am learning firmware development by interfacing number of sensors and modules that has to be connected with MCU. It becomes headache when it comes to making connections of all sensors, using jumper wires on breadboard to interface all modules which are required. Thus, development this board which has almost all peripherals of STM32 MCU connected to one or other sensor to make different kind of Firmware’s (via interrupts, DMA or pooling, RTOSes frameworks, Bare-metal or HAL Based and etc.). In short, this board is best for people who wants to learn firmware development and understand all peripherals of the MCU. What is GB_STM32_EVAL_BOARDV_1? GB_STM32_EVAL_BOARDV_1 is a Custom Eval Board which is designed based on the SMART Energy Metering application, which has several on-board sensors and modules concentric to metering applications. GB_STM32_EVAL_BOARDV_1 is also a Custom Eval Board based on STM32F103 MCU, which is designed to get hands on all the basic peripherals of STM32 MCU and learn different frameworks of Firmware Development like RTOS, STM32HAL and Bare Metal Codes. Features of GB_STM32_EVAL_BOARDV_1? The board is based on SMART Energy Metering application, which has a number of on-board sensors and modules concentric to metering applications. The board has following onboard external components directly connected to STM32MCU via its peripherals. AC energy metering IC: HLW8012(Timer Input Capture peripheral): AC energy metering IC with 2.5kV galvanic isolation of signal and power fascinated by onboard isolated switch mode DC-DC converter and optocouplers for isolation of signal Temperature sensor module: DHT11(Timer peripheral) DC energy metering IC: INA219(I2C peripheral) OLED graphical Screen: SSD1306(I2C peripheral) Wifi Transceiver module: ESP8266(UART peripheral) Industrial Communication Protocol Transceiver: RS485( UART peripheral) RF transceiver module: NRF24L01(SPI peripheral) External Flash Memory IC: W25Q32(SPI peripheral) In addition to the above peripherals the board has LEDS & Pushbuttons, to play with GPIO peripheral. 10k Ohm potentiometer to get hands on ADC peripheral of STM32 MCU’s. The board has breakout pins headed out of all the pins of MCU, for connecting another sensor. This board has 0 ohm resistors which act as jumpers. These can be useful while debugging the PCB and also to utilize the pins of the MCU that have been occupied by onboard peripherals. The board also has Female-header pins exposed out with each Onboard sensor/module, for connecting the Logic Analyzer to test and debug the working of sensor. Module connected to those pins. The board can measure AC Ratings upto, The board can measure DC Ratings upto It has an on-board data logging feature for 128MB of data, that is approximately 60 days of readings. Debugger The board can be programmed and debugged via STLINKV2 debugger externally. The board has SWD and SWO debugger pins both headed out via on board Header pins, P1 which can be connected to external debugger STLINKV2, as shown below. Power Supply The board has number of On-board power supply options. It can be powered by DC adaptor of 6V-40V DC. It can be powered directly via STLINKV2 also. It can be programmed via UART-FTDO connector too How to get started with the Board? To get started with the board is quite simple, simply connect the STLINKV2 debugger via its Debugger pins. You can now open the STM32CubeIDE and simply create a new project by selecting MCU as STM32F103C8. That’s all, just configure the project according to your wish. Now you can program the board according to your wish using different frameworks of Firmware as follows: Using Bare Metal Coding, by making device drivers of the peripherals in register level and then using that for Application development. This way is recommended for beginners who want to learn Embedded Firmware Development from scratch. Using STM32 HAL, by configuring the firmware of the board via STM32CubeMX. And directly focusing on the Smart Metering Application project development. This way, is recommended for those who wants to do R&D and prototyping for Smart Metering Application, by building different kind of Applications on the board Using RTOS, for building of complex applications. The board houses a number of Input/Output sensors and modules. So it is idle to learn RTOSes like FreeRTOS,Mbed RTOS and etc. You can program it via STM32CubeMX, configure the project according Use Cases of Board Custom Evaluation board on STM32 MCU For accelerating prototyping and development time.Board has on board Metering sensors, Display Screen, Wi-Fi module, RF module, external flash memory, Temperature Sensor, ADC module and RS485 port. So that Development team and engineers can test their Firmware’s directly on EVAL boards for different scenarios and cases, without going on to hustle to mimic the hardware on breadboard and Jumper Wires during POC. Board can also be used as DIY KIT, by hobbyists, students and makers to learn STM32 MCU.Eval board has different sensors and modules interfaced to STM32 MCU touching all peripherals of the MCU. Don’t need to involve in the hustle of interfacing every sensor and module via jumper wires and breadboard. Use of jumper wires and breadboard, makes the circuit too messy and ugly to work on. Thus developed this EVAL board which has quite famous sensors and modules interfaced to STM32 MCU on PCB, to make the different application firmware on different No RTOS or RTOS frameworks. Board is concentric to Metering Industry. In Depth Overview AC Energy metering IC HLW8012: Connected to MCU via TIMER INPUT CAPTURE. HLW8012 has 3 pins: SEL, CF1 and CF. Which are connected as shown below. It has to be powered externally via 5V DC supply. Also, it is isolated from power supply of the board, as this part of circuit will be having high Electrical voltage. Also, there are test point P16, for debugging and testing the signals of HLW8012 via logic Analyzer or Oscilloscope. CF1: PB5(T2C2) CF: PB6(T4C1) SEL: PB7(GPIO) DC Energy metering IC INA219: Connected to MCU via I2C1 of MCU. SCL: PB8 SDA: PB9 W25Q128JV SPI flash memory: Connected to MCU via SPI1. CS:PA4 MISO(DO):PA6 MOSI(DI):PA7 SCK: PA5 NRF24L01 RF Transceiver
This video is in continuation to series of FreeRTOS tutorial blogs, checkout previous blog if you wanna know how to get started with RTOS using FreeRTOS. Now in RTOS one of the very first things that we do, is TASK creation and then schedule it via the concept of priority wise. After which tasks are executed according to the scheduling algorithm chosen. If we were to understand in simple terms, TASKS are something that needs to be done. There are multiple tasks running parallel in RTOS but at a time only one task is getting executed(if MCU is single core). It is characteristic of the RTOS kernel which makes us visible that all tasks are running simultaneously. Each task has its own memory, requires the system resources, has its own variables and etc. So we are going to first implement this thing only, we will see how to create multiple tasks, and how to write Software for each task which will perform some kind of Input/Output action. Then make them run simultaneously by starting the FreeRTOS kernel. Each task is a small program on its own. Each has an entry point & will normally run forever with an infinite loop. The task function is the entry point where we write the program for corresponding tasks. There is TCB( Task Control Block) which will be having all the information about TASKS. This will be used to debug & understand the tasks creation and working. Sensor & modules Drivers to run them as tasks in FreeRTOS: ESP8266 as Client With HOST MCU. W25QSPI Flash memory for logging with HOST MCU. INA219 DC Current sensor with HOST MCU. HLW8012 AC metering IC with HOST MCU. OLED Screen Display with HOST MCU. DHT11 temperature sensor with HOST MCU. Making FreeRTOS project in STM32CubeIDE At first, we created the project with the FreeRTOS as middleware in STM32CubeIDE. We would be using STM32F103 bluepill as our controller. I hope you guys know how to create a project in STM32CubeIDE, if viewers don’t they can refer to this video (in the video I have chosen different MCU, you can choose whatever MCU you are using) for that and then come back here. After STM32CubeIDE Project is created, open the .ioc file in your STM32 project directory from the project explorer.  (I am skipping the basic configuration of RCC and SYS, assuming that viewers already know how to do that. if they don’t, they can have a look from this video.) Now go to the last section Middleware in the categories of the .ioc file. Select the FreeRTOS. Select Interface as CMSIS_V1.  Now you can see in the configuration there are many heading with the name of RTOS components. So, from here, we can configure our FreeRTOS directly in a GUI-based way, thus I started with STM32CubeIDE as it becomes easy for beginners to start with FreeRTOS. Now seeing the headings for beginners, it might be confusing which components are used when and for what purpose. If you have read the PDF on RTOS which i have mentioned in my previous blog: Starting with RTOS: FreeRTOS | gettobyte, you would be having a rough idea of these headings.But for now, we would only be focusing on the Tasks and Queues heading, which is used for the creation/management of tasks and queues. As in this blog, we are only creating tasks, so we would be creating tasks for now and understanding how to configure their different parameters. Don’t worry!!, we don’t need to learn all things at one time.
What is Real Time Operating System(RTOS) ? Operating System must have heard this name earlier but only in relation to Windows, Linux, and MAC OS which are there in Laptops and Computer devices. Most people are aware of only these Operating Systems in general terms which are there in most the General Purpose Computers. But what if I told you that there is an Operating System in most of the electronic devices (Embedded devices) around us like Earphones, Setup Boxes, Cars, speakers, Air Conditioners, Smart Watches, Medical devices and etc? Operating System is basically a software stack that allows the Electronic/Electrical devices to mimic the sensing of multiple inputs, their processing and correspondingly controlling multiple outputs at an instantaneous time. All of these Embedded devices have multiple inputs that need to be sensed, then processed, and correspondingly control the outputs. All of this happens in a real-time and mimic to happen at an instantaneous time. These Embedded devices work in Real-time data on time-critical and small memory space constraints. To put it in a different perspective, imagine a manned spacecraft in low earth orbit traveling about 17,000 miles an hour. Suppose that every 1,000 seconds, it has to fire an orbital maneuvering system rocket for 3.8 seconds to avoid deorbit. A one-second unit of time translates to 25,000 feet of distance covered. Imagine what nightmare would ensue if the spacecraft avionics had to stop, wait for the navigation system to page back in, fire the rockets, and then wait for the next interruption to stop firing the rockets. It could take five seconds or more. In that time the spacecraft will deviate 25 miles from its projected course. You can take any example, let\’s say of speakers. Speakers are connected to our phones for playing music, the moment when we press a song to be played at just a fraction of sec that music gets start playing. But have you ever thought that what all process is behind this? There is Bluetooth signal that has to be send from our phone to speakers, then speakers process and compute the signal that it receives. Then according to signal, speaker base start vibrating to play the music. The connection between phone and speakers should be continuous, so that signal to play the music (lyrics basically) is not interrupted. If in between to this we need to lower the volume or change the BASS of music those signals also have to be processes, computed and executed. Same way out you can try to think the flow of working of electronic devices around you and realize that Operating System is everywhere not just in our desktops. Operating system used in Embedded devices is called Real Time Operating System (RTOS). RTOS is very important topic and concept to be understood to make complex electronics/electrical application projects which are time critical like nuclear monitoring devices, Anti-brake system, automotive ECU\’s, Programmable logic Controllers (PLC\’s), Automated guided vehicle\’s (AGV), Motor drivers which are there in metros/airplanes/vehicles, and many such examples (In some cases, instead of RTOS, Linux OS is also used. That is different topic to be touched).
Table of Contents Intro From this blog, we will be starting with RTOS(FREERTOS). In RTOS there are many concepts & things related to kernel, tasks management, task scheduling, IPC, and many other terminologies. In the tutorial series, we are not going into a theoretical understanding of the RTOS topics, we would be mainly focusing on developing different applications in RTOS. Like how to use mutexes, and semaphores in different applications, we will get into the RTOS kernel and understand its different components like scheduler, task management and etc., compare different scheduling algorithms in terms of time and how to create multiple tasks and pass information between them, how to use Software timers, queues and etc. while writing firmware for industrial projects. As there are many resources & tutorials to understand these theoretical concepts and how to use RTOSes APIs to build different kinds of applications is not much there. So, we would be focusing on that thing. RTOS is used in applications like that AGV(Automated Guidance Vehicles), Automotive ECU, and industrial automation products (Like metering instruments, industrial smart sensors and etc.). I have a personal interest and passion for these, so I would be making projects using RTOS related to these by interfacing sensors and modules used in these applications. Ultimately making the different tasks run together to utilize the power of RTOS to make an efficient project. To Know about what RTOS is, refer to this blog What is Real Time Operating System (RTOS) | gettobyte Now to start with RTOS, there are many open source RTOSes available like FreeRTOS, embed OS, Zypher OS, ThreadX OS and etc. But starting with FreeRTOS would be my choice that too with STM32 because the integration of STM32CubeIDE with FREERTOS is pretty easy & gives an easy starting point for beginners. Subsequently, we will migrate to NXP controllers with FreeRTOS. Once getting hands-on with FreeRTOS via STM32. Requites: Bare metal coding On MCU’s (Register level programming, working of MCU’s, SoC/processor architecture, boot process: linker script, startup code, GNU GCC, Debugging and etc.). Knowledge of peripheral of UART, I2C, SPI, ADC, Interrupts, DMA and etcC/CPP programming, etc). Device driver development to integrate different sensors & Modules with MCU. (Datasheet reading, communication protocols, sensors and modules working/Cpp programming). Knowledge of C/CPP programming. Software Development Kit, IDE, HAL, RTD drivers and etc. FreeRTOS What is FreeRTOS? FreeRTOS is Real Time Operating System, which is highly used in industry. It is also best recommended for beginners to start with if one wants to learn RTOS, because of its wide number of resources available, documentation, and community support. FreeRTOS is a market-leading embedded System RTOS, which is available for many processor architectures, it supports more than 40 processor architectures including ARM cortex processors. Also portable to a wide number of compilers and hardware platforms. FreeRTOS is supported by a wide number of silicon vendor chips like NXP Semiconductors, STMicroelectronics, Texas Instruments, and many others. You can find a full list of that here: Microcontrollers and compiler toolchains supported by FreeRTOS. Features of RTOS Highly configurable kernel. FreeRTOS has Microkernel architecture. Pre-emptive or co-operative operation. Inter Processor Communication techniques like Mutex and Semaphore for synchronization. Support for message queues. Software Timers. Event groups. Memory management to maintain heap memory. Also, advanced features for debugging the tasks in Real Time. FreeRTOS Kernel The kernel is the most important thing and core of the RTOS. For the understanding you can have analogy that Human body is RTOS, and Human Brain is RTOS kernel. As without our brain we can’t do any work and loose our capabilities. Same without the kernel, RTOS can’t work. It is kernel which makes electronic devices, a multitasking system. It is kernelling whose responsibility is to run different tasks and have communication between them. Kernel act as the interface between system resources and user application. Kernel has different services for making multitasking system. Just like human brain has different biological parts to make us work. ( In the upcoming blogs and in this also, i would be using analogy of Human brain and Human body for understanding). The basic services of RTOS kernel are: Task/Process Managment (Creation and deletion of tasks) Task/Process Scheduling (Scheduler) task/Process synchronization (Inter Process Communication) Memory Managment (heap & static) Interrupt Handling Error/Exception handling Coming to the FreeRTOS, it has highly configurable kernel. We can configure how to use the FreeRTOs kernel and which features/services of it. FreeRTOS is configured by FreeRTOSConfig.h header file. This file contains application specific definitions to configure FreeRTOS kernel. Every RTOS has one such configuration file which has macros, which can be enabled or disabled. Like we can configure which scheduling algorithm to use, how to create the tasks (static or dynamic), which IPCs to use for communication between tasks, enabling of run-time trace and debug features. When you will download the FreeRTOS kernel zip file, you will find many numbers of files. But core FreeRTOS is runned by just 2 files tasks.c and list.c. They are located in FreeRTOS/Source directory. In addition to these files, imp files whose Api’s we would be using are queue.c, timers.c, event_groups.c, croutines.c. Examples of RTOS Kernel: Mach QNX VXworks FreeRTOS Chibios ThreadX mbedOS FreeRTOS Libraries In addition to FreeRTOS kernel, there are add on libraries to extend the RTOS functionality. FreeRTOS+: To add support of TCP/IP stack and command line interpreter. FreeRTOS Core: To add support of cloud connectivity with HTTP, MQTT, JSON, Cellular interface. FreeRTOS AWS: To add support of AWS services. How To Start with RTOS? So, as of now, I have told you many things about RTOS and FreeRTOS. Most of you must have come up with that now how to start with FreeRTOS to learn RTOS. When we go to the FreeRTOS website for starting with RTOS, there are many things on the website, lots of documentation, articles, and resources on the website that might become overwhelming and confusing for beginners to start with it. At least for me, it does become like that, so I
I was in my final year of my graduation (Btech:EEE) and our last semester is getting over. It was 26th of May 2022, I was in my college lab with my friends and Hod teacher discussing our Farewell venue and date, at that moment I just checked my phone and I saw a notification on LinkedIn, got a LinkedIn HR mail from one of the Re recruiters of Texas Instruments. I got very excited and happy at that moment. I got so anxious at that moment that I immediately told my best friend and gf, after reading the Job Description. My resume got selected for 2 positions in Texas Instruments, one is of Embedded Application Developer and other is of Field Application Engineer. For the position of Embedded Application Developer, I got the LinkedIn HR mail and from there my profile was selected. For the position of Field Application Engineer, I got a referral from the Alumni of my college, who is Field Application Manager at Texas Instruments. And this happens in a span of 1 week, at first my resume is selected for Embedded Application Developer. The very next day I talked to one of the teachers of my college regarding my selection and then she gave me the reference of Alumni of our college who have been at Texas Instruments for 10 years. On talking to the alumni, he told me that there are positions open in his team for Field Application Engineer. He likes my profile and resume both for that position and he referred to my profile for that position. Though I have called him with an intention to talk about an Embedded Application Developer position, he has referred me for one of the positions open in his team. So my interview process was going on for 2 positions parallel at Texas Instruments. Field Application Engineer Now at first let\’s start with the interview process and experience of a Field Application Developer position, for which I ultimately get selected too and offered with a final offer letter of 25 LPA CTC. Field Application Engineer is a kind of technical sales job, in which the hired person has to provide technical assistance, development and strategies of Company products to customers. So the hired person should have knowledge related to company products. Should also be good in communication skills and interpersonal skills to make long lasting professional relations with company customers. So in this case, Texas Instruments is the company and its products are mainly concentric to Its Wide number of MCU, MPU, IoT modules and ASIC chips. So FAE should have good understanding and knowledge of microcontrollers, system level knowledge of embedded products, IoT protocols, use cases of different peripherals of the MCU. A person should have knowledge of different sub components that are used in the design of Embedded products, but is not necessary to have in depth knowledge as FAE would not be involved in development but much more acts as interface between company and the customer using the company products. 4 rounds were taken, out of which 3 are in online mode and one(last one) is offline mode. For the position of FAE, interview questions are different from what we all normally used to prepare ourselves. The questions are much more to test one\’s personality, communication skills, conceptual questions related to technology. My first round was for about 45 mins, in which the interviewer asked questions related to my journey so far, how I have learnt things on my own, why I chose to get into the technical field and some basic technical questions related to Embedded. Also about 15-20 mins of my first round went into discussion of the Field Application Engineer job role, in which the interviewer told me what exactly would be my roles and responsibilities. I expected that there would be coding questions or questions related to in depth hardware but nothing much like that. And i analyzed that the interviewer was concentric to my communication skills, how well can i address my self, how i well i can interact with people to
Get Started with NXP S32K144EVB for Automotive and Industrial Applications. MCU features, Board features, PinOut, SDK and IDE installation with debugging
See around yourself, we all are surrounded by electronic gadgets around ourselves. The mouse which you are using to navigate through desktop, the Earphones via we all used to listen to music and show off our styles while traveling!!!, the doorbell we ring in homes and see who is outside through video, wireless car keys through which we open our cars, high volume speakers and decks we enjoy dancing on playing the music of our choice when we go to pubs/discos or parties, automation in cars which we see in the forms of lights, automatic systems, high graphics infotainment along with cameras and wireless systems, setup boxes, medical devices like oximeter, sugar, and blood pressure machines. The list will not stop but the size of this blog will get par. All the above examples which I have listed can be termed as Embedded products. Embedded Products are like a silent servants of the modern technological society, as most of the time people are not aware of it but they keep on doing their work Silently and efficiently. One thing in common in all types of Embedded products is the presence of Microcontrollers or Microprocessors. Microcontrollers or Microprocessors are like the brain of embedded products. Microcontrollers or Microprocessors are digital systems as they only understand binary language that is 0 or 1’s. Now the thing that makes these microcontrollers and microprocessors different from the human brain is that we can program these digital systems. Here comes the Embedded Software/Firmware Development. What is Embedded Software/Firmware Development? Basically, the programming that is done into microcontrollers/microprocessors is termed Embedded Software Development. The term Embedded makes this different from traditional Software Development ( Web/App Development).By the term embedded, it means that their is s Embedded products have a constraint of memory, so programming language has to be there that is of less size and easily be converted to binary language of 0 & 1’s. Programming languages that are widely used: are C and CPP language. Microcontrollers/Microprocessors are physical hardware that can be felt, thus Embedded Software Developers do need some hardware knowledge( like that of Electronics and Computers). Now the difference in Embedded Software and Embedded Firmware is not much. Both of these are used interchangeably in embedded domain. Embedded Firmware is used when we are developing programs very close to hardware like: Device driver development, Peripheral Interfacing, Sensors and Modules integration. Embedded Software is much more inclined towards Hardware Abstraction Layers(HAL), RTOSes, Wireless protocol stacks, Code portability on different platforms. Need of Embedded Firmware/Software Development. Embedded Software/Firmware development is niche R&D skill in modern world technology whose scope and demand will only increase with growing technologies. All modern world technologies which we see around ourselves: AR-VR gadgets, Industrial PLC-HMI’s, Next Generation Automotive cars, Internet of Things, Aircrafts, Avionics and many more can only be build by the help of Embedded Software/Firmware Developers. Because it is role of Embedded Software Developers to interact different hardware subsystems interact with each other( through programming and coding) and made the Embedded product work. How to get Started with Embedded Firmware Development. I hope by now you have get bit of clarity and idea about Embedded Firmware Development and its need. Also the kind of industries one can work on after getting this skill. These are very important things to know before actually start learning any skill. As learning a skill is long process and one need good and strong motivation down the line to stay dedicated to learn that skill. Essential things to learn for Embedded Firmware Development. As if now I have talked much about the high end technologies and big flashy words. But now lets get down to basics and actually see how to learn this skill. Essential things to learn for Embedded Software/Firmware Development. C/CPP language–> This is de-facto and most important. As 95 percent of time programming language which is used by embedded developers would be C/CPP language. Both of the languages are more and less same apart from some concepts. Concept of pointers, bit shifting/bit manipulation, functions, types of data types, strings and arrays are the some concepts that should be gone through. Below are some of the books which one can refer for learning basics of C/CPP. Understanding and Using C Pointers: Core Techniques for Memory Management Object-Oriented Programming in Microsoft C++ Pointers on C by Kenneth Reek Computer Architecture and Organization –> Okay so done with programming part, now hardware knowledge plays equally important role. As Embedded Software/Firmware developers will be programming on Microcontrollers (MCU)/Microprocessors (MPU), so knowledge of them is essential. What exactly is Microcontroller? How do they work? Different kind of architectures in MCU/MPU, difference between MPU&MCU, Boot Process in MPU/MCU, getting familiar with terminologies related to MPU/MCU world are some of the thoughts you can start learning about these. Below are some of the books which one can refer for learning about Computer Architecture and Organization. Computer Organization and Architecture: Designing for Performance Computer system architecture by morris mano One of the best ways to learn these languages is by reading already built in codes. 3. Basic Electronics and Electrical knowledge: Okay so this is the part because of which majority of people after starting initially with Embedded Development left it further in college days. As there is role of hardware also, so alongside with programming language having knowledge of electronics and electrical is required sometimes and can be beneficial. In Electronics knowledge of Resistors, Capacitors, Inductors, Basic Ohm’s law (their use cases in real life application: Current sense amplifiers), Opamps, ADC’s would be good as this would make you understand the Embedded product in better way. In Electrical knowledge of AC-DC voltages, power supplies, Power electronics, basic principles of electricity generation and etc is though not always necessary but would be good to have to make your interactive and interesting DIY projects. Below are the books which one can refer for learning about Basic Electronics and Electricals: Get started with Embedded Firmware Development with Gettobyte (To all
Table of Contents In the last blog of HLW8012 energy metering IC, we have got an overview and understanding of HLW8012 IC. So now in continuation to that blog, in this blog, we are going to develop the Application driver for HLW8012. But before preceding with the Application Driver, we will see the hardware setup. At first, we are going to set up the hardware and connections that has to be made for reading the AC readings. Hardware Setup and connections To be honest this is one of the challenging parts which I faced when dealing with energy metering ICs. As being mainly into Firmware and software part, I was not well aware of the electrical and electronics-related terms, concepts and instruments. Though I am from the EEE branch interest since my graduation was more aligned with Firmware. But I also want to learn and understand the electronics and electrical part, in continuation to my Firmware skills. Thus, I thought of using the Energy Metering IC and make the Energy Meter project, as by that have to learn and understand the Electronics/electrical concepts. Energy Metering IC\’s senses the AC voltage and Current, so input to these IC\’s are AC electrical signals. In comparison to other sensors/modules like temperature, Flash memory\’s, gyroscope sensors, display screens etc., in which input is either our environment or values given by us. But in Energy metering or current sensor ICs, for input we need AC load which will be powered by AC power supply. In addition to these we need multimeters, connecting wires and cables for electrical measurement and connections. Hardware Setup AC load Their are 3 types of AC load: Resistive load, Capacitive load, and Inductive load. There are electrical programmable AC loads, which are actually used in industry for testing and development of Energy Meters. These programmable AC loads can be configured for any type of load. But those are very expensive, to be afforded. So, I started looking for cheap alternatives for all 3 types of AC load. We are going to use resistive load, which will be an AC bulb filament type. AC Source For powering the AC load, we need an AC power supply that will power it. Now while developing the Energy meter and driver for Energy metering IC, I need a variable AC power supply so that I can check the different readings of AC electrical parameters across my AC load. This is one of the first challenges that I faced, which electrical instrument to use, to have a regulated AC power supply. Because AC-regulated power supplies are also quite expensive in comparison to DC-regulated power supplies, which are not affordable to students. Then I came to know about the Autotransformers that regulate AC power. One can take it analogous to potentiometers, on rotating the knob of them we get variable resistance. Same way in Autotransformers, there is a knob that maps from 0-270V. By rotating the knob, we can get variable AC voltage. Also, the AC signal from Autotransformer is quite stabilized and accurate, so these work great for such small and hobbyist projects. Multimeters Multimeters are electrical instruments that are used to measure electrical/electronics parameters. Multimeters can measure both AC/DC readings. In this project multimeters would be used for measurement of AC voltage and AC current across our load. 2 multimeters would be used. One is the generic multimeter, which would be connected across the Autotransformer output pins to measure the voltage. Another is the Clamp meter, which would be connected across one of the wires of our AC load to measure the AC Current. The readings which we will get from here would be used to cross verify and check the readings that would be decoded from HLW8012. HOST MCU In our case, I have used the STM32f103-Bluepill as HOST MCU. Logic Analyzer I will also be using the Logic analyzer, for debugging and seeing the PWM digital signals, that would be outputted by HLW8012. STLINKV2 Debugger STLINKV2 will be used as a debugger to program and flash the firmware into our HOST MCU. Hardware Connections Now coming to the connection parts, we can divide HLW8012 into 2 parts, one is the electronics connection that has to be connected with the HOST MCU. Another is an electrical connection that has to be made with AC load and AC supply. At first, we will interface HLW8012 with our host MCU( which in this case is STM32F103-Blue pill). Viewers can refer to this part to understand how HLW8012 and host MCU communicate with each other. HLW8012 has mainly 3 pins CF(Blue), CF1(Green), and SEL(Yellow) pins that have to be connected with HOST MCU. These pins can be connected to any GPIO pins, just have to make sure that those GPIO pins can be configured in TIMER INPUT CAPTURED MODE. The pins at which CF &CF1 pins will be connected are configured as INPUT and the pins at which the SEL pin would be connected are configured as OUTPUT. In my case I have connected : CF1 pin of hLW8012 –> PA8 CF pin of HLW8012 –> PB6 SEL pin of HLW8012 –> PB12 VCC pin of HLW8012 –> +5V pin of MCU GND pin of HLW8012 –> GND pin of MCU I have also connected the Logic analyzer for seeing the PWM signals digitally and the debugger STLINKv2 for flashing and debugging the code with my HOST MCU. Coming to the electrical connection part, the HLW8012 module has 2 couple of green connectors on it. One couple of connectors is connected to Power Supply, in our case power supply is coming from Autotransformer. So it will be connected to the Output terminals of Autotransformer. Generic Multimeter would be. Another couple of connector is connected to the AC load, in our case, the AC load is AC bulb Filament type. Clamp multimeter would be connected across one of the wire of this connection to measure AC current. That is all connection that has to be made and