Loading...
Pages: [1]   Go Down
Author Topic: How do I flash MIDI firmware to Arduino Uno rev3?  (Read 569 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 1
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone

First of all - I'm a complete noob here, so please have patience with me  smiley

I have an Arduino Uno rev3, which I want to turn into a MIDI device. I've found, that the HIDUINO firmware should do the job - see the project page here: https://github.com/ddiakopoulos/hiduino

I don't have an external ISP, so I have tried to use another Arduino as an AVR ISP, as described in this guide: http://www.arduino.cc/playground/Code/MegaISP

I'm trying to flash the firmware with this command:
Code:
avrdude -p m328p -F -P /dev/cu.usbmodem621 -c avrisp -U flash:w:HIDUINO_MIDI.hex

The output of the terminal on my mac is attached.

To me, it all seems okay, but when the firmware is flashed, the arduino should show up as a MIDI device in the System Information, but it just shows up as a "Communication Device".

Can anyone help me why that is? Is the firmware not flashed correctly?
I have done something, because I am not longer able to upload sketches via the Arduino IDE, which I shouldn't be able to whith a different firmware.

Am I missing something important?
I hope someone can help me, because I am completely stuck with my project smiley
Logged

Nice, France
Offline Offline
Full Member
***
Karma: 10
Posts: 232
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to flash the firmware with this command:
Code:
avrdude -p m328p -F -P /dev/cu.usbmodem621 -c avrisp -U flash:w:HIDUINO_MIDI.hex

So, you have flashed your main processor (ATmega328) with a hex code that was intended for the serial-to-USB processor (ATmega16U2).

from the page you linked to, the correct command for an 8U2 is

Code:
avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:HIDUINO_MIDI.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

Check your avrdude documentation for the correct -p flag for a 16U2. And, connect to the ICSP header for the 16U2, not the one for the 328.
« Last Edit: November 04, 2012, 11:13:16 am by Nantonos » Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 109
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have an Arduino Uno rev3, which I want to turn into a MIDI device. ...
I don't have an external ISP, so I have tried to use another Arduino as an AVR ISP
Try to follow this tutorial:
http://pdp11.byethost12.com/AVR/ArduinoAsProgrammer.htm
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay #Nantonos, that makes good sense smiley

I found in the AVR documentation, that the -p flag for the 16u2 is 'm16u2', and I've connected to the ISP header for the 16u2.

I have changed the terminal command to:
Code:
avrdude -p m16u2 -F -P /dev/cu.usbmodem621 -c avrisp -U flash:w:HIDUINO_MIDI.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m -b 19200

This all seems right to me, but I get an error when I try to flash the chip:
Code:
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.

With a little searching, and in the tutorial #simplex linked to I've found, that I maybe need a crystal in my circuit, because the invalid device signature error could be caused by different clock frequencies. Or that's how I understood it.
Does that make sense?

And if I need a crystal, how do I connect it, when I'm using the ISP-header? I can't connect the crystal as in  the tutorial you linked to #simplex, since I'm connecting to the ISP header
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 109
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I found the schematic of Arduino Uno R3
see: http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf

The USB AVR you want to flash has already a crystal connected to it.

If the lines (SS, MOSI, MISO, SCK) of the Aruino Uno configured as ISP Programmer are connected to the ICSP header pins (Reset, MOSI, MISO, SCK) corresponding to the USB AVR on the second Arduino Uno, you should be able to program the USB AVR with avrdude.

Likely you have wrong ISP connections between the Arduino Uno as Programmer and the ICSP header of the USB AVR on the second Arduino Uno board.

The SS signal of Arduino Uno Programmer is available just on pin 10 not on the ICSP. You have to take this into account when you make the wiring.

Also, do not try to write anything in the 16u2 as long as this command:
Code:
c:\>avrdude -P COM3 -b 19200 -c avrisp -p m16u2 -n
returns error messages.
 
  
« Last Edit: November 04, 2012, 11:39:25 pm by simplex » Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I resolved the issue smiley

#simplex, you were right about the fact, that the error was caused by wrong ISP connections.
Thank you for the help!

The final solution was as follows:

  • Load the MegaISP sketch to the first Arduino Uno used as the ISP programmer. The sketch is also included as an example in the Arduino IDE, under the name "ArduinoISP".
  • Connect this Arduino to the Arduino you want to program. The connections are as follows:
    Connect programmer pin 10 to the targets ICSP Reset header
    Connect pin 11 to MOSI
    Connect pin 12 to MISO
    Connect pin 13 to SCK

    The ICSP header connectors is shown below:

    The VTG and GND pins on the ICSP header is not used.

    When using the Arduino Uno an 10uF capacitor has to be connected between RESET and GND, as described in the ArduinoISP tutorial

    The final schematic should be as shown below:
  • Connect the programmer-Arduino to the computer, open Terminal/the commando promt and type the following command:
Code:
avrdude -p m16u2 -F -P /dev/cu.usbmodem621 -c avrisp -U flash:w:HIDUINO_MIDI.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m -b 19200
    '/dev/cu.usbmodem621' should be replaced by the port, your Arduino is connected to. [/li]
  • You're done smiley
Logged

Nice, France
Offline Offline
Full Member
***
Karma: 10
Posts: 232
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nicely documented. Thanks for reporting back on how you solved the problem.
Logged

Pages: [1]   Go Up
Print
 
Jump to: