EMBEDDED PROGRAMMING

In this week I want to try 3 different programming softwares, one that shows us Neil that is code C, the second is called codevision, and the third is very common "Arduino".
I will try to program the turning on and off of RGB LEDs for a certain time, I also saw that Neil could attach a serial port to a microcontroller that does not have this resource I want to try codevison to create this dynamic serial and to be able to send messages through the port.
I have some experience with microcontrollers and I will try to explain how the configuration of fuses is made according to the microcontroller datasheet.

Individual assignment

1.- Read a microcontroller data sheet.

Looking for AVR ATTINY44 information on the net, I found the page MICROCHIP. In this page we have the most important information of the microcontroller but it is necessary to read the data sheet, in this I look at all the configuration and work records.

On the first page I see the general parameters such as architecture, memory, operating voltages, speed, etc. This part is the most important, the pin configuration is shown. The microcontroller have the two pin PORTA and PORTB.

On the second part I see the general parameters to the clock configuration.

On the second part I see the general parameters to the clock configuration. Finally the records are: CKSEL=1110 SUT=11. Remember this parameter when you set the fuses.

In the I / O ports, I look at the configuration register to read an entry and write an output. In the following table shows how to configure.

In the datasheet it is easier to see the configuration of the fuses. They are divided into 3: low fuses, high fuses and extended fuses.

I change only the low fuses. The value 11111110 in hexadecimal is FE.
1.- I remove the division for 8
2.- The value 1 is to disable the clock output
3.- The parameter are configured in the clock configuration SUT and CKSEL


Program your board to do something, with as many different programming languages and programming environments as possible.

Take the programming the hello.ftdi.44.echo and modify it according to the parameters mentioned above. Edit the makefile with notepad ++, change the fuses by the FE value.

Programming in C using Make and notePad ++

For this test I used the hello world code created by Neil and made several modifications for my assigment, the code that Neil shows us allows you to send a letter through the serial port and it returns the same letter, when sending the second letter now the serial port returns the previous letter along with the new letter. I adding output pins for the LEDs through the registers mentioned in the datasheet. Perform a programming where the LEDs are turned on and off in a different way giving a color for each sequence.

With the code already modified now we have to upload to the microcontroller for that we follow the next steps

1.- The first step open the Git bash here.
2.- Use the code make -f hello.ftdi.44.echo.c.make
3.- Use the code make -f hello.ftdi.44.echo.c.make program-usbtiny-fuses
4.- Use the code make -f hello.ftdi.44.echo.c.make program-usbtiny
5.- Check its operation

Programming in C using CodeVision AVR
HP InfoTech presents a new version of the most popular (more than 16300 registered users) commercial C Compiler for the Microchip AVR microcontrollers.CodeVisionAVR is the only Integrated Development Environment on the market that features an Automatic Program Generator.
For more information visit the following link HP InfoTech

I decided to create a project in codevision and make a play of lights with the leds that I have on my board in this software allows us to choose the resources we need and as that creates an initial code, as it does not have a serial position, it does not allow me to add it. I'm reading the Neil C code to understand how to create a dynamic serial port but I still do not understand, when I understand it I will add this code.

To create a project you have to follow the following steps.

Myfinal code is as follows

How to burn the hex in the microcontroller.
1.- Go to the project folder
2.- Select the Debug folder
3.- Select the exe folder
4.- Verify if the .hex file exists
5.- Right click and open Git bash here
6.- Write de code avrdude -c usbtiny -p t44 -U flash:w:LED.hex
7.- Burn the hex file remember the name of project is the name of hex

Programming in C using Arduino
For this process I had to follow the tutorial that fab Academy helps us. Download the arduino ide of the link Arduino IDE

We create a code taking into account the Arduino pin number.

After installing arduino ide we Installing ATtiny support in Arduino.

Link of board: https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json

In arduino ide see file later to preferences Copy the link and paste in the box Go to tools and card manager
Install attiny board Select the board Select processor
Select programmer and select USBtinyISP Burn Bootloader
Change the Clock to 20mhz Up the code

For this programming platform I decided to continue programming my led to make a play of lights. Arduino is very easy to learn, there is a lot of information besides the arduino ide gives us several example codes. For this code I change the time between on and off of the led, this time is gradually reducing.


Group Assigment

I decided to explore on another card I had in one of TEXAS INSTRUMENT. MSP-EXP430F5529LP LaunchPad is an easy-to-use evaluation module for the MSP430F5529 USB microcontroller.
Contains built-in buttons and LEDs for a fast program. It is modular similar to Arduino. This allows you to adapt to screens, keyboards, sensors, actuators and communication modules

MSP-EXP430F5529LP LaunchPad has everything you need to get started with MSP430 development!

At the beginning I could not program it, I did not recognize the cable, I had to find the drivers, install them and wait for them to recognize the card. After solving this problem because something strange happened, I think the programming cable that I have is damaged because it does not work, change the cable and automatically it is activated. The programming is super easy, it is equal to programming in the arduino ide, I was surprised that many programs have adopted this system. For this moment I decided to try the 2 LEDs that have the card one is green and one red.

                            

#define LED1 RED_LED
#define LED2 GREEN_LED

void setup() 
{   
  pinMode(LED1, OUTPUT);  
  pinMode(LED2, OUTPUT);    
}

void loop() {
  digitalWrite(LED, HIGH);   
  delay(1000);               
  digitalWrite(LED, LOW);    
  delay(1000);              
    digitalWrite(LED, HIGH); 
  delay(1000);               
  digitalWrite(LED, LOW);  
  
  delay(1000);              
}
                            
                            

CONTINUATION OF FABALX

This point is to demonstrate how to up the FABALX boot loader that believes in week 5 ELECTRONICS PRODUCTION , basically I see a tutorial of Youtube with the name "Arduino Pro-Mini re-burn bootloader by using Arduino as ISP" I take the information and replicate in my PCB board


CONCLUSION

  • All the microcontroller information is in the datasheet, if we need any information this is a very good starting point.
  • The use of macros makes the code more lexible, Arduino has many macros.
  • We have several communication protocols ICSP, SPI, SERIAL, I2C good I could identify those during this assigment.
  • What else would I like to know? The first thing is how to create the serial dynamic port and if you can create dynamic ports for i2c and spi

DOWNLOAD FILES