Embedded Basics Miscellaneous

Table of Contents

Communication Protocols in Embedded System

  • Serial communication

In serial communication, we have only one line for transmitting and receiving data which is why it is half-duplex. It is best for high frequencies as it uses only a single bus or channel for communication, but it can be a bit slower than parallel as it sends only a single bit per clock pulse also because of the single wire here we have fewer chances of cross-talks. It can detect the error as well.

When transferring a bit quick change in voltage are required like for 5v OS, 0 bit communicated as a short pulse is 0v, and 1 bit communicated by a short pulse of 5v. In serial communication, the first bit is the most significant bit and the last one is the least significant bit.

  • Parallel Communication

In parallel communication, we have a number of lines or buses equal to the number of bits we are transferring. We call it full duplex as the line for transmitting and receiving bits is different. It is faster for small frequencies as all bits are sent at once but as we have to use multiple wires it is costlier also here, we have lots of chances of cross-talks.

As in serial, here also we have the first bit is the most significant bit and the last one is the least significant bit.

How do they convert?

The protocols we have read above communicate in serial form, but they get the data from their peripheral device in parallel form. How do bits get converted into serial form to parallel form? Suppose we have 4 bits, to convert them from parallel to serial we need a Parallel to Serial converter, In the same way, if we want to convert parallel from series, we need a serial to parallel converter. Here comes the D Flip-Flop which is specially designed for such conversions.

What is Flip-Flop?

A basic memory element or basic digital memory circuit is known as Flip-Flop. It is some medium in which one bit of information (1 or 0) can be stored or retained until it\’s necessary.

  • As one flip-flop can store one bit of information. To store multiple bits, we need multiple flip-flops.
  • The group of flip-flops, which are used to store the binary data is known as register.

Flip flop circuits are classified into four types based on their use:

  1. D-Flip Flop
  2. T- Flip Flop
  3. SR- Flip Flop
  4. JK- Flip Flop.

Here for conversion between Serial and parallel bits of data D-Flip Flop is used.

Now, what is D Flip-Flop?

D flip-flop is also known as Data or Delay Flip-Flop. It has a single D input and a clock input C which is why we call it a D flip-flop. Or for the word delay, it describes what happens to the data at input 0. The data at D input is delayed by one clock pulse before it gets to the output Q.

There are two different ways of conversions:

  1. Parallel to Serial conversion.
    • First, we need Flip-Flops equivalent to the number of bits. Then we will put the multiplexer in between the Flip-Flop.

    Multiplexer- It is a combinational circuit that takes input from one of many input lines(parallel) and directs it to a single output line(serial).

    It has two inputs:

    1) From the previous Flip-Flop

    2) From Parallel bit data.

    Now we will load the data which will be transferred one by one.Here msb will be transferred first.

  2. Serial to Parallel conversion.
  • First, we need Flip-Flops equivalent to the number of bits. This time we won\’t put the multiplexer in between the Flip-Flop.
  • We need to store all the bits at first for this we will pull the clock signal low. Once all bits are loaded, we will pull the clock signal high, and it will shift the LSB to the input of Flip-Flop 1 and output of Flip-Flop 0. Same way all bits gets transferred.
  • Now all the bits are stored in these Flip-Flop and as shown above all the Flip-Flop will transfer the bits at once the way it happens in parallel..

Overview about Serial Communication Protocols in MCU

UART Protocol

  • What is UART Protocol?

UART stands for Universal Asynchronous Receiver/Transmitter. As we can understand by the name it says it receives and transmits asynchronously. Asynchronously means it doesn\’t use clock pulse to synchronize the transmitter and the receiver.

In UART, the transmitter takes the signals in parallel from a controlling device[ex-CPU] then it sends the bits to a receiver in serial then the receiver converts those bits in parallel again. UART follows one master one slave approach as it uses only 2 wires for communication. It has one transmitter and one receiver.

  • How does it work?

As I, ve mentioned above it transmits asynchronously hence it uses a start and stops a bit, in it contains main data and a parity bit. The parity bit is only needed if the device needs to check the error.

When the device wants to start the communication, it pulls the transmitting line low which means it sends a 0 bit and receiving device understands that the transmitter wants to send the data. When the transmission line goes lows it stays low for one clock pulse and then it starts sending the data of 8 bits then the 9th one is a parity bit, the last one is stopping bit it stays high for the one clock pulse until the transmitter sends a low bit to start another frame.

To get, in detail understanding on UART Protocol, refer to this blog.

UART Protocol in Embedded System

SPI Protocol

  • What SPI Protocol is?

SPI stands for Serial Peripheral Interface. Just like UART it also uses Serial Communication for transmitting and receiving data but instead of asynchronous it uses synchronous communication protocol for transmission. 

Synchronous means the transmitter and the receiver must have the same clock signal. It uses a Full duplex communication protocol which means it can send and receive at the same time. SPI follows one Master multiple slave configuration.

  • This protocol has 4 parts

1. MOSI-Master Out Slave In

Here Master sends data to the slave and the slave receives the data. Master sends data to each device it is connected to via a single wire.

2. MISO-Master In slave out

Here Slave sends the data to the master and the master receives the Data. Master receives the data from each device it is connected to through a single wire.

3. CLK-Clock Signal

It is important for synchronizing the data when the master sends or receives it.

4. CS/SS-Chip select/slave select

We have different wires connected to the chips. Suppose we have 3 chips connected. Then the master would have three wires cs1,cs2,cs3 connected from chip1, chip2,chip3 individually.

To get in detail understanding on SPI Protocol, refer this blog.

SPI Communication in Embedded

I2C Protocol

I2C stands for the inter-integrated circuit. If you have read carefully about SPI and UART you will find I2C got the best features of these two.

It follows multi-master protocol as multiple masters through a single slave or to multiple slaves. It is a half-duplex communication protocol since it has only one line for transferring and receiving data. It is also called Two Wired Interface as it uses two wires for communication.

  • This protocol has 2 parts
  1. SDA: For sending bits
  2. SCL: For synchronizing the data.
  • How does it work?

In I2C as we have multiple slaves, every slave must have a different address before sending a bit master will address or call the receiver. If we have multiple masters then the master will check the clock signal. If it is high it will send the data or if it is low then it means another master is sending the data at the moment.

To get more in detail understanding of I2C protocol, refer to this blog.

 

Conclusion Para

  1.  In the end, if you want to use two devices then UART works best and fastest.
  2. If you have multiple slaves and one master then I would suggest going for SPI 
  3. And if you want to connect one slave with multiple masters then I2C is the fastest as it lowers the wirings as well.

Other blogs to explore

About Microcontrollers

W25Q128JV SPI Flash Memory: Part3

Table of Contents So continuing with the blog series of, W25Q128 SPI based flash memory\’s , in the previous blogs W25Q128JV SPI Flash Memory: Part1 | gettobyte  W25Q128JV SPI Flash Memory: Part2 | gettobyte we have gone through the introduction and overview for W25Q128JV  flash memory\’s. From this blog we are going to start with the Application and Device driver development of W25Q128JV IC. The Driver which i am going to develop in this blog will be generic can be used with any MCU, by just replacing the SPI API\’s. This application driver will be generic and simple one which will be having API\’s to perform basic Operation on this chip. We will be creating the 2 files, header file and source file(.h &.c) for W25Q128JV Application driver. Header file(.h) will be having all the Macros, Typedefs, Enums, Structures  and function declarations. Source file(.c) will be having all the function definitions and local variables to be used in the driver. Header file (W25Q128JV.h) First thing that we are going to do is define the Object like Macro\’s for all the registers of W25Q128JV in the header file(.h) of W25Q128JV. Macros are widely used in Embedded Programming for referring the registers address with the acronym of the Register names, so that it is easy for developer/user to understand the code or using the API.  Like, above if we want to read the JEDECID of the chip, instead of writing 0x9F in the Application code we can pass the Macro JEDECID. (Though we are not going to use all the registers of W25Q128, as in this blog we are just going to make the driver for following features. The Application driver will be having API\’s for reading-writing the data, erasing the data, reading-writing of Status registers, reading JEDEC ID , chip erase and chip initialise.) /* * w25q128jv.h * * Created on: 15-Apr-2021 * Author: kunal */ #define WriteEnable 0x06 #define WriteDisable 0x04 #define Dummybyte 0xA5 #define ReadSR1 0x05 #define WriteSR1 0x01 #define ReadSR2 0x35 //0x35: 00110101 #define WriteSR2 0x31 #define ReadSR3 0x15 #define WriteSR3 0x11 #define Write_Enab_for_Vol_status_regist 0x50 #define ReadData 0x03 #define WriteData 0x02 #define ReadDataFast 0x0B #define JEDECID 0x9F #define UinqueID 0x4B #define SectErase4KB 0x20 #define SectErase32KB 0x52 #define SectErase64KB 0xD8 #define chiperase 0xC7 #define reset1 0x66 #define reset2 0x99 #define read_addr1 0x020000 #define read_addr2 0x030000 #define read_addr3 0x040000 #define BUSY_BIT 0x01 #define WRITE_ENABLE_LATCH 0x02 Next thing in Header file will be the function definitions that would be used for interacting with the W25Q128JV flash memory\’s. void W25_Reset (void); void WriteEnable_flash(); void W25_Read_Data(uint32_t addr, char block[], uint32_t sz); void W25_Write_Data(uint32_t addr, char block[], uint32_t sz); uint32_t W25_Read_ID(void); void W25_Ini(void); void erase_sector4KB(uint32_t addr); void erase_sector32KB(uint32_t addr); void erase_sector64KB(uint32_t addr); void chip_erase(); void Uinque_ID(uint8_t uinque[]); void WriteSR(uint8_t SR_address, uint8_t SR_data); uint8_t ReadSR(uint8_t SR_address); void WaitForWriteEnd(void); Apart from Object like Macro\’s and Function definition\’s their would be 2 additional function like Macro\’s. //For STM32 CUBEMX #define cs_set() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_4,GPIO_PIN_SET) #define cs_reset() HAL_GPIO_WritePin(GPIOA,GPIO_PIN_4,GPIO_PIN_RESET) //For STM32 BareMetal #define cs_set() GPIOA->ODR |= GPIO_ODR_ODR4; #define cs_reset() GPIOA->ODR &= ~GPIO_ODR_ODR4; As we are going to interface the W25Q128JV via SPI peripheral to our MCU\’s, in which MCU would be the Master device and W25Q128JV would be slave device. And in SPI -> Chip Select/Chip Enable pin is used for selecting the slave. Thus these 2 Macro\’s would be used for selecting the slave before the SPI instructions are send ( by using the cs_set()) and then deselecting the slave after the SPI instructions( by using the cs_reset()). Source file(W25q128JV.c) This file would be having all the function declarations of the functions which are defined in (W25Q128JV.h). The 2 most important API\’s which will Send and Receive the SPI commands are: void SPI1_Send (uint8_t *dt, uint16_t cnt) { HAL_SPI_Transmit (&hspi1, dt, cnt, 5000); } void SPI1_Recv (uint8_t *dt, uint16_t cnt) { HAL_SPI_Receive (&hspi1, dt, cnt, 5000); } API\’s Explained for Device Driver of W25Q128JV: void SPI1_Send () This function is wrapper for transmitting the data via SPI. not be used directly in Application driver, but it will always be called by Other API\’s of the driver to send the command to W25Q via SPI. It has 2 parameters: 1) uint8_t *dt –>pointer to store the data that will be transmitted from the Host MCU to W25Q128JV. 2) uint16_t cnt –> Variable that will be storing the size of data that has to be transmitted from MCU to W25Q128JV. void SPI1_Send (uint8_t *dt, uint16_t cnt) { HAL_SPI_Transmit (&hspi1, dt, cnt, 5000); } void SPI1_Recv() This function is wrapper for receiving the data via SPI. This API is also not used directly by the Application Driver, but will be used by the other API\’s of the driver for receivng the data from W25Q via SPI. It also has 2 parameters: uint8_t *dt –> pointer to store the data that will be received from the W25Q128JV. uint16_t cnt –> variable that will be storing the size of data that has to be received. void SPI1_Recv (uint8_t *dt, uint16_t cnt) { HAL_SPI_Receive (&hspi1, dt, cnt, 5000); } void W25_Reset(): W25Q SPI flash Ic\’s come in small package and they have limited number of the pins. Thus W25Q provides the software reset instruction feature. User/Developer can reset the W25Q by sending the specified instructions to W25Q  via SPI. After reset the device will come to its default state and loose all volatile content. Enable reset – 0x66( reset 1 macro) and Reset – 0x99( reset 2 macro)are the instructions that has to be send for generating the software reset. These 2 instructions has to be send in sequence, as any other command after the Enable reset command( 0x66) apart from Reset(0x99) will disable the reset procedure. Once the reset command is accepted it woulfd take approx 30us to reset the W25Q IC. void W25_Reset (void) { cs_reset(); tx_buf[0] = reset1; tx_buf[1] = reset2; SPI1_Send(tx_buf, 2); cs_set(); } void WriteEnable_flash(): In W25Q, before writing to any Page, Erasing any sector/block or performing full chip erase. We have to send the Write enable Instruction via SPI.

Read More »

BootLoader EXPLAINED!

What is BootLoader(BL)? The bootloader is a small chunk of code that gets executed when the MCU powers on or resets. Its main function is to manage the initial startup process, including any necessary checks or updates before the main application code runs. How BootLoader(BL) is different from Application Software? Application Software is the function-specific code that you program to perform an MCU-based task(like controlling the motor, displaying information, etc,). But you must be thinking or saying, that your application software also behaves pretty same as bootloader cause everytime you start/reset MCU, it will restart your application code from the beginning, right? But there’s a quite crisp gap between this BootLoader and Application Software which can broaden your understanding of bootloader and application software. Let’s divide this crisp gap into 3 sub-domains: Memory Allocation: If I talk about memory occupied by BL and Application Software. The first thing would be where are these two located and in which memory, answering that, BL is located at the beginning of FLASH memory and it always has some reserved space only which is also write-protected(Thinking why write-protected because to prevent accidental overwriting during normal operation) whereas application software is also stored in FLASH memory only but it’s below the space allocated to BL. Execution Flow: Upon power-on or reset, the microcontroller’s program counter starts executing code from the beginning of the flash memory, where the bootloader is located. After the bootloader completes its tasks (like, checking for updates, and validating the application), it will typically jump to the application’s start address (which is known and fixed in the bootloader code) to begin executing the application. Update Process: A well-developed bootloader can help you even in handling firmware updates. It can receive new application code, erase the old code, and write the new code to memory. The application cannot typically update itself. It relies on the bootloader to manage this process. The application’s major focus is on running the device’s features and does not deal with the update or integrity checks. Let’s understand with a analogy Taking an analogy with our expertise field of automotive embedded systems. Considering ourselves as an OEM, we have been reported a problem. A software bug is discovered in the ECU that controls the braking system. This bug causes the braking system to occasionally misbehave under specific conditions, such as when the vehicle is driving downhill. Diagnosing this issue requires an early solution because the bug needs to be fixed quickly to ensure the safety of the vehicles on the road. During the update of this bug fixing, the vehicle’s battery drains, and the update process is interrupted: With a Bootloader: When power is restored, the bootloader detects that the application firmware is corrupted or incomplete. It can either retry the update automatically or revert to a backup firmware version, ensuring the vehicle remains operational and can be updated again. I agree in this condition driving is not safe, but at least the car can operate so that it can be driven to repair with full caution. Without a Bootloader: The ECU might attempt to boot the corrupted application, resulting in a system crash or malfunction. The vehicle may not start or may exhibit erratic behavior, requiring a technician to manually intervene and repair the ECU, which could be time-consuming and costly. EDIT: Just found another real-life example. As we all know windows push too much of FOTA(Firmware Over-The-Air), out of which some take too much time to restart and some get applied with restart. Now you must have seen this screen will update. This “DON’T TURN OFF YOUR COMPUTER” message is also displayed for the very same reason, how power disruption can lead to the bricking of your laptop. But you must be curious what exactly what will happen if I cut off the power supply, and power up the device again, right? As a bootloader function, this interruption will be acknowledged and the bootloader will roll back to the previous functional update. You might see below mention image on start-up. IMPORTANT: Avoid trying this at home, this maneuver costs us to retrieve the data but unfortunately all core OS files and applications were corrupted and no longer responded for usage, we tried some troubleshooting using the window troubleshooter, but it wasn’t effective. At last, we installed a completely fresh OS from scratch.  I would expect that you have completely understand the “WHY” and “WHAT” of BootLoader. Now, it’s time to understand the “HOW” of bootloader. Important Terminology in BootLoader Memory Management Memory management is quite an interesting concept that can also help in relating to real-world applications. As we understand the chronology of the working of a bootloader, which is firstly a bootloader will get which now will be followed by application software. Now basically there can be different executions of application software, let’s brief all possible ways: Executing Directly from Flash Memory: This specific condition is noticed in most of the embedded MCUs where the bootloader and application software are placed in FLASH memory only. Flash memory is non-volatile, meaning it retains data even when the power is off.  Copying to RAM Before Execution: In some cases, the application code might be copied from flash memory to RAM before execution. This approach is more common in systems where high performance is required or where the flash memory is slower than RAM. The major reason behind using RAM for execution, RAM is typically faster than flash memory. Overlaying: In systems with limited RAM, overlaying is a technique where only a portion of the program is loaded into RAM at any given time, with different parts of the program being loaded and unloaded as needed.  Virtual Memory Techniques: This specific technique is very common nowadays you must see that recent smartphones have this feature called RAM EXTENSION, where a portion of storage is accumulated to RAM for its R/W access. Parts of the application can be swapped in and out of physical RAM as needed. Such strategies

Read More »
Electronics
Kunal Gupta

HOW TO START WITH PCB DESIGNING?

Hello Friends, I’m Taral Mehta. I\’m an Electronics Engineer, This is the first blog of the series to discuss and learn the basics of PCB designing. In this blog, we will discuss, Introduction of PCB and its designing techniques. As well as we will discuss various software that are used for designing the PCB. Table of Contents Starting with Basics of ELectricity Before going to start with PCB designing, we will understand the basic components required: Current – Current is the rate of flow of electric charge. at all points in a series circuit, the current has the same value. If a circuit has a branch, the current flowing into the junction must equal the current flowing out of it.   Voltage – Voltage is also known as potential difference.In a circuit loop, the sum of the voltages across the power supplies is always equal to the sum of the voltages across the rest of the components. RESISTOR – Resistance is a measure of the opposition to current flow in an electrical circuit. Resistance is measured in ohms CAPACITOR – A capacitor is an electronic component that stores and releases electricity in a circuit. It also passes alternating current without passing direct current. Introduction to PCB (Printed Circuit Board) As an Engineer, whether is Mechanical Engineer, Computer Engineer, or IT Engineer, now and then everybody comes across one of the vital parts of the respective industry i.e. Electronic Circuit. This electronic circuit is made or created on a special type of board, which is called PCB (Printed Circuit Board). As you can see in the above image, PCB has electronic components which are connected through conductive pathways, which are usually called Tracks. A PCB is a thin board made of Fiberglass, composite epoxy or other laminate material. Tracks are etched or printed onto a board, which connects different components on PCB, such as Diode, Resistors, Capacitors and Integrated Circuits (IC). These blue and red lines going criss-cross are the Tracks, which form electrical connections between components. And these Yellow and grey objects are actually footprints or pads of components. I Know that tracks, via and Pads are new parameters for you but don’t worry I will give you a simple answer for your understanding. Traces or Tracks: A trace is a piece of copper, think of a wire, that makes an electrical connection between 2 or more points on a pcb. Traces carry current between these two points on the printed circuit board. You can see an image where RED and BLUE are tracked. Pads: Pads are small areas of copper in predetermined shapes normally used to make a connection to a component pin. Vias: A via is a physical piece of metal that makes electrical connections between layers on the printed circuit board. Vias can carry signals or power between layers using plated through holes. Using this technology a via is formed by drilling a hole through the layers to be connected and then plating the inner surface of the drilled hole. Vias should be sized according to the traces connecting between layers and ultimately how much power it must carry. I think You got a basic idea about what exactly a PCB is… correct? So let’s move further and discuss, What are the designing tools of PCB? PCB Designing Software 1) Eagle 2) OrCAD 3) Proteus 4) KiCad 5) Altium Designer 6) EasyEDA These are some of the famous EDA software presently available in the market. One can use any one of the above lists as per their convenience of use. These are some of the famous EDA software presently available in the market. One can use any one of the above lists as per their convenience of use.EagleorCadProteusKiCadAltium DesignerEasyEDA Previous Next Application: Medical and Healthcare Industry Illumination and Lighting Industry Consumer Electronics Industry Industrial Equipment Industry Aerospace Industry Automotive Industry Safety and Security Equipment Industry Telecommunications Industry Military and Defense Summary To summarize, in this blog first, we did an introduction of PCB. Then we discussed the basics of Electronics. We introduce the Basic Concepts of PCB like Schematic, PCB layers, etc. We discuss some of the PCB designing software and applications currently used in the market. References 1.http://www.pic-control.com/pcb-design-service/ 2.https://qualityinspection.org/electronics-videos-basics-pcb-pcba-smt-process/ 3.https://kitflix.com/how-to-study-pcb-design-getting-started-with-printed-circuit-boards/ 4.https://usa.pcbpower.com/application-and-use-of-pcbs.html  5.https://www.goldphoenixpcb.com/html/Support_Resource/arc_177.html Author: Kunal Gupta

Read More »
Getting Started
Kunal Gupta

Getting Started with Autosar MCAL Layer

Looking to learn Autosar Software Tech Stack?? Autosar MCAL Layer is the easiest and inexpensive way to start learning your automotive software journey that too with Handson DIY projects and not just theoretical way

Read More »
ARM processors
Kunal Gupta

ARM Coresight: Debug and Trace in Embedded System

Table of Contents Definition of ARM CoreSight \”CoreSight is the Debug Architecture from ARM for Debugging and Trace Solutions in Complex SoC designs (Single core and Multi core)\” CoreSight Provides all the Infrastructure that is required to Debug, Trace, Monitor, and optimize the performance of a Complete System on Chip (SoC)Design. The Debug and Trace Features of the ARM Cortex M processors (M3/M4/M33/M7/M0, etc.) are designed based on the CoreSight Debug Architecture. This Architecture Covers a Wide Area Including Debug Interface protocols, on chip bus for debug access, Control of debug components, security features, trace data interface and more. Debug and Trace in Embedded Systems By now one obvious question to beginners or newbies that must have come in their mind is what is Debug and Trace. What are these features for which we have a whole complete Architecture called CoreSight? Why do we need Debug and Trace solutions in our Processors/Embedded Controllers? Is it not? For those readers They can check out this blog, providing you clarity and understanding of all such questions. One can Understand Debug and Trace Feature/Functionality as one of the Block/Unit of the Processor. Just like We have UART, SPI, I2C, etc. peripherals for our Microcontrollers for which we have separate Block, Architecture, Peripheral Memory Registers for accessing them and Communication Protocol pins in our Microcontroller. Same Way-out Debug/Trace is one of the peripherals which is present in our Processor for which it has its whole architecture and above Marked things. ARM Processor has CoreSight Architecture. MIPS Processor has EJTAG Architecture. IBM PowerPC processor has COP. (Units/Block of the Processor are not called peripherals, I have used the above term just to make u understand the analogy) What are Debug Features?? Features are used to observe or modify the state of parts of the design. This is also Called Invasive Debugging Execute instructions line by line function i.e., halting the processor after execution of each line of code(single stepping). Execute Instructions Function by function i.e., halting the processor after execution of each functions (Step Over) Return from the Function (Step Return/Step Out) Stop the processor (halting) Stop the Processor at a particular à line of code (called Breakpoint) àmemory address (Called Watchpoint) à coded condition of a variable or memory address is achieved (Conditional Breakpoint/Watchpoint) On can control the program execution (By points 1-5)so as to examine(Both read or Write) the change in value of bits of the MCU Peripheral registers and Core Processor Registers (like examining the contents of UART peripheral Registers to mark at which line of code data is received or transmitted by seeing the UART Status registers which has corresponding bits to indicate the event of receiving and transmit data). Debug frequently involves halting execution once a failure has been observed and collecting state information retrospectively to investigate the problem. There are 2 Communication Protocols For using Debug Features: SWD & JTAG JTAG is an industry Standard protocol (IEEE 1149.1) which is used for debugging and boundary scan testing. It is the de facto Serial Protocol which is present in almost every Processor Family other than ARM also like AVR 8 core, MIPS, PowerPC, etc. To be noted down: JTAG Requires 4 pins: TCK, TDI, TMS, TDO; the recent signal TRST is optional. ARM CoreSight Technology introduced the 2 wire Protocol SWD (Serial Wire Debug): SWCK and SWDIO which is used for Debugging all the ARM based Processors. The Serial Wire debug(SWD) protocol provides the same debug access features and supports parity error detection, which enables better reliability in systems with higher electrical noise. Therefore, the Serial Wire debug protocol is more favorable then JTAG Interface. Also, SWD and JTAG debug protocols share the same Connections: TCK and SWCL use the same pin, TMS and STDIO use the same pin.  The SWD port alone does not allow real-time tracing. What are Trace Features?? Trace refers to the process of capturing data that shows information about how the components in a design of a firmware are operating, executing, and performing. This is also Called Non-invasive Debugging. It is real-time (with a small timing delay) and can provide a lot of useful information without stopping the processor. Information like: Amount of execution time for each function(Statistical Profiling) Call hierarchy and execution time sequence of functions Event Execution timing(Timestamp) Clock cycles taken for execution of a particular Instruction. Examine or change the contents of the memory or peripherals at any time, even when the processor is running. This feature is often called on-the-fly memory access. Data Trace(Monitoring the Variable or Memory address in Real Time execution of Code  and Plotting their graph). Instruction Trace(information about Instruction execution of a Core)ETM & PTM). Instrumentation Trace (Printf () Statement via ITM). System trace Trace is an advanced version of Debugging as it analyzes the performance of our firmware code and how efficient it is in terms of memory and efficiency by capturing the various kinds of data when the CPU is running. For Trace features there are 2 Modes: 1 Serial-Pin model called Serial Wire Viewer à Using Serial Wire Output (SWO) with Serial Wire Debug (SWD) interface. The Serial Wire Output (SWO) pin can be used in combination with SWD. It is used by the processor to emit real-time trace data, thus extending the two SWD pins with a third pin. The combination of the two SWD pins and SWO pin enables Serial Wire Viewer (SWV) real-time tracing in compatible Arm® processors.  The Serial Wire Viewer (SWV) is a real-time trace technology that uses the Serial Wire Debug (SWD) port and the Serial Wire Output (SWO) pin. The Serial Wire Viewer provides advanced system analysis and real-time tracing without the need to halt the processor to extract the debug information. 2 Multi-pin Trace Port interface (4 data pins + 1 clock pin). For Capturing the Data There must be à  Source for generating the Trace data àSinks are the endpoints of trace data à Links provide Connection, triggering and flow of traced data between

Read More »
Kunal Gupta
Author: Kunal Gupta

Author

Kunal Gupta

Leave a comment

Stay Updated With Us

Error: Contact form not found.

      Blog