WEEK 08

Embedded Programming






Embedded Programming







• Read a microcontroller data sheet

• Run a program into your HelloWorld Board using different environments




Since I am a beginner and I have just tried some programming with arduino, It has been hard for me to understand all the process, expecially when programming in C. But let's start from the beginning. First thing to do is to read the ATTINY44A Data Sheet, in order to understand how this chip works. Pdf file is downloadable here.



I started to understand what are the pins for and I collected the main data in this image.




Once understood general information I thought it was a nice idea to give a try with Arduino IDE, since I am a bit familiar with it. This tutorial helped me a lot. So, I plugged both boards to the macbook, the helloworld board through a FTDI cable and the UsbTiny through USB. Both connected to each other with some very homemade ISP connections system (6 wires). To understand if the device is recognized by the Macbook, I checked through this command: apple/info about this mac/more info/usb



Installing ATtiny support in Arduino using the built-in boards manager.



• Open the preferences dialog in the Arduino software.

• Find the “Additional Boards Manager URLs” field near the bottom of the dialog.

• Paste the following URL into the field (use a comma to separate it from any URLs you’ve already added): https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json



Click the OK button to save your updated preferences.

• Open the boards manager in the “Tools > Board” menu.

• Scroll to the bottom of the list; you should see an entry for “ATtiny”.




• Click on the ATtiny entry. An install button should appear. Click the install button.

• Close the boards manager. You should now see an entry for ATtiny in the “Tools > Board” menu.

• Tools/Boards check for UsbTiny as Programmer

• If a crystal is connected, select the clock you need. In my case I had no crystal, so I decided to run with internal 8Mhz.





Then I opened a new sketch from Arduino IDE and started to load first a blink sketch, then I combined blink and fade so that when I will push the button the led will be blinking, while when button is not pressed, the led will fade. To load the sketch through the usbTiny, I pressed shift button from keyboard and pressed Load command from arduino IDE. Here a video showing the loading of the sketch and how the sketch works. I think with arduino IDE is quite easy to run simple programs. That's why I will use it in the future for simple sketches. My aim is also to try with Firefly, through Grasshopper.




DOWNLOAD FILES


FadeBlinksketch.ino


Programming in C



After using Arduino IDE, I have followed the instructions of a previous MIT student, Irina Chernyakova , suggested by my friend Michele Turco.










Checking with my tutor Antonio Grillo, I realized that I have switched the name. So I replaced the contents of each files with the correct file name. Unfortunatelly, I hade some errors while doing this command: make -f Makefile program-usbtiny-fuses . Probably this problem is due to connections. Since I am currently in Moscow and I cannot have access to multimeter, I will go to Moscow Fablab to check the boards.

Makefile


Blink.c


Error