SpeakerBadge 2011

From Null Space Labs

Jump to: navigation, search

Debugging

AVR Studio 4 wants to be in debugWire mode, connect and power the badge, load a project into AVR Studio 4, compile it. Then select Debug, the first time it'll error and ask to enable debugWire mode via SPI , do this, then remove power as per instructions from AVR Studio 4. It should then connect and stop at the main function.

Click Use SPI to enable debugWIRE interface

Start debug.png


Click OK

Dw ena.png


Cycle the power to the badge ( remove batteries ), Click OK

Dw ena1.png


You should see something like this, if you don't make sure the power has been completely removed and reconnected.

Debug.png

Uploading Arduino Code

You can either patch into the serial pads ( two resistor 0R0 jumpers PD0/PD1 ) and upload with the arduino bootloader and IDE. Or you can just use the programmer to upload the HEX file the Arduino IDE creates. In Windows open up the TEMP folder ( go to the start/search programs and files, and type %TEMP%

Ard temp.png


Windows will open an explorer window to the temp folder. Then look for the directories that are called build__something.tmp , usually it'll be "build1215582141664046275.tmp" but the number will different, look for the one with the most recent date.

Temp build.png


Clicking on the Date modified column will make it easier to see which build folder is the most recent. Now enter that folder.

There should be a .hex file with a similar name as the Arduino Project.

Ard proj.png


See highlighted
Choose hex.png


Now load AVR Studio 4 and use the [NULLSpace] Kraken usbasp tool with avrdude and program that hex file to the badge. I'll detail this on a different page. Note: If you have the badge in debugWire mode, you must undo it before using a Dragon, or Kraken, othewise it will not work. See Undoing debugWIRE mode below


For the AVR Dragon etc use :- Select Tools, Program AVR, Connect for the first time or Auto Connect after the options are set.

Select avr.png


Change your options as needed. Select Connect

You can also use the small CON/AVR icons in the toolbar to connect/auto connect


This should appear, change the options to match

Avr page1.png
Avr page2.png
Avr page3.png

Undoing debugWIRE mode

If you've been debugging the badge with a Dragon ( the Kraken/usbasp/etc can't debug ), you need to turn off debugWire before you can use the regular programming tools.

Open AVR Studio 4 with a suitable project, then Start debugging,I use Reset from the debug menu. Then look on the Debug menu for AVR Dragon Options If the option is greyed out, then you're either not debugging, or the CPU isn't halted in single step mode, use Reset or Break

Debug opt.png


Now click Disable debugWIRE

Disa debugwire.png

Click Yes

Dw conf.npg.png


The badge should reset, and after 4 or so seconds, this should appear, click OK.

Plat.png


Finally click OK to get out of the AVR Options dialog.

debugWire mode is now disabled and you can use normal ISP programmers, but obviously not debug until you re-enable debugWire.

Personal tools