Audioino?

I'm not sure if this will help, but I've uploaded bootloaders without using a "commercial" ISP programmer. Two different methods:

Gammon Forum : Electronics : Microprocessors : Atmega bootloader programmer (you put the bootloader into the sketch itself)

Gammon Forum : Electronics : Microprocessors : Atmega chip stand-alone programmer to upload .hex files (you can upload any file from an SD card)

Thanks alot Nick! That looks awesome and I was looking for soemthing like Optiloader for custom bootloaders since I've been having issues with using Arduino as ISP with my UNO (even when using a 10uF cap between reset and ground)

So I tried using MUSHClient on my Windows virtualization and when I tried to follow your tutorial on adding the bootloader from Audioino (which im kinda worried only supports the ATMEGA168) i got and error from the script. I tried the "chAudioBoot_ATMEGA168_IN_PD1_LED_PB5" hex file from the Audioino folder. I think thats the correct bootloader file?

here is a screenshot of the error I got:
http://cl.ly/image/273F3X0v2L2n

Can you help me get the arduino script that incorporates the Audioino bootloader for an ATMEGA328 running at 8mhz (that would be just burning the correct fuses right?)

Can you click that box that says "show errors in output window next time", run it again, and then copy and paste the error message that appears? There is something in red underneath I can't read.

After looking at the actual error I was able to fix the error by simply adding a new end code to the Lua script. I got the following output from the script

// File = chAudioBoot_ATMEGA168_IN_PD1_LED_PB5.hex// Loader start: 3C00, length: 1024

// MD5 sum = 86 9B DA 86 0E 68 2B F1 0C 20 E5 47 D8 3C 8D E5 



byte PROGMEM chAudioBoot_ATMEGA168_IN_PD1_LED_PB5_hex [] = {

0x0C, 0x94, 0x34, 0x1E, 0x0C, 0x94, 0x51, 0x1E, 0x0C, 0x94, 0x51, 0x1E, 0x0C, 0x94, 0x51, 0x1E, 

0x0C, 0x94, 0x51, 0x1E, 0x0C, 0x94, 0x51, 0x1E, 0x0C, 0x94, 0x51, 0x1E, 0x0C, 0x94, 0x51, 0x1E, 

0x0C, 0x94, 0x51, 0x1E, 0x0C, 0x94, 0x51, 0x1E, 0x0C, 0x94, 0x51, 0x1E, 0x0C, 0x94, 0x51, 0x1E, 

0x0C, 0x94, 0x51, 0x1E, 0x0C, 0x94, 0x51, 0x1E, 0x0C, 0x94, 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00, 0x10, 0x92, 0xB2, 0x00, 0x69, 0xB1, 0x62, 0x70, 0x48, 0x30, 0x51, 0x05, 0x30, 0xF0, 

0x89, 0x81, 0x9A, 0x81, 0x82, 0x0F, 0x91, 0x1D, 0x9A, 0x83, 0x89, 0x83, 0x4F, 0x5F, 0x5F, 0x4F, 

0x40, 0x31, 0x51, 0x05, 0x19, 0xF7, 0x29, 0x81, 0x3A, 0x81, 0xC9, 0x01, 0x88, 0x0F, 0x99, 0x1F, 

0x82, 0x0F, 0x93, 0x1F, 0x25, 0xE0, 0x96, 0x95, 0x87, 0x95, 0x2A, 0x95, 0xE1, 0xF7, 0x9C, 0x83, 

0x8B, 0x83, 0x80, 0x91, 0xB2, 0x00, 0x2B, 0x81, 0x3C, 0x81, 0x90, 0xE0, 0x82, 0x17, 0x93, 0x07, 

0xC0, 0xF3, 0x16, 0xC0, 0x89, 0xB1, 0x90, 0xE0, 0x82, 0x70, 0x90, 0x70, 0x28, 0x17, 0x39, 0x07, 

0xC9, 0xF3, 0x49, 0xB1, 0x10, 0x92, 0xB2, 0x00, 0x80, 0x91, 0xB2, 0x00, 0x2B, 0x81, 0x3C, 0x81, 

0x90, 0xE0, 0x82, 0x17, 0x93, 0x07, 0xC0, 0xF3, 0x64, 0x2F, 0x62, 0x70, 0x10, 0x92, 0xB2, 0x00, 

0x26, 0x2F, 0x30, 0xE0, 0x89, 0xB1, 0x90, 0xE0, 0x82, 0x70, 0x90, 0x70, 0x28, 0x17, 0x39, 0x07, 

0x09, 0xF3, 0x49, 0xB1, 0x42, 0x70, 0x58, 0xE0, 0xA0, 0xE0, 0x60, 0xE0, 0x70, 0xE0, 0x89, 0xB1, 

0x24, 0x2F, 0x30, 0xE0, 0x90, 0xE0, 0x82, 0x70, 0x90, 0x70, 0x28, 0x17, 0x39, 0x07, 0xB9, 0xF3, 

0x10, 0x92, 0xB2, 0x00, 0x49, 0xB1, 0x80, 0x91, 0xB2, 0x00, 0x2B, 0x81, 0x3C, 0x81, 0x90, 0xE0, 

0x82, 0x17, 0x93, 0x07, 0xC0, 0xF3, 0x29, 0xB1, 0x22, 0x70, 0xEA, 0x2F, 0xF0, 0xE0, 0xE0, 0x50, 

0xFF, 0x4F, 0x80, 0x81, 0x88, 0x0F, 0x80, 0x83, 0x42, 0x70, 0x42, 0x17, 0x11, 0xF0, 0x81, 0x60, 

0x80, 0x83, 0x51, 0x50, 0x11, 0xF4, 0xAF, 0x5F, 0x58, 0xE0, 0x6F, 0x5F, 0x7F, 0x4F, 0x42, 0x2F, 

0x24, 0xE0, 0x68, 0x32, 0x72, 0x07, 0x99, 0xF6, 0x30, 0xE0, 0x90, 0x91, 0x04, 0x01, 0x80, 0xE0, 

0x20, 0x91, 0x03, 0x01, 0x82, 0x0F, 0x91, 0x1D, 0x8A, 0x5A, 0x95, 0x45, 0x09, 0xF4, 0x31, 0xE0, 

0x83, 0x2F, 0x0F, 0x90, 0x0F, 0x90, 0x0F, 0x90, 0x0F, 0x90, 0xCF, 0x91, 0xDF, 0x91, 0x08, 0x95, 

0x1F, 0x93, 0xCF, 0x93, 0xDF, 0x93, 0xDA, 0x01, 0xF8, 0x94, 0x83, 0xE0, 0xFB, 0x01, 0x80, 0x93, 

0x57, 0x00, 0xE8, 0x95, 0x07, 0xB6, 0x00, 0xFC, 0xFD, 0xCF, 0xAB, 0x01, 0x11, 0xE0, 0xEB, 0x01, 

0xC0, 0x58, 0xDF, 0x4F, 0x8C, 0x91, 0x11, 0x96, 0x3C, 0x91, 0x11, 0x97, 0x20, 0xE0, 0xF9, 0x01, 

0xE8, 0x0F, 0xF1, 0x1D, 0xCF, 0x01, 0x12, 0x96, 0x0C, 0x01, 0xFA, 0x01, 0x10, 0x93, 0x57, 0x00, 

0xE8, 0x95, 0x11, 0x24, 0x07, 0xB6, 0x00, 0xFC, 0xFD, 0xCF, 0x4E, 0x5F, 0x5F, 0x4F, 0x4C, 0x17, 

0x5D, 0x07, 0x41, 0xF7, 0x85, 0xE0, 0xFB, 0x01, 0x80, 0x93, 0x57, 0x00, 0xE8, 0x95, 0x07, 0xB6, 

0x00, 0xFC, 0xFD, 0xCF, 0x81, 0xE1, 0x80, 0x93, 0x57, 0x00, 0xE8, 0x95, 0xDF, 0x91, 0xCF, 0x91, 

0x1F, 0x91, 0x08, 0x95, 0x82, 0xE0, 0x80, 0x93, 0xB1, 0x00, 0x08, 0x95, 0x14, 0xB8, 0x17, 0xB8, 

0x1A, 0xB8, 0xF8, 0x94, 0x10, 0x92, 0xB1, 0x00, 0xEE, 0x27, 0xFF, 0x27, 0x09, 0x94, 0x08, 0x95, 

0xFF, 0x92, 0x0F, 0x93, 0x1F, 0x93, 0xCF, 0x93, 0xDF, 0x93, 0x82, 0xE0, 0x80, 0x93, 0xB1, 0x00, 

0xC0, 0xE1, 0xD7, 0xE2, 0x66, 0xE0, 0x53, 0xE0, 0x70, 0xE2, 0x80, 0x91, 0xB2, 0x00, 0x85, 0x36, 

0xA8, 0xF0, 0x10, 0x92, 0xB2, 0x00, 0x21, 0x97, 0x89, 0xF4, 0x85, 0xB1, 0x87, 0x27, 0x85, 0xB9, 

0x61, 0x50, 0x51, 0xF4, 0x2D, 0x98, 0x14, 0xB8, 0x17, 0xB8, 0x1A, 0xB8, 0xF8, 0x94, 0x10, 0x92, 

0xB1, 0x00, 0xEE, 0x27, 0xFF, 0x27, 0x09, 0x94, 0xC0, 0xE1, 0xD7, 0xE2, 0x89, 0xB1, 0x24, 0x2F, 

0x30, 0xE0, 0x90, 0xE0, 0x82, 0x70, 0x90, 0x70, 0x28, 0x17, 0x39, 0x07, 0x19, 0xF0, 0x49, 0xB1, 

0x42, 0x70, 0x51, 0x50, 0x55, 0x23, 0xC9, 0xF6, 0x2D, 0x9A, 0x60, 0xE2, 0xF6, 0x2E, 0x0E, 0x94, 

0x53, 0x1E, 0x88, 0x23, 0x79, 0xF4, 0x90, 0xE2, 0x80, 0x91, 0xB2, 0x00, 0x85, 0x36, 0xE0, 0xF3, 

0x10, 0x92, 0xB2, 0x00,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xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 

0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 

0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 

}; // end of chAudioBoot_ATMEGA168_IN_PD1_LED_PB5_hex

I then added that as a .h file into your Atmega_Board_Programmer and edited the code a bit to incorporate the Audioino Bootloader and I was able to successfully bootload a ATMEGA328p.

You can see the some of the alterations I made to the script and the output from Nick's programmer software in the screenshot:
http://cl.ly/image/2A2A0q333S0z

I have yet to actually test the bootloader however, so that would be the next step!

After trying to test the Audioino I realized it wasnt working properly. I am a bit worried that the fuses were possibly incorrect since in the ReadMe file of the audioino bootloader they use these settings for the atmega168

ATMEGA168, 1K bootloader: -Wl,--section-start=.text=0x3c00
	Fuses Atmega168:
	Extended: 0xFA
	HIGH: 0xDF
	LOW: E2

But I am not sure if I should run the same fuses for Atmega328p since currently I am burning the fuses of the lilypad to get the same 8mhz internal clock setting

else if (subcommand == 'A')  // use internal 8 MHz clock
      {
      Serial.println (F("Using Audioino 8 MHz loader."));
      bootloader = chAudioBoot_ATMEGA168_IN_PD1_LED_PB5_hex;
      newlFuse = 0xE2;  // internal 8 MHz oscillator
      newhFuse = 0xDA;  //  2048 byte bootloader, SPI enabled
      addr = 0x7800;
      len = sizeof chAudioBoot_ATMEGA168_IN_PD1_LED_PB5_hex;
      }  // end of using the 8 MHz clock

Should I change the fuses?

I am expecting the audioino to blink for 6 seconds after reset to show me that it is ready to be programmed through audio. Currently I am not seeing that. It might be that is because the current atmega328 I am burning is plugged into an arduino board... maybe i should make that a standalone and try again.

So I created a standalone atmega328 and changed the fuses to

   else if (subcommand == 'A')  // use internal 8 MHz clock
      {
      Serial.println (F("Using Audioino 8 MHz loader."));
      bootloader = chAudioBoot_ATMEGA168_IN_PD1_LED_PB5_hex;
      newlFuse = 0xE2;  // internal 8 MHz oscillator
      newhFuse = 0xDC;  //  512 byte bootloader, SPI enabled
      newextFuse = 0xFF; 
      addr = 0x3C00;
      len = sizeof chAudioBoot_ATMEGA168_IN_PD1_LED_PB5_hex;
      }  // end of using the 8 MHz clock

which better follows the fuses that were in the README of the bootloader. I was able to successfully bootload the chip and i see the blinking status LED and when I try to use the java program to play the audio file the status LED begins to blink quickly and that it. Regardless of the hex file I program it always blinks quickly and nothing else changes and whenever I reset the Audioino, it going back into the slow blinking LED. It seems like its stuck in the bootloader and that its actually never becoming programmed properly.

Any suggestions?

// File = chAudioBoot_ATMEGA168_IN_PD1_LED_PB5.hex// Loader start: 3C00, length: 1024

You want the 1024 byte bootloader, not the 2048 or 512 byte one. That is the first thing to get right.

I edited the code to

 else if (subcommand == 'A')  // use internal 8 MHz clock
      {
      Serial.println (F("Using Audioino 8 MHz loader."));
      bootloader = chAudioBoot_ATMEGA168_IN_PD1_LED_PB5_hex;
      newlFuse = 0xE2;  // internal 8 MHz oscillator
      newhFuse = 0xDA;  //  1024 byte bootloader, SPI enabled
      newextFuse = 0xFF; 
      addr = 0x3C00;
      len = sizeof chAudioBoot_ATMEGA168_IN_PD1_LED_PB5_hex;
      }  // end of using the 8 MHz clock

which should now account for a 1024 byte bootloader. I also realized that the quick flashing light from the Audioino is actually an error signal. In the chAudioBoot.c file you can see the portion of the code that states the error signal

  //*************** start command interpreter *************************************  
  LEDON;
  while(1)
  {
    if(!receiveFrame())
    {
      //*****  error: blink fast, press reset to restart *******************
      while(1)
      {         
        if(TIMER>100)  // timerstop ==> frequency @16MHz= 16MHz/8/100=20kHz
        {
           TIMER=0;
           time--;
           if(time==0)
           {
             TOGGLELED;
             time=1000;
           }
        }
      }
    }
    else // succeed
    {
      TOGGLELED;
      switch(FrameData[COMMAND])
      {
        case TESTCOMMAND: // not used yet
        {
  #ifdef ARDUINO_DEBUG        
         Serial.println("testcommand");
  #endif
        }
        break;
        case RUNCOMMAND:
        {
		//setExternalPort(2);
  #ifndef ARDUINO_DEBUG
          // leave bootloader and run program
		runProgramm();
  #endif
  #ifdef ARDUINO_DEBUG        
         Serial.println("runcommand");
  #endif
        }
        break;
        case PROGCOMMAND:
        { 
  #ifdef ATMEGA168_MICROCONTROLLER
  			// Atmega168 Pagesize=64 Worte=128 Byte
			uint16_t k;
			k=(((uint16_t)FrameData[PAGEINDEXHIGH])<<8)+FrameData[PAGEINDEXLOW];
			boot_program_page (SPM_PAGESIZE*k, FrameData+DATAPAGESTART);	// erase and programm page
  #endif
  #ifdef ATMEGA8_MICROCONTROLLER
  			// Atmega8 Pagesize=32 Worte=64 Byte
			uint16_t k;
			k=(((uint16_t)FrameData[PAGEINDEXHIGH])<<8)+FrameData[PAGEINDEXLOW];
			boot_program_page (SPM_PAGESIZE*k*2, FrameData+DATAPAGESTART);	// erase and programm page
			boot_program_page (SPM_PAGESIZE*(k*2+1), FrameData+SPM_PAGESIZE+DATAPAGESTART);	// erase and programm page
	
	#ifdef	PINGPONG_PLATTFORM
			setSpalte(k); // show frame number on ping pong game
	#endif

  #endif
  #ifdef ARDUINO_DEBUG 
          Serial.println("programming");
  #endif
        }
        break;
      }
      FrameData[COMMAND]=NOCOMMAND; // delete command
    }
  }
}

I still dont understand why it wont program correctly. I plugged the headphone jack into the Audioino with 2 10k resistors and a 10nF capactor (dont have a 100nF to test with currently)

Check out: AVR® Fuse Calculator – The Engbedded Blog

I make extended fuse of 0xF8 being the 1024 byte word boot vector.

Try 0xFA being the 512 word (1024 byte) boot vector.

Im a bit confused now. I am currently using
L: E2
H: DA
E: FF

If I switch E to FA the only change I see is that that BOD is set to 4.3v. I was trying not to mess with the BOD right now so if I disable it and set the boot word to 512 like you mention I am getting fuses as:
L: E2
H: DC
E: FF

However that also changes the start address to 3E00 rather than 3C00 which is mentioned in the bootloader's README. When i try to flash the bootloader with the
bolded fuses, it only works if I bootload at address 3C00, and even after that I have the same problem of although it boots, any attempt to upload code results in that error flash. Maybe the bootloader doesnt work with the atmega328p?
BTW Thank you very much for helping me out!

Can anyone look at the bootloader and tell me what they think? I know on the chAudioBoot.c file it says atmega168 but it looks like it should work on the atmega328p also. Any help would be greatly appreciated since this is a really cool bootloader and I would love to get it to work.

OK, what chip do you have? You have made repeated references to the Atmega168, so I assumed you were using it. Or are you?

I am using the atmega328p. The bootloader looks like it was written only for the atmega8 and the atmega168 but it looks like it should port over just fine since the 168 and 328 are pretty much the same.

Apart from the program memory size.

were you able to flash the bootloader successfully? if so, can you upload code through audio?

The bootloader in the Flash is at the end of the Flash. Due to the size of the Atmega328 the address of the bootloader section differs from the Atmega168.

After developing the first version of the bootloader I found a major bug. Some sound cards have an inverted output which would not work with the bootloader. I made a second java program which corrects this issue. Please use the program version which fits to your computer.

I've been using the AudioBoot_v2_0.zip so I think that should solve the inverse audio problem correct? I am running java program on my mac and I guess i could try another machine.

Also do you know how to properly address the bootloader on the atmega328p so that it gets burnt in the right location?

sdinnu:
However that also changes the start address to 3E00 rather than 3C00 which is mentioned in the bootloader's README. When i try to flash the bootloader with the bolded fuses, it only works if I bootload at address 3C00, and even after that I have the same problem of although it boots, any attempt to upload code results in that error flash. Maybe the bootloader doesnt work with the atmega328p?

Wait, wait. You have an Atmega328P, right? So that has 32 Kb of Program Memory.

Valid bootloader addresses are:

  • No bootloader: start at address 0x0000
  • Small bootloader (512 bytes): start at address 0x7E00
  • Larger bootloader (1024 bytes): start at address 0x7C00
  • Even larger bootloader (2048 bytes): start at address 0x7800
  • Largest bootloader (4096 bytes): start at address 0x7000

These are byte addresses not word addresses. The fuse calculator talks in word addresses. So if you have a 1024 byte bootloader it starts at byte 0x7C00 or word 0x3E00. So it should be compiled to start at (byte) 0x7C00, and the high fuse should be 0xDC (512 word, 1024 byte, bootloader).

I tried using Nick's Atmega programmer and changing the address on where the bootloader is placed and I cannot even get the chip to boot anymore. It only boots when I change the address to 0x3C00

Here is what I did:

    else if (subcommand == 'A')  // use internal 8 MHz clock
      {
      Serial.println (F("Using Audioino 8 MHz loader."));
      bootloader = chAudioBoot_ATMEGA168_IN_PD1_LED_PB5_hex;
      newlFuse = 0xE2;  // internal 8 MHz oscillator
      newhFuse = 0xDC;  //  1024 byte bootloader, SPI enabled
      newextFuse = 0xFF; 
      addr = 0x7C00;
      len = sizeof chAudioBoot_ATMEGA168_IN_PD1_LED_PB5_hex;
      }  // end of using the 8 MHz clock

And here is the output of your program:

Atmega chip programmer.
Written by Nick Gammon.
Entered programming mode OK.
Signature = 0x1E 0x95 0x0F
Processor = ATmega328P
Flash memory size = 32768 bytes.
LFuse = 0xE2
HFuse = 0xDC
EFuse = 0xFF
Lock byte = 0xEF
Clock calibration = 0x8D
Bootloader address = 0x7E00
Bootloader length = 512 bytes.
Type 'L' to use Lilypad (8 MHz) loader, 'A' for Audioino (8 MHz), or 'U' for Uno (16 MHz) loader ...
Using Audioino 8 MHz loader.
Type 'V' to verify, or 'G' to program the chip with the bootloader ...
Erasing chip ...
Writing bootloader ...
Committing page starting at 0x7C00
Committing page starting at 0x7C80
Committing page starting at 0x7D00
Committing page starting at 0x7D80
Committing page starting at 0x7E00
Committing page starting at 0x7E80
Committing page starting at 0x7F00
Committing page starting at 0x7F80
Written.
Verifying ...
No errors found.
Writing fuses ...
LFuse = 0xE2
HFuse = 0xDC
EFuse = 0xFF
Lock byte = 0xEF
Clock calibration = 0x8D
Done.
Type 'C' when ready to continue with another chip ...

Since this doesnt even boot properly, does the bootloader need to be recompiled for the atmega328p? How would I go about doing that?

sdinnu:
Since this doesnt even boot properly, does the bootloader need to be recompiled for the atmega328p?

Absolutely. The code is compiled to run at a certain address, and the bootloader has to be at certain limited addresses. You can't just stick them where you feel like it.

How would I go about doing that?

I'm not sure exactly how to recompile bootloaders (depends on your platform a bit) but there should be a makefile there. I've recompiled Optiboot on the Mac by ignoring the makefile and doing my own thing.