W7 embedded programming

W7. Read a microcontroller data sheet, program a board to do something with different programming languages and environments

learning languages + programming board

 

This week we had to understand what a microcontroller is and work with our ATtiny and program it. I used try to program my helloboard.

1st attempt:

For the helloboard:

  • I have a InSystemProgrammer with different components so I used an Arduino Duemilanove ATmega328 as an ISP. I follow the tutorial for the ATtinny44 and then:
  • I used the Arduino environment and follow the instructions in the tutorial to use the Arduino as ISP.
    • Adding a 10uf capacitor in reset and ground pins on Arduino Duemilanove
    • Use the ArduinoISP sketch from the example menu
    • Connect the Arduino  with usb-cable
    • Select the board (Arduino Duemilanove) and processor Atmega328
    • Select the port (/dev/tty.usbserial-A800elPr)
    • Verify the sketch and then upload
    • The result is what I expected, due to my soldering problems in the board.

 avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding

  • The suggestions for this error is to update the drivers for the ports. I did it but the problem remain.
    • FTDIUSBSerialDriver_v2_2_18.dmg from the link
  • Then I installed codebender.cc to have another option but again It could not get connection to the board.

2nd attempt:

I used the second echo-helloak board I made and an Arduino Uno. This time I follow the instructions to bootload the microprocessor.

  • connect the arduino Uno adding the 10uf capacitor in reset and ground (link to arduino as ISP).
  • connect the ISP jumper in echo-helloak to the isp jumper in arduino (ground, vcc, miso, mosi, sck and reset), you just have to identify ground or vcc and the rest of the connections are always in the same order as the following diagram:

Captura de pantalla 2015-06-28 a las 14.21.23

 

IMG_6292

  • After that in Arduino IDE I selected from tools Attiny as a board, the clock – 20 mhz external, then processor Attiny44,  port  /devtty.usbmodem1421 (Arduino Uno)  in my case. And finally burn bootloader.

Captura de pantalla 2015-06-27 a las 11.56.56 Captura de pantalla 2015-06-27 a las 11.57.05 Captura de pantalla 2015-06-27 a las 11.57.14 Captura de pantalla 2015-06-27 a las 11.57.21 Captura de pantalla 2015-06-27 a las 11.57.59

  • After waiting for a few minutes I got an error “arvdude: stk500-recv(): programmer is not responding”. I review soldering of the components and tried to fix it, I change the usb cable, restart the arduino IDE but I got the same error every time.

Captura de pantalla 2015-06-27 a las 11.59.10

3rd attempt:

Even though I think the problem is in my board (soldering) I decided to try to program it by the terminal using an avrisp2 programmer and an FTDI usb cable. First I connected the board to the avrisp2 by the ISP jumper and the FTDI cable in to the FTDI jumper (for power supply). The avrisp2 signal shows an orange light, It could mean that the ISP jumper is not well connected. I check the soldering again but it did not change.

IMG_6306

I started to download the files from the fab academy archive (echo-hello board) and use the following commands:

  1. cd (here I upload the directory where I have the files)
  2. ls (to list and check the name of files)
  3. sudo make -f hello.ftdi.44.echo.c-2.make
  4. sudo make -f hello.ftdi.44.echo.c-2.make program-avrisp2 (I am using as a programmer the avrisp2)

The result was “command failed”  – “bad avrisp connection”

Captura de pantalla 2015-06-27 a las 17.47.00

4th attempt

I follow the same process with other hello boards I made for input and output devides. In that case I had success programming the board. Here an example of the temp sensor that I also documented with more detail in the input assignment of  week 10.


IMG_6311

For the temp sensor I used the terminal to program the board following the steps described above (sudo make -f hello.temp.45.make)

Captura de pantalla 2015-06-27 a las 17.54.38 Captura de pantalla 2015-06-27 a las 17.54.46
After writing and reading 100% and getting “avrdude done” with no errors