Embedded Programming¶
Group assignment¶
Here is our group assignment link For group assignment we have done ATMega328P vs STM32 comparison. It was very useful to know what is difference betwen microcontrollers and what functions they can do. We compared different parameters from datasheets. Register size, Opeating conditions. Flash memory, SRAM, Clock speed, etc.
Based on the results of the test, it appears that the STM32 outperformed the ATMega328P in terms of frequency, with a frequency of 489 kHz compared to the Arduino frequency of 147 kHz for C++ with library and 512 kHz for Assembly. This could be due to the fact that the STM32 has a clock speed of 4-32 MHz compared to the ATMega328P’s clock speed of 0-72 MHz.
Additionally, it’s worth noting that the development workflows for the STM32 and ATMega328P differ in terms of register size, operating conditions, flash memory, and SRAM. While the STM32 has a 32-bit register size and operates at 2-3.6 V, the ATMega328P has an 8-bit register size and operates at 2.7-5.5 V. The STM32 also has more flash memory and SRAM compared to the ATMega328P.
Overall, the choice between the STM32 and ATMega328P will depend on the specific requirements of the project, including performance, power consumption, cost, and development workflow. It’s important to carefully evaluate the options and choose the microcontroller that best meets the needs of the project.
STM32¶
As software i tried to use CubeIDE
I am using STM32F411RE
I found it in program, and selected it to start project
After selecting board i want to use, here is my processor configuration
I want to use Blue button on board, and Built in LED.
I found them on processor to know which pin they are connected
Here is clock configuration, i found some information about it here
Then i Generated my code with C language.
Then i imorted my project to IDE.
You can see file called “main.c”. It is code file i want to work on.
This is code I want to work))
But.... Every time i tried to build code, it’s sending me error message.
I found that it is about debug configurations, but still couldnt solve that,
so i decided to work with EmBitz IDE. And I couldn’t find it, website wasn’t working.
After many tries i Found it, but it will take some time to lewarn it, and i decided to change my weekly project.
Arduino UNO¶
Now I want to use Light resistor sensor and measure its output.
I will use ArduinoUNo for that.
Here is how sensor connected to Arduino.
I will use ArduinoIDE examle code that is called AnalogInOutSerial
I set Output and Input pins
connected Sensor to input pin, and LED to output.
I set my output value function limits.
But even in darkness i had problem, that LED was lighting little bit, so I put limit, that i will turn off the Led if inout value is more than 930.
Here is Input and output values for different lights.
And Here is how it works.
Conclusion¶
In this week i learned about develompent boards and microcontrollers. What is Input and Output values, and faced difficulties with CubeIDE, that will solved soon i hope.
Source Code¶
Here is my code file