Posts

Showing posts from September, 2024

What's Important in Life

Image
  Life is Unpredictable                      "Everyone will go through this question at least once in their lifetime. We all chase after money. Some chase fame, some people chase love, some pursue friendships, and others seek enjoyment. Therefore, there is no fixed definition of what is important in life. Poor and middle-class people strive for money, rich people strive for mental peace, unhealthy people strive for good health, and lonely people strive for friends and love. It completely depends on what we have lost in life. Because, as humans, we don't want to lose anything in this lifetime, we need money, a healthy mind and body, and our beloved family." But sometimes we reach a point where we lose everything. We get sick, we don’t get a good job to earn money, or our salary is not sufficient to lead a beautiful life. Our family may not support us, we may have no one to share our feelings with, or we are too busy with work to...

STM32 Microcontroller- GPIO Driver Development(Part-2)

Image
  GPIO Driver Development                 In the previous blog, we discussed how to develop the drive file for controller specific. Now, let us start developing GPIO driver file. This driver file will be used by the user application, it may want to initialize or use a different GPIO ports, or the user application may change the PIN number, it can change the GPIO modes, speed, output, type etc. So, that's why driver file should give a configuration structure to the user application, So the user application will initialize or fill that structure and then it will pass the structure to the driver APIs, and the driver APIs will decode the structure, and it will take appropriate action like initializing the peripheral registers. So, now there is a need to create configuration structure. GPIO Handle and Configuration structures  Configurable items for User Application: GPIO Port Number GPIO Pin Number GPIO Mode GPIO Speed GPIO Output type GPIO...

STM32 Microcontroller- GPIO Driver Development (Part-1)

Image
  GPIO Driver Development There are two files which we need to consider before developing any peripheral. 1.Driver file 2.Application file Driver File This is a header file which contains Microcontroller specific details such as: *The base addresses of various memories present in the microcontroller such as (Flash, SRAM1, SRAM2, ROM, etc). *The base addresses of various bus domains such as (AHBx domain, APBx domain). *The base addresses of various peripherals present in different bus domains of the microcontroller. *Clock Management macros(i.e, clock enable and clock disable micros) *Interrupts definition. *Peripheral Register definition structures. *Peripheral Register bit definition Define Base Addresses of various memories in the header file #define FLASH_BASEADDR         0x0800 0000U #define SRAM1_BASEADDR        0x2000 0000U #define SRAM2_BASEADDR        0x2000 1C00U #define ROM_BASEADDR      ...

STM32 Microcontroller- GPIO structure

Image
GPIO Pin and GPIO Port              GPIO pin stands for General Purpose Input Output. GPIO's typically used for reading digital signals, generating triggers for external components, issuing interrupts, waking up the processor and many. A GPIO port is a collection of some fixed numbers of I/O pins, STM32 based microcontroller support GPIO port of 16 pins PA.0 to PA.16.  Each GPIO Port is governed by many registers, These registers may vary depending upon the vendor who designs the microcontroller. Generally, in the microcontroller a GPIO port is govern by these registers. * Port Direction (Mode) Register - By using these registers, we can set the direction or mode as an input, output, analog etc. * Port Input Data Register - It is used to read from a GPIO port. * Port Output Data Register - It is used to write to a GPIO port.  Enabling and Disabling GPIO Ports To enable or disable any particular peripheral, we need to enable/disable its intern...

STM32 Microcontroller with Peripheral Development

Image
  Embedded System           An Embedded System is a combination of computer hardware and software designed for a specific function. These systems might also function within a larger system. These systems can be programmable or have a fixed functionality.  In order to work with embedded systems, it is essential to work with a specific microcontroller to understand its hardware and software design. L et us start working on STM32 and its peripheral development. Architecture of Microcontroller Key Points to understand the Architecture of Microcontroller *Memory Map- The program of the microcontroller is stored in the memory. It shows what is included in each memory region. * Oscillator - The oscillator circuit generates the clock pulses so that all internal operations are synchronized. * Input/ Output Ports - Controller communicates with the external world through I/O ports. * Interrupts - This are the signals that informs microcontroller to stop the curre...

Introduction to C

Image
  Introduction to C Why to learn C?           " Nowadays, everything starts and ends with the use of computers. In order to create new applications and innovate, learning the C language has become more important. There are many advantages of using C programs. Some of them are it is easy to learn, portable. Let's start learning C with simple methods." Key points to discuss before writing C codes *Complier- A special program that converts high level language into low level language. Basically, C program to machine level language .  "We may get the question of: why it is required? Our computer understands only "1s and 0s", which is called machine-level language. Our code has to be converted into a machine level language to make the computer understand. It works just like a translator * Keywords- These are reserved words in C, whose meanings are already predefined. For Ex-int, char, float, enum, union, struct etc. * Data Types - It specifies the type ...