Monday 14 December 2020

Electronics/Embedded/Electrical questions - part 1

Please share it with your friends who are preparing for interview , and comment down your suggestions , or any mistake in the post. 

code snippets are hosted on ideone.com. you can run code there as well.


Any good embedded engineer should have following skills besides programming skills:

1) understanding of electronics hardware like understanding circuit diagrams, resister, capacitors, basic low pass, high pass filters, band pass filter, isolation techniques etc.

2) should know how to use oscilloscope, logic analyzer, function generator, multimeters etc.

3) should know how to use hardware debuggers like JTAG and features like Trace, data breakpoint, memory window, register window etc.

4) understanding of peripherals like IOs, ADC, DAC, PWM , UART , SPI,  I2C.  

5) basic understanding of architecture like ARM , MIPS , PIC , AVR , MSP430.

-----------------------------------------------------------------------------------------------------------

In this post I will list down some of the articles, that you must go through before any embedded inteview.

I would highly recommend 2 websites for embedded electronics knowledge :

1) https://learn.sparkfun.com/

2) https://www.engineersgarage.com/


1) Understanding UART :

< https://learn.sparkfun.com/tutorials/serial-communication/all >


2) Understanding I2C :

< https://learn.sparkfun.com/tutorials/i2c/all >

I2C Speed:

Original : 100 Kbps

Fast mode : 400 kbps

Fast mode plus : 1 Mbps

High speed mode : 3.4 Mbps

Addressing:

7-bit addressing => 112 number of devices ( because there are some reserved addresses )

10-bit addressing => 


3) Understanding SPI :

< https://learn.sparkfun.com/tutorials/serial-peripheral-interface-spi/all


4) Difference between RS485 vs RS232 :

https://www.electronicdesign.com/technologies/communications/article/21800966/whats-the-difference-between-the-rs232-and-rs485-serial-interfaces >


5) What is Modbus protocol :

https://www.bb-elec.com/Learning-Center/All-White-Papers/Modbus/The-Answer-to-the-14-Most-Frequently-Asked-Modbus.aspx >


6) SAR ADC :

Remember for ADC sampling rate , resolution is 2 important parameters.

https://learn.sparkfun.com/tutorials/analog-to-digital-conversion/relating-adc-value-to-voltage >



7) SAR vs Sigma Delta ADC :


8) Write a program to implement software UART , I2C or SPI ( mvxpiam )

Software protocol implementation like UARTs, I2Cs , SPIs are needed when there is no physical hardware present on chip for UART , I2C , SPI.

This is very interesting exercise to do for any embedded engineer at it involves bit banging.

Bit banging is slang for any method of data transmission that employs software as a substitute for dedicated hardware to generate transmitted signals or process received signals.

< src : https://en.wikipedia.org/wiki/Bit_banging >

Try to think different scenarios like :

Blocking call vs non blocking call.

Single byte buffer vs Multi byte buffer etc.


9) What is bit banding region in memory ?

Normally memory is "byte" addressable i.e the minimum unit you can access is byte. But bit banding region is bit addressable i.e you can address individual bits. This region is widely used for user defined flags and boolean variables.


10) what is JTAG debugger ?

Sometimes explaining JTAG to programmers like web developers or desktop application developers becomes difficult. Most of the embedded developement is cross development i.e you are developing software on one architecture ( i.e x86_64 intel/amd )  which is meant to run on a different architecture. ( i.e ARM, MIPS , AVR, PIC, MSP430 etc ).

So to debug your code on that architecture  ( i.e ARM, MIPS , AVR, PIC, MSP430 etc ) you need a debuger which will connect you to that processor.

"JTAG is a common hardware interface that provides your computer with a way to communicate directly with the chips on a board. It was originally developed by a consortium, the Joint (European) Test Access Group, in the mid-80s to address the increasing difficulty of testing printed circuit boards (PCBs). JTAG has been in widespread use ever since it was included in the Intel 80486 processor in 1990 and codified as IEEE 1491 that same year. Today JTAG is used for debugging, programming and testing on virtually ALL embedded devices."

< src : https://blog.senr.io/blog/jtag-explained >


11) what JTAG features a programmer should know ?

JTAG provides most of the features which you find in other IDEs like visual studio C# or Eclipse JAVA.

Some the features are :

disassembly flow

register window

data memory window

program memory window

Instruction trace.

data breakpoint

conditional breakpoint

see this video :




11) what is an "interrupt" ?

Stands for "Interrupt Service Routine." An ISR (also called an interrupt handler) is a software process invoked by an interrupt request from a hardware device. It handles the request and sends it to the CPU, interrupting the active process. When the ISR is complete, the process is resumed.

< src : https://techterms.com/definition/isr >

12) Single vector vs multi vector interrupts 

With single vector mode, all interrupts go to the same interrupt handler.

With multi vector mode, each interrupt has its own vector.

In single vector mode, you software has to determine which interrupt source is active in order to start the appropriate processing.

In multi vector mode, once each interrupt handler is dedicated to a specific interrupt source so when in the ISR you know what you have to process.

< src microchip forum : https://www.microchip.com/forums/m414867.aspx >


13) so what is "vector" in vectored inturrupts ?

let say you are in code some where at 0x1000 and you what to go to 0x2000. now you have to use some branching or jump instruction for this. basically this is done by software.

But in case of vectored interrupts no brach or jump intructions are stored , instead vector addresses are stored for ISR and hardware ( i.e processor ) moves the control at vector address.

I would highly recommend to go through this guide :

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/beginner-guide-on-interrupt-latency-and-interrupt-latency-of-the-arm-cortex-m-processors >


14) What is "nested" vectored inturrupts ?

Most of the microcontrollers provides some kind of priorities to interrupts. In case of nested inturrupts as the name suggests when a high priority inturrepts arrives a when low priority inturrupt is being served , then processer will shift to high priority inturrupt and when it is done , control is resumed to low priority one.

This is called nesting of inturrupts. And hence we arrive to the ARM term Nested vectored inturrupt controller.


Please share it with your friends who are preparing for interview , and comment down your suggestions , or any mistake in the post. 

code snippets are hosted on ideone.com. you can run code there as well.










No comments:

Post a Comment