ddiakopoulos / hiduino

:musical_keyboard: Native USB-MIDI on the Arduino
http://www.dimitridiakopoulos.com/hiduino
645 stars 110 forks source link

Flashing issue #13

Closed boobslappy closed 9 years ago

boobslappy commented 10 years ago

I have flashed the Atmega 16u on my Arduino MEGA using a Sparkfun USB Tiny programmer and when plugged in to either my MAC or PC does not recognize as MIDI device. The programmer is working fine uploading Arduino sketches and I receive no errors using avrdude. Any help??

jimurphy commented 10 years ago

Are you sure it's a 16U2 and not the 8U2? Which revision of the Mega 2560 are you using? I've been able to upload to a Mega2560 recently (Rev2, though).

By the way, I don't have any experience with the USB Tiny programmer (all of my experience is with the AVRISPMKII, so take what I say with a grain of salt), so I can't speak to its functionality.

It would be helpful if you could post the command you're using to flash HIDUINO.

paxdeckard commented 10 years ago

Dear Dimitri, first of all thanks a lot for sharing your work. Well, in short i'm burning your firmware HIDUINO in a Arduino Due but if i unplug the board more than 30 seconds it looks like it was erased. In detail, for burning firmware process (hex files) i'm using an Arduino Duemilanove as ISP connected through its ISP to the Due ICSP. When i want to burn a sketch i burn "usbserial_due_16u2.hex" (downloaded from this repository), i upload the sketch from the Arduino IDE (usual way), and finally burn the "HIDUINO_MIDI.hex" (downloaded from this repository too), after that i restart the board (by pressing the button or unplugging-pluging the usb cable) and everything works like a charm whilst i don't unplug the board more than 30 seconds. I've tried the "Arduino-DUE-usbserial-prod-firmware-2013-02-05.hex" that comes with Arduino IDE but it's the same think.

Commands: d:\Arduino_1.5.7\hardware\tools\avr\bin>avrdude -C ..\etc\avrdude.conf -c arduino -P com1 -b19200 -p m16u2 -Uflash:w:usbserial_due_16u2.hex d:\Arduino_1.5.7\hardware\tools\avr\bin>avrdude -C ..\etc\avrdude.conf -c arduino -P com1 -b19200 -p m16u2 -Uflash:w:HIDUINO_MIDI.hex

Do you know what i'm doing wrong ? Thanks in advance.

ddiakopoulos commented 10 years ago

Hey there. I'm pretty certain this is an unresolved bug in HIDUINO with regards to the Due. I don't have time in the immediate future to release a new firmware, but if you can get the project compiling then I think it's straightforward.

https://github.com/arduino/Arduino/blob/ide-1.5.x/hardware/arduino/sam/firmwares/atmega16u2/arduino-usbserial/Arduino-usbserial.c

In that file you'll see there's a reference to "setErasePin(bool v)"

Technically the HIDUINO firmware doesn't do anything with that pin so it's left in a floating state (which is really, really bad because it's hooked up to the ERASE_CMD pin which will erase the sketch!). 99.9% positive adding the logic in the linked file to HIDUINO will fix your issue!

Keeping this issue open until I have time to fix this issue properly.

paxdeckard commented 10 years ago

Thanks Dimitri for your answer. But i have all my stuff in windows so i'm forced to get back using Duemilanove as midi controller. I will try to do something with your code but i don't think i can make it, i've tried before to do anything with Atmel Studio but i couldn't do a simple "Hello World" and now i will fight (a short fight i think) with LUFA. Anyway... thanks again Dimitri.