Overview So, in this blog we will be covering another alternate functionality of GPIO pins i.e SPI (Serial Peripheral Interface). Previously we hve covered following peripherals implementation in STM32F103 MCU’s. ADC(Analog To Digital Converter) in STM32F103 UART Peripheral in STM32F103 GPIO Peripheral in S32K144 MCU Clock Peripheral in STM32F103 PWM on STM32F103 SPI is a synchronous and full duplex communication between a master and several slave devices. It is used in devices or sensors in which speed is a priority . It operates at data transmission rate 8 Mbits or more. The protocol uses 3 or usually 4 wires for data transmission and receiver .It is used by various sensors and modules such as OLED Display, BMP280 , RC522 , DAC , Shift Registers etc. SPI Theory The SPI uses 2 pins for data transfer SDIN and SDO , SCLK clock for synchronization of data transfer between 2 chips, CE chip select that is used to initiate and terminate the data transfer. SDI = MOSI SDO = MISO SCLK = SCK CE = SS MOSI: MASTER OUT SLAVE IN This pin is used to send data from master to slave MISO: MASTER IN SLAVE OUT Lorem ipsum dolor sit amet, consectetur adipisi cing elit, sed do eiusmod tempor incididunt ut abore et dolore magna SCK: SERIAL CLOCK This is used to generate clock to synchronize data transfer between the master and slave device . This is generated by master SS:SLAVE SELECT Used to select the particular slave to send data . Besides SPI communication the SPI interface can switch between I2S communication protocol that is a synchronous serial communication interface. It supports 4 audio standards including the I2S Philips standard, the MSB- and LSB-justified standards, and the PCM standard. The operating modes can be full duplex(4 wires) and half duplex (6 wires) Multi Mode Configuration Multiple subnodes can be used with a single SPI main. The subnodes can be connected in regular mode or daisy-chain mode. How Data is Transmitted in SPI Initially SCK is enabled that starts the transmission The master sets the SS line low of the slave Data is usually shifted out with most significant bit first , shifting a new least significant bit into the same register Data in slave side is shifted into least significant bit of the register Hence after all the shifting is done the master and slave has transferred the data If more data is to be exchanged the registers are reloaded and the process is repeated When no more data transmission is there the master stops toggling the SCK and deselects the slave using SS SPI Peripheral Bus Modes Before discussing about the various bus modes we will be discussing the clock phase and polarity i.e CPOL:Clock Polarity and CPHA:Clock Phase and it is the combination of CPOL and CPHA that is referred to as Bus Modes. CPOL = 0 Active state of clock = 1 Idle state of clock= 0 Means the sampling on the first edge CPHA = 0 – Data is captured on the rising edge and output on falling edge CPHA = 1 – Data is captured on the falling edge and output on the rising edge CPOL = 1 Active state of clock = 0 Idle state of clock = 1 Means sampling is on the second edge CPHA = 0 – Data is captured on the falling edge and output on rising edge CPHA = 1 – Data is captured on the rising edge and output on the falling edge SPI Features in STM32F103 Full-duplex synchronous transfers on three lines Simplex synchronous transfers on two lines with or without a bidirectional data line 8- or 16-bit transfer frame format selection Multimaster mode capability 8 master mode baud rate prescalers (fPCLK/2 max.) Slave mode frequency (fPCLK/2 max) Faster communication for both master and slave NSS management by hardware or software for both master and slave: dynamic change of master/slave operations Programmable clock polarity and phase Programmable data order with MSB-first or LSB-first shifting Dedicated transmission and reception flags with interrupt capability SPI bus busy status flag Hardware CRC feature for reliable communication: – CRC value can be transmitted as last byte in Tx mode – Automatic CRC error checking for last received byte Master mode fault, overrun and CRC error flags with interrupt capability 1-byte transmission and reception buffer with DMA capability: Tx and Rx requests SPI Instances in STM32F103 SPI instances vary from microcontroller to microcontroller from 1 in stmf103c6t6a to 6 in stm32f7 each having different pins NSS pulse mode , TI mode and hardware crc calculations SPI1 features PA5 as SCK , PA6 as MOSI and PA7 as MISO SPI2 features PB3 as SCK, PB4 as MISO and PB5 as MOSI. NSS Management in SPI protocol for STM32F103 NSS line can to be driven via 2 modes Software Mode- SS is driven internally by firmware Hardware Mode – A dedicated GPIO pin is used to drive the SS line Also NSS features NSS output and output disabled mode. Output mode is used only when device operates in master mode and it is disabled allowing mutli master capability NSS hardware mode must be used in TI mode . CPHA and CPOL are forced to conform to Texas Instrument (TI) protocol requirements. In this NSS signal pulses at the end of every transmitted byte APPLICATIONS OF SPI PROTOCOL Application 1 Memory Devices- SD-Card, MMC, EEPROM and FLASH Application 2 Sensors- Temperature and pressure (BMP280) Application 3 Control Devices -ADC, DAC, Audio Codec Application 4 Others- Camera Lens , RTC, LCD , Touch Screen RFID Module interfacing with STM32F103 W25Q SPI Flash Memory ST77389 LCD Display with STM32F103 NRF24L01 RF Module with STM32F103 How to Configure SPI Peripheral for STM32F103 We would be using STM32 HAL and STM32CubeIDE for using the SPI peripheral in STM32F103 in this blog tutorial series. SPI BLOCK DIAGRAM SPI CONFIGURATION ALERNATE FUNCTION MAPPING CONFIGURATION IN STM32CUBEIDE FIG 1- Selecting MOSI, MISO , SS and SCK pins
What is USB Technology USB is a technology which standardize the connection of peripherals to personal computers. It has largely replaced interfaces such as PS/2 connector (used for keyboard), ADB Connector (used for mouse), Parallel Ports (used for printers) and Game ports (used for video game consoles) which are used to connect different devices to computers. USB technology made it possible to connect all such different devices to computer via single port USB port. How Does USB does that: USB is a bus protocol in which our computer is USB MASTER and devices connected to it are termed as USB DEVICES. USB DEVICES Can be anything: keyboard, mouse, flash drives, hard disk, Audio Devices, Card Readers and all devices you can think of which are connected to USB. Now in USB protocol there is the concept of USB descriptor via whichUSB host that is computer can determine which USB device is connected and correspondingly detect which electronic device is it. The USB is specified to be an industry-standard extension to the PC architecture with a focus on PC peripherals that enable consumer and business applications. What is USB technology Architecture? USB hosts are also known as master devices, and they initiate all the communication that occurs over the USB bus. Typically, a computer or other controller is considered to be the master, only responding to other devices if requesting certain information. The peripheral device(USB Device), or the slave device, is connected to the host device, and is programmed to provide the host device with the information it needs to operate. Typically, peripheral devices include USB flash drives, computer mice and keyboards, cameras, and other such devices. There can be multiple USB devices but only one USB master would be there. The USB system uses the tiered star topology, in which 127 different USB slaves can be connected on the same USB bus. What Are USB Packets? The amount of data transmitted in USB is called ‘packet’. The data transfer that can occur within the USB protocol is discussed below. The data of the USB protocol is transmitted within packets LSB first. There are mainly four types of USB packets: Token packet Data packet Handshake packet Start of the Frame packet Data exchange between the host and device is known as USB transactions. One can think of USB transactions as complete data exchange that occurs between a host and device where all necessary packets are transmitted. Each USB transaction is composed of either 2 or 3 packets, depending on the transfer type being used. Each USB packet is designed from various fields like a Sync field, a Packet ID (PID) field, ADDR (Address) field, ENDP (Endpoint) field, CRC (cyclic redundancy check) field, and EOP (end of packet) field.  USB Packet Field Description Sync (8 or 32 bits): In USB protocol, every USB packet will begin with a SYNC field which is normally utilized to synchronize the transmitter & the receiver to transmit the data precisely. This field is long with 8 bits at high & low speed otherwise 32-bits long for maximum speed & it is utilized to synchronize the CLOCK of the transmitter & receiver. The final 2-bits will indicate wherever the PID field begins. PID(8 bits): The packer identifier field within the USB protocol is mainly used to recognize the packet type that is being transmitted. The length of this field is 8 bits long where the upper 4- bits recognize the kind of packet & lower 4- bits are the bitwise complement of the upper 4- bits. The resulting format of the PID(Packet identifier field) is shown below → → The PID Value: Indicates the type of packet/group( out of 4 one) and the format of the packet and the type of error detection applied to the packet. → PIDs are divided into four coding groups: token, data, handshake, and special, with the first two transmitted PID bits (PID<0:1>) indicating which group. Address field(7 bits): The address field of the USB protocol indicates which packet device is mainly designated for. The 7-bits length simply allows support of 127 devices. The ADDR field is specified for IN, SETUP, and OUT tokens and the PING and SPLIT special token. The address (ADDR) field specifies the address, that is either the source or destination of a data packet, depending on the value of the token PID. Endpoint Field(4 bits):An additional four-bit endpoint (ENDP) field, shown in Figure 8-3, permits more flexible addressing of functions in which more than one endpoint is required. The endpoint field is defined for IN, SETUP, and OUT tokens and the PING special token. Cyclic Redundancy Checks: Cyclic redundancy checks (CRCs) are used to protect all non-PID fields in token and data packets. In this context, these fields are considered to be protected fields.All CRCs are generated over their respective fields in the transmitter before bit stuffing is performed. Similarly, CRCs are decoded in the receiver after stuffed bits have been removed. Data Field: The data field may range from zero to 1,024 bytes and must be an integral number of bytes. Figure 8-4 shows the format for multiple bytes. Data packet size varies with the transfer type. Types of USB Packets 1. Token Packet: A token consists of a PID, specifying either IN, OUT, or SETUP packet type and ADDR and ENDP fields. The PING special token packet also has the same fields as a token packet. Token Packet is initiated by the host and determines if the host will send or receive data. For OUT and SETUP transactions, the address and endpoint fields uniquely identify the endpoint that will receive the subsequent Data packet. Setup – Used to begin control transfers. Out – Informs the USB device that the host wishes to send information. For IN transactions, these fields uniquely identify which endpoint should transmit a Data packet. For PING transactions, these fields uniquely identify which endpoint will respond with a handshake packet. An IN PID defines a Data transaction from a device to the host. OUT
In the last blog we discussed what a keypad module is . In this blog we will be discussing how to interface a 4×4 membrane type keypad module with stm32 microcontroller. Although the keypad module can be configured using both polling and interrupt methods , in this blog we will be discussing the interrupt method as it takes less CPU cycles , also since interrupt doesn’t require constant CPU attention. Keypad module along with stm32 microcontroller finds applications in industrial machines as well various projects such as bluetooth door lock , scientific calculator etc. Hardware description The keypad module consists of 3 layers:- The top layer is made of polymer which usually is the printed graphic overlay . It defines the function of each button in the keypad module . It is heat and water resistant and also prevents from electric discharge. The middle layer that usually consists of dome shaped stainless buttons which upon touch makes contact with the bottom layer completing the circuitry. The bottom layer consists of printed circuitry made of conductive material such as silver or copper oxide. When a key is pressed the dome shaped buttons make contact which completes the circuit and this information is conveyed to microcontroller in the form of signal by the external ribbon. The 4×4 keypad module chosen by us consists of numbers from 0 to 9 along with 2 characters ‘*’ and ‘#’ in the first 3 columns while the last column consists of alphabets A, B ,C , D. The internal circuit diagram of the keypad module Internal Circuit Working Circuit Diagram As can be seen one end of each button is connected to a wire that is then connected to the connector pin as row and other end is connected to another wire which is the column wire. Both the row and column wires helps us pinpoint the button that is pressed. The connection are then made to the MCU in which the row part is configured as GPIO output and written high in our case this will be PA15, PB3, PB4 , PB5 pins the column part is then written as GPIO EXTI interrupt which will get triggered in case of a button push , this will be PB6,PB7,PB8,PB9 in our case . As can be seen in the figure since each row from one side is already HIGH once the connection is made by pressing the button this is read by the MCU pins PB6,PB7,PB8,PB9 and the interrupt is raised which is detected in the rising edge. Besides the keypad module connection UART1 is also enable as PA9 as TX and PA10 as RX This will be used to display the button pressed when the interrupt is fired using teraterm or similar software. ALGORITHM Configure pins PA15,PB3,PB4,PB5 as output pins with no pull up and low frequency Configure pins PB6, PB7,PB8, PB9 as interrupt pins with no pull up and interrupt detection on the rising edge Set the NVIC priority as 0 and enable IRQ Incoming interrupts are handled using EXTI callback function Initialize the UART1 function , configure the parameters and select PA9 as tx and PA10 as RX Hal tick function is called to use key debouncing and prevent unwanted input noise from the buttons 2 variables currentMillis and previousMillis are declared which prevents extra activations or slow functions from triggering the interrupts this is done by subtracting the former from latter and the difference should be greater than 10 Each row is written GPIO 1 and checked if the corresponding column is gpio 1 as well. in case both the conditions are satisfied the interrupt is raised and a keypress is detected The keypressed is displayed on Teraterm or similar software using UART1 SOFTWARE CONFIGURATION Open the stm32cube ide and configure the sys mode, select the debug as serial wire and time base source as systick . In the GPIO section select the pins PA15, PB3,PB4, PB5 as output pins set parameters to default which is GPIO pins to no pull and operations at low frequency . Next select the pins PB6,PB7,PB8,PB9 as EXTI interrupt pins also in the NVIC section enable the line EXTI line [9:5] interrupts .Also configure the GPIO EXTI as interrupt rising which would read the occurrence of the interrupt on the rising edge of the wave and operation as low frequency . The NVIC priority is set to 0 (the highest) and the IRQ is enabled. All the button or key presses are handled by HAL_GPIO_EXTI_Callback function in which the keydebouncing is applied and each row is written GPIO HIGH incase a button press the respective column goes high as well raising the interrupt and the corresponding key is displayed using UART .for eg-The button press such as key 9 is detected when both PB3 and PB7 is HIGH as due to the press a connection is made and an interrupt is raised. Also in the connectivity section select the UART1 set the parameters such as mode to asynchronous , baud rate 115200, Word-length as 8 bits , Stop bits as 1 , mode as TX and RX , hardware flow control as none and oversampling rate as 16 . The UART1 has pin PA9 as TX and PA10 as RX . The uart is used to display the key that is pressed on a teraterm or similar software with baud rate set to 115200 SOFTWARE CONFIGURATION CODE #include “main.h” #include #include /* Private includes ———————————————————-*/ char buffer[32]={0}; /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ /* Private typedef ———————————————————–*/ /* USER CODE BEGIN PTD */ /* USER CODE END PTD */ /* Private define ————————————————————*/ /* USER CODE BEGIN PD */ /* USER CODE END PD */ /* Private macro ————————————————————-*/ /* USER CODE BEGIN PM */ /* USER CODE END PM */ /* Private variables ———————————————————*/ UART_HandleTypeDef huart1; /* USER CODE BEGIN PV */ GPIO_InitTypeDef GPIO_InitStructPrivate = {0}; uint32_t previousMillis = 0; uint32_t currentMillis = 0; uint8_t keyPressed = 0;
Table of Contents What are Keypad Modules ? Keypads are input devices that most of us are familiar with that help us communicate with a machine , by pressing a set of buttons or keys and giving it a set of instructions to perform tasks.We see them at ATMs, Phones,,military, even Refrigerators , Vending Machines etc constantly evolving and changing over the years such as membrane keypads,dome-switch keypads, capacitive touch keypads etc. Keypad modules are basically sets of buttons , keys or switches arranged in rows and columns in matrix form which establishes a connection when a button is pressed and this information is transmitted to the machine.Keypads play an important role in human machine communication be it an operator in a factory or a child buying a beverage from a vending machine . But all these variety of applications of the keypads showcases the different types of keypads and the technologies they employ. Types of Keypad Modules 1. Membrane type Membrane type keypad modules are most commonly used in commercial applications as well as household appliances such as refrigerators , coolers, calculators etc. They are made of 3 layers : The top layer that consists of labels and printed text justifying the function of that particular key they are made up of polyester or polycarbonate materials hence the printed material lasts for a long time. This is the only layer that is visible to the user.This layer also prevents charge discharge and is water as well as heat resistant. Space layer that comprises the button which is usually made of stainless steel . They usually have a dome structure that helps them make contact with the bottom layer . Bottom layer that consists of the conductive material, usually silver or copper oxide. The parts where there is a chance of short circuit are painted with a dielectric. When the user presses a key the stainless steel button and the bottom layer comes in contact completing the circuitry which is then sent to the external ribbon as a signal . The size of these layers are as thin as membrane hence the name membrane. Each of the layer is a half of the circuit that is connected to the external ribbon which acts as a communication path between human machine interface. PCB Type The PCB type keypad module consists of a PCB which is designed in such a manner that connections are made between each row and column on which mechanical push buttons are soldered . The connections between rows and columns are then finally ended on the 8 connector pins which are connected to the machine to identify the location of the button pressed.These can be customized as per the need. They are widely used in the phones and cheaper , easy to install and have a relatively long life. Capacitive type The capacitive touch type keypad module as the name implies uses the change in capacitance upon application of the touch as a measure to detect the human interface . The human finger acts as a dielectric which increases the capacitance . This increased capacitance causes an increase in the charging and discharging time which is monitored and classified as touch. These are often used over their counterparts such as resistive type which are slower and less smoother.Since change in capacitance is involved these modules are also sensitive high levels of heat , light , temperature changes, liquid application etc. To counter the behavior of touch keypad modules under the exposure to the liquid the texas instruments keypad module uses mutual capacitance rather than self capacitance to classify a touch and distinguish false touches. Dome Switch It’s a combination of a flat-panel membrane and mechanical-switch keypad. They feature two circuit board traces embedded under a silicone keypad with a dome-shaped switch. These domes create tactile feedback when pressed, making them particularly useful in commercial and work-related applications. Furthermore, dome-switch keypads have a high level of reliability, often lasting for as many as 5 million cycles. Scissor switch type In this keypad module the keys are designed like scissors. They also have a rubber dome key such as in dome switch but they have improved functionality by keeping the keys connected together . They may have better functionality but they tend to be expensive and are high maintenance. They are different Scissor Switch type in the market but in general they have 3 layers. 4 x 3 The 4×3 keypad module as the name suggests consists of 4 rows and 3 columns . Even though as per the requirement the size of the matrix can vary in general the 4×3 are used in industry applications in which only numbers are required to be entered in the machine.Hence the first 3 rows consists of the numbers between 1-9 whereas the last last row consists of *,0,#. 4 x 4 Besides 4X3 the 4×4 keypad is also available in which there are 4 columns and 4 rows. In this besides the numeric values alphabets A, B , C , D are also available in the last column . This keypad module finds application in the security system , industrial control system applications, data entry systems etc. How does Keypad Modules works ? The module usually consists of graphic overlay the part of the module that is visible to the user, It is usually made of polycarbonate or polyester materials that are highly customizable depending on the requirement . The material used makes the printed character to last longer. It also consists of an internal polymer layer which house the internal circuitry and protects from electric discharge and is also heat and water resistant Inside the polymer layer is the button mesh layer usually made of stainless steel dome like structure and second layer of embossed circuitry usually made by printing copper or silver oxide with some dielectrics to prevent short circuit Both these layers are halves of the internal circuitry that completes the circuit when the user presses the button
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.
In the new age of autonomous and connected vehicles, cyber-attacks in automotive are happening frequently. Discover in this blog, what technology is used to make our vehicles safe and secure.
Automotive Development board to enable hassle free learning and development across multiple automotive technologies
Overview So hello guys, welcome to series of Microcontroller tutorials. As Microcontrollers are big thing happening across the globe, but to learn about microcontrollers becomes quite challenging as most of the content on web is theoretical based and quite unorganized. Or the content is only roaming around 2-3 microcontrollers (Arduino, ESP or PIC), even though there are number of Microcontrollers of different vendors. Also, framework of Arduino and Arduino IDE hides most of the things that are going inside the microcontrollers. Would recommend viewers to read these 3 blogs in order, so as to get understanding on how to get started with any Microcontroller and in what order. How to start with Microcontrollers? – gettobyte Hardware Development Kit In Mcrocontrollers – gettobyte Software Development Kit In Microcontrollers – gettobyte Here at Gettobyte, you will get content on microcontroller tutorials for different vendors in chronological way and covering the topics, in a much more interesting and story kind of way to make people understood easily. NXP Semiconductors – gettobyte Nordic SoC – gettobyte STM32 MCU’s – gettobyte Texas Instruments – gettobyte Silicon Labs – gettobyte AVR MCU – gettobyte ESP SoC – gettobyte Which will help you to learn important skills to build you Carrer on Semiconductor Industry and also help you in product development/DIY projects for different Industries, so as to make embedded devices with Industry standard Microcontroller. In return what Gettobyte platform seeks is that if you find these blogs insightful, then share it with people so make the reach more. And provide with constructive feedback and reviews in blogs comment section . If you guys want to start with microcontroller coding and looking for chronological order, then you have come to right place. In the last 2 blog: we get to know a lot about microcontrollers and how to start with them. And Hardware Development KIT in microcontrollers. One of the essential and important things to know before starting with microcontrollers is Software Development Kit. So, let’s start with it. In this blog we are going to start with another essential and important things to know before starting with microcontrollers that is Software Development Kit (SDK). Objective of this blog Objective of this blog, will be to understand: What is Software Development Kit in Embedded (SDK). Different components in Software Development Kit in Embedded. Why there is need of Software Development Kit in Embedded. What is Software Development Kit? Software Development Kit in embedded is collection of Software tools and applications, Software libraries, documentations to program the microcontrollers via host computer. Software Development Kit(SDK) majorly include: Software Stack for Microcontrollers Code Configuration Tools Software Debugging Tools Software drivers for debuggers and programmers. Integrated Development Environment (IDE) Software Stack for Microcontrollers Microcontrollers are not only hardware devices, but there is also very good amount of software used in microcontroller to run them, which are termed as software stack for microcontrollers. Software stack for microcontrollers can be divided into following components: Peripherals Drivers/Real Time Drivers: for using the peripherals of microcontrollers. This software controls the registers of microcontrollers to configure, enable, disable and use the different peripherals of microcontroller. Every MCU vendor design and develop these Drivers for their corresponding microcontroller. so that application developers can directly start with application development instead of creating these drivers on own. These drivers are kind of bare metal programming, as it is register level programming. which are written using C/CPP language using the concepts like Functions, loops, variables, static, user defined data types (typedef, Enums, structures), arrays and etc. For e.g. NXP semiconductors has S32K Standard software stack for its S32K1 Microcontrollers. Texas Instruments has Miscellaneous Stack: Peripheral Drivers is stack to drive the microcontroller peripherals, but with these peripheral drivers their is use of other embedded software technologies to build complex and real time applications like RTOSes(FreeRTOS, ChibiOS, Mbed and etc), IoT protocols Stacks( WiFi, BLE, Lora, LwIP, MbedTLS,and etc), Bootrom(openBLT), Sensor & Module drivers, crytography stack for providing security and safety in embedded applications, mathematics or signal processing algorithms stack for doing complex calculations. These all are also written using C/CPP language and it requires knowledge of programming along with hardware knowledge too. Peripheral Abstraction Layer/Hardware Abstraction Layer: This software stack is for code portablity and modularity in microcontrollers. Their are so many microcontrollers out their and for every MCU their is different peripheral driver. So if we change the microcontroller in our application, we need to rewrite the code of our application. This can be very cumbersome, there is need of some form of abstraction layer, through which our application end APIs remain same and just low-level driver files has to be changed if hardware is changed. This is done through the concept of C/CPP programming with use of programming concepts like, Classes, Structures, function pointers, templates, MACRO definition, linked lists and etc. In the large code bases like Autosaur and Ardupilot, Code portability is very essential, and use of Abstraction layers are heavy implemented through advance programming concepts like that of OOPS. For the starting we would just be needing peripheral drivers and abstraction layer stack of microcontrollers. These are provided by corresponding microcontroller vendors. // Examples of different peripheral drivers of MCU’s Code Configuration Tools As told in above sections there are many software stacks used in microcontrollers, so to design and develop the code using these software stack from scratch would be very cumbersome. As we need to include files for every stack and necessary configuration has to be done for building and compiling the code. So Code Configuration Tools are the software tools, which provide GUI based interface and environment to configure the software stack. We just need to select the hardware(microcontroller), what features we need and what all software components and peripheral to be enabled and then click on a button to generate the code. These tools then generate all the base software automatically from startup code to make files for the configured project. The features of CCT includes Graphical User Interface (GUI), tools for configuring peripherals, code generation and project building. In
Overview So, hello guys, welcome to Gettobyte website. This blog is part of the Microcontroller coding series on NXP Semiconductors S32K144 MCU. Objective of this series is to learn Microcontroller technology by getting knowledge on how to do microcontroller coding. And for doing so we would be proceeding with NXP Semiconductors S32K144 Microcontroller. To know about this Microcontroller and reasons for selecting this MCU, it would be nice to have a look onto this blog. There are many things in Microcontroller to learn and often it becomes very cumbersome and overwhelming from where to start and how. So, in This Microcontroller coding series we would be moving step-by step. Starting From Application side: that is peripherals of MCU and then rooting back to inner details of microcontroller. Dot worry just hold back your nerve, subscribe to channel newsletter and follow the series. Table of Contents Objective of the Blog Now one of the first thing that is needed for doing Microcontroller coding is the Integrated Development environment (IDE). NXP Semiconductors, provide its own IDE for doing microcontroller coding on S32 series of controller, that is S32 Design Studio. So, at first, we would be covering what is S32 Design Studio and How to use it. As throughout the microcontroller coding on S32K144 MCU, we would be using this IDE for doing hand-on practical programming to learn/understand things. We have divided S32 Design Studio in 3 blogs for covering all things in chronlogical and story format so as to make things in interesting and fun way. Below are the links for using S32 Design Studio. Getting Started with S32 Design Studio Part 1 – gettobyte Getting Started with Design Studio Part 2 – gettobyte Getting Started with S32 Design Studio Part 3 – gettobyte The motive of this blog is to: IDE and Software Installation: SDK download/Development tool download/S32 Extensions & Updates. Making a Project: Importing project from example/making project from scratch/Opening already developed code. Project Configuration and Settings What is S32 Design Studio IDE S32 Design Studio is a C/C++ development platform, for programming NXP S32 microcontrollers and microprocessors. The C/C++ development platform of S32 Design Studio is itself based on Open-Source Eclipse IDE, which provides the features like Text Editor: for writing the code, Views: for showing information about the code, Perspectives: for providing the functionality to do specific types of tasks and advanced C/C++ code base navigation/development features. It is an, Integrated Development Environment (IDE), for programming and debugging of ARM and Power Architecture-based S32 Microcontrollers. Just like Arduino IDE is there for programming Arduino, same way S32 DS is used for programming S32 Automotive microcontrollers of NXP Semiconductors. S32 Design Studio IDE comes in 3 Variants: S32DS for S32 Platform, S32DS for ARM, and S32 DS for Power Architecture. The major difference between these IDEs is the support of S32 MCUs. As shown below pic: We will be focusing on S32 Design Studio for the S32 Platform, as it supports the majority of S32 Microcontrollers. So throughout the blog by S32 Design Studio we will be referring to S32 Design Studio for S32 Platform. S32 Design Studio has specs as follows: S32 Design Studio is based on Open Eclipse IDE, and it supports the GNU GCC compiler. Green Hills, IAR Compilers, and ARM processor toolchain. S32 Design Studio has a text editor for writing the programs, with C/CPP programming widgets and modules. S32 DS is a modular IDE in which there is support for many embedded programming features in the form of different perspectives. S32 Design Studio also has a Code Configuration Tool S32 CCT, for selecting and configuring the peripherals of selected S32 microcontroller Via Graphic User Interface, making it easy to write the application and quickly. S32 Design Studio also has compiler support of GNU GCC, so that we can directly build and compile the code from IDE via its GUI Interface to generate the elf of our program written. Also, S32 Design studio has support of programming and debugging the generated elf into the hardware. It supports drivers for Jlink and PEmicro debuggers/programmers. It supports GDB and Openocd software debugging, these are the software packages that are required to program and debug the ARM Processors. S32 Design Studio has features like: peripheral configuration tool, code generation tool, compilation-linking of C/CPP programs and Debug features for NXP S32 microcontrollers and microprocessors. S32 Design Studio IDE and Software Package Installation Software Installation Part can be divided into 2 parts. First is S32 Design Studio IDE Installation and other is Microcontroller software development package and SDK Installation. In the first part we are just going to download the required IDE into our host laptop/computer and in second part we will install some plugins into our IDE to make it suitable for our microcontroller. As we are using S32K144 MCU and it belongs to S32K1 family, so development package and environment for S32K1 family would be installing. One can take this step analogous to step in Arduino, in which we need to install some extra packages and setup the environment for ESP controllers. S32 Design Studio IDE Installation: Navigate to NXP Website: Automotive, IoT & Industrial Solutions | NXP Semiconductors On the search bar, search for S32 Design Studio Then click enter and select the first selection: S32 Design Studio IDE from the list. Now in the new window that opens, as you scroll down one can see there are 3 editions of S32 Design Studio. We are going to use S32 Design Stuido for S32 Platform, so click on that one. After this, page of S32 Design Studio for S32 Platform would be loaded, like this. Now before Downloading, we need to login with our Email-ID to NXP website. So, click on Sign-in/Register option on the top right.  Create an account NXP or Login to your account if you are already registered. It’s a simple and usual sign-in process. One thing to note, there is no compulsory need of professional or business email-id for registering at NXP Website. One
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 Industrial Automation Automotive Avionics: Wearable Technology 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 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