Read the data sheet for your microcontroller
Use your programmer to program your board to do something
Embedded Programming is a subject where we deal with both hardware and software.
You can call it the holy grail of engineering where constant experiments are performed over a hardware to test it's limits and capabilities.
Nowadays we use RISC based processors and microcontrollers to do application specific tasks.
In the early days of chip development Intel was a pioneer in developing its Intel 4004 chip which worked on an older archietectur called Von-Neumann Architecture the instruction sets developed were CISC based hence these family of chips had less computing power.
As word spread that the amount of computing power required for Apollo 11 mission with which man was able to step on the moon was less than what we have on our smartphones today.
This show how much technology has evolved today.
Today we have smart phones that work on SoC (System On Chip) which are based on the ARM archietecture.
Lastly I would like say that evolution is the key to a sustainable living.
For this weeks' assignment my hello world board wasn't ready hence I had to borrow another board.
We were also provided with an arduino uno to work on the assignment to study its mictocontroller i.e ATMega328P.
Coding was fun but creating a video for the same was a bit challenging because of the software issues on OBS for macbook m1. Multiple Screens are always recommended when working with OBS.
I used Arduino IDE but wasn't happy.
Arduino IDE
VScode
Terminal
There are two main architectures that are found in our day to day use electronincs are:
Von-Neumann Architecture
Harvard Archietecture
The image shown above depicts the block diagram of the two architectures.
Handles the collection and storage of data. The unit is separate from the cpu hence making the retrieval of data slower.
Control Unit is used to regulate and integrate different functions of the system it communicates with the I/O devices and handles the data that is being used by the ALU.
Abbreviated as Arithmetic Logic Unit it handles all the calculations and mathematical operations of the computer. Consider this unit to be the heavy lifter of your systems as it performs all the major calculation of the computer
Complex Instruction Set Computer
These are older and more reliable Instruction set nowadays CISC is used only on x86 architectures. It follows Von Neumann architecture.
The execution time of these sets are high compared to RISC because of the lack of instruction pipeline. Used for complex calculations. They also consume a lot of power compared to RISC which are used for low power application.
Reduced Instruction Set Computer
These are newer instruction sets that work on Harvard architecture.
They are mainly used in power constrained devices or on edge device where computing power is needed with lower power operations
An example of this are ARM devices.
Source:- Internet
Instruction pipelining is the process of handling parallel instruction in the same T-state a good example of this is ARM as it can handle multiple instruction at a given t sec
The image given below shows the pipelining of 5 instructions.
CISC | RISC |
---|---|
Instruction sets are complex | Instruction sets are simpler compared to CISC |
Instruction Pipeline isn't possible | Instruction Pipeline is possible |
Longer machine cycles | Shorter machine cycles |
Instruction sets are complex | Instruction sets are simpler compared to CISC |
Experienced alot of errors while doing the group assignment. This week was also an rc-1 nightmare after 15 trials only my hello world board wass readied. The fix is to check the connections again and again. The point of failure could the ribbon cable you are using or a loose connection from the PC itself to the ISP. There were multiple point of failures for me sometimes the ic itself dosen't on the other time it could be an issue with soldering your connections on the board. To tell the truth I had to change the IC 4 times and repurpose some of the components that we used in my hello world board. While routing I even had to use zero ohm resistor because of wiring components in the right way. In the routing session I also tried out common grounding the conponents but modsproject software dosen't give an accurate result for the same. So these were some of the experiences that I had for this week.
The assignment for this week was to go through the datasheet of the desired microcontroller. Here we were given a choice to use ATmega328p or ESP32. Since my the final project was based on an ESP32 I though of going through the datasheet of esp32 will be much helpful than arduino but I was wrong eventually I had to read the datasheets of both microcontroller.
Datasheet is a specsheet of a semiconductor device that is provided by the manufacturer to the user. It contains important information like the power characteristics, hardware information, pinout configuration and others. I'm providing the download links below for the datasheet of ESP32 and ATMega328P
ESP32 Datasheet
ATmega328p Datasheet
Datasheets also tend to have information about the clock speeds of an IC which at times becomes very useful while performing various tasks with a chip.
The information about is maximum power handling capacity or the range of operating voltages and frequencies are always a must. I would look for the features section on this piece of paper.
Through this information we can identify whether an IC suitable for a specific purposes.
Although a datasheet of a chip could be as long as one thousand pages most of the information needed for an average hobbyist is always found in first ten pages or so.
A datasheet also contains some information on the fabrication of the chip which in turn decides its power efficiency.
Shown below is the DC characteristics of esp32 as an example.
Since my hello world board was not ready for programming I tried out different types of programming languages on Arduino uno .
The board houses an ATMega328P where the P mean Programming. I tried out both Embedded C and Arduino C i.e using avr libraries and Arduino libraries.
The pros of using embedded C were that it takes less space but has faster compile and execution times.
The cons were that the programming requires extra steps and needs most of the functions to be defined plus need extra libraries of performing basic functionalities.
The image below shows the execution done via Embedded C
On the other hand the pros on using the Arduino libraries are that it’s easy to program contains keywords to set pins and other functionalities of the microcontroller/board and has a straight forward way of programming the board using two blocks they are void setup() and void loop().
The cons are that the executions times are slow and takes up significantly more memory space than Embedded C to perform the same task.
The image below shows the code written in Arduino C.
A Video of programming the hello world board uing Embedded C. Programing for a simple switching circuit LED switch ON and OFF.
In this weeks group assignment we had to explore different way of programming a microcontroller using different IDEs. I tried out the assignment with an ESP32 itself and use VScode to do python programming on the chip. To be specific its micropython not python.
Use this link to visit the group assignment page for mare details.
Click here if you would like to download the source code of the project shown in the video.