Welcome to the MIDI Sprout forum

Author Topic: Flashing new code to the atmega  (Read 2648 times)

Offline relaxing

  • Newbie
  • *
  • Posts: 5
    • View Profile
Flashing new code to the atmega
« on: March 29, 2016, 10:43:19 AM »
So I had a hard time with the upload instructions in this thread last night. Was able to compile the code and upload to an atmega328p from an existing Arduino, but not onto the chip from my kit.

I wanted to change scales (chromatic was a little atonal for my tastes) so I got the code and compiled it with the Arduino IDE. Pulled the chip from the Arduino Uno R3 and plugged the chip from the kit. But no matter what steps I took, I couldn't get avrdude to upload. All I got was a single flash from the recv LED on the Arduino board, and the message stk500_getsync(): not in sync: resp=0x00 from the Arduino console.
I tried with and without edits to avrdude.conf, different version of the Arduino IDE (latest 1.6.8 all the way back to 1.0.x series.), no avrdude love.  The whole signature edit thing seems weird to me since, all the (non-SMD) Arduinos I have came with 328p avr's, so I'm not sure why a change would be needed?

The chip from kit still functions in the MIDIsprout, so I don't think I fried it.  Did you burn them with an Arduino bootloader when you flashed the original firmware?  Is there anything else I could be missing?

Offline sam

  • Sam
  • Moderator
  • Full Member
  • *****
  • Posts: 188
  • Understand How Your Tools Work!
    • View Profile
    • Electricity for Progress
Re: Flashing new code to the atmega
« Reply #1 on: March 29, 2016, 11:28:24 AM »
The ATMEGA chip included with the MIDI Sprout is a ATMEGA328-PU, rather than the 'low power' ATMEGA328p which is included in an Arduino Uno.

The updates i suggest to the avrdude.conf file are the easiest way that I have found to get the code compiled and loaded successfully on this 328 chip with the different signature.

The sync issue you are getting is due to the bootloader, the Arduino boot loader is not installed on the MIDI Sprout and will need to be flashed in order to use the Uno board as a programmer.

Using an Arduino as ISP, you should be able to program the MIDI Sprout using the ICSP on-board.  I used a USB-Tiny programmer when loading the boards.

I had hoped to make reprogramming the Sprout as easy as possible, but it does seem that the differences in chips requires some additional programming knowledge and steps.  I'll try to build an avrdude configuration and board file to match the Sprout.

Here are some online resources for using the 328-PU with the Arduino IDE:
http://forum.arduino.cc/index.php?topic=58670.0
http://playground.arduino.cc/Main/CustomizeArduinoIDEhttp://www.instructables.com/id/Bootload-an-ATmega328/
http://forum.arduino.cc/index.php?topic=158701.0

-sam



« Last Edit: March 29, 2016, 12:12:28 PM by sam »

Offline relaxing

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Flashing new code to the atmega
« Reply #2 on: March 31, 2016, 04:29:05 PM »
My kit came with a 328P-PU...

Offline sam

  • Sam
  • Moderator
  • Full Member
  • *****
  • Posts: 188
  • Understand How Your Tools Work!
    • View Profile
    • Electricity for Progress
Re: Flashing new code to the atmega
« Reply #3 on: March 31, 2016, 05:07:03 PM »
Wow @relaxing, did you get a dev kit with circuit board too?
Hmm perhaps a few 328p's made it into the mix. Without a doubt the sprouts have the 328-pu.

You will still need to flash the bootloader to use with the arduino. The best way to program, in my opinion, is using a dedicated ftdi or usbtiny programmer.
« Last Edit: March 31, 2016, 05:09:21 PM by sam »

Offline relaxing

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Flashing new code to the atmega
« Reply #4 on: March 31, 2016, 05:27:28 PM »
Nope, regular kit with a breadboard.  Guess one must have slipped in!