Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Need a nudge in the right direction
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Need a nudge in the right direction

by shobley on Wed Jun 16, 2010 11:19 pm

So.....

1. Built USBTinyISP ... check
2. Wrestled with driver signing in Win 7 ... check
3. Downloaded and flashed 328P with the test hex file ... check
4. Flash verification complete ... check

Now, what should happen next?

I have the "Evil Mad Scientist" board hooked up to the USBTinyISP - and I have that wired up just like in the pictures. The red LED on the programmer flashes, and so does the larger LED on the EMS board during the avrdude process.

I guess now I need to set the fuses, or something... :?

- would someone care to help me over the finish line...?

Thanks,
Steve
http://www.stephenhobley.com
http://www.youtube.com/shobley
For all your laser harp, tesla coil, and killer robots from outer space needs.
shobley
 
Posts: 184
Joined: Fri Sep 07, 2007 5:16 pm

Re: Need a nudge in the right direction

by uhe on Thu Jun 17, 2010 6:27 am

Hi

which EMS board are you talking about? Peggy2?
What do expect that should happen next? Should this test hex file do/display sth.?

The fuses are usually set at the end of flashing the new firmware/hex-file. There might be a line in your Makefile like:
Code: Select all | TOGGLE FULL SIZE
#AVRDUDE_FLAGS += -U lfuse:w:0x62:m -U hfuse:w:0xdf:m -U efuse:w:0xf9:m

If you uncomment this the avrdude should set the lfuse, hfuse and efuse to these values.
Make shure that you write the right values, this can render your microcontroller unusable!
"I have not failed. I've just found 10,000 ways that won't work." - Thomas Edison
uhe
 
Posts: 178
Joined: Mon Sep 03, 2007 4:50 pm
Location: metric world

Re: Need a nudge in the right direction

by shobley on Thu Jun 17, 2010 8:08 am

Board : http://www.adafruit.com/index.php?main_ ... 243b1c6bd8

Yeah I guessed that was the next step.

I've been following the tutorial here:

http://www.ladyada.net/learn/avr/avrdude.html

But it kind of skips out at the end - it says I need to set the fuses, but I'm not sure what values I should set them to - 328P chip.
I'm also not really sure what the test_leds.hex actually does.

I'm assuming that I need to write some C code, and then GCC it into a hex file - but not really sure what libraries to include etc... are there any tutorials on that?

(I've been a pure Arduino guy for too long, I thought it time I tried all this stuff for real.)
http://www.stephenhobley.com
http://www.youtube.com/shobley
For all your laser harp, tesla coil, and killer robots from outer space needs.
shobley
 
Posts: 184
Joined: Fri Sep 07, 2007 5:16 pm

Re: Need a nudge in the right direction

by uhe on Thu Jun 17, 2010 9:11 am

shobley wrote:But it kind of skips out at the end - it says I need to set the fuses, but I'm not sure what values I should set them to - 328P chip.

I'd say if it works leave them as they are. You can also use AVRdude to read the fuses somehow (I don't know which options to apply, just google for read avr fuses). Then you can enter the values into the fuse calculator mentioned in the tutorial and see whats up.

shobley wrote:I'm also not really sure what the test_leds.hex actually does.
Look at the blink.c and the Makefile in the hello world zip.

shobley wrote:I'm assuming that I need to write some C code, and then GCC it into a hex file - but not really sure what libraries to include etc... are there any tutorials on that?
There are good tutorials but I don't know any to point at :(
But there is sourcecode that you could read, UTSL ;)

shobley wrote:(I've been a pure Arduino guy for too long, I thought it time I tried all this stuff for real.)
In C one could say: everything starts with main(). From the hello world code:

Code: Select all | TOGGLE FULL SIZE
int main(void) {
  DDRB = (1 << 5);  // set PORTB5 to an output

  while(1) {
    PORTB |= 1 << 5;  // turn LED on
    _delay_ms(100);
    PORTB &= ~(1 << 5);  // turn LED off
    _delay_ms(100);
  }
}

In arduino land I think the example would look like this:
Code: Select all | TOGGLE FULL SIZE
void setup(void) {
  // set PORTB5 to an output
}

void loop(void) {
  // turn LED on
  _delay_ms(100);
  // turn LED off
  _delay_ms(100);
}

int main(void) {
  setup();
  while(1) {
    loop();
  }
}

It's not that different!
"I have not failed. I've just found 10,000 ways that won't work." - Thomas Edison
uhe
 
Posts: 178
Joined: Mon Sep 03, 2007 4:50 pm
Location: metric world

Re: Need a nudge in the right direction

by oPossum on Thu Jun 17, 2010 10:50 am

You can use an AVR Fuse Caculator to determine the hex values for the fuses.

Make sure you do not turn on Debug Wire or turn on Reset Disabled (leave both unchecked). Turning either of those on will prevent programming by a low voltage programmer like the USBTinyISP.
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
oPossum
 
Posts: 636
Joined: Fri Oct 26, 2007 12:42 am
Location: Michigan, USA

Re: Need a nudge in the right direction

by oPossum on Thu Jun 17, 2010 10:59 am

shobley wrote:I'm also not really sure what the test_leds.hex actually does.


It is for the MiniPOV3. Source Code
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
oPossum
 
Posts: 636
Joined: Fri Oct 26, 2007 12:42 am
Location: Michigan, USA

Re: Need a nudge in the right direction

by adafruit on Thu Jun 17, 2010 11:12 am

Please dont start messing with fuses, its not necessary and may brick your chip if you're not sure of what you're doing

go here
http://www.adafruit.com/index.php?main_ ... cts_id=174
Download the (updated) atmega328 blink zip and follow the directions

"To get you started, here is a 'hello world' zip file. It contains a C program, compiled .hex file and Makefile for a blinking LED connected to pin PB5. Wire up the board as shown here (don't forget the 3 jumper wires up top, they are essential!) Then install WinAVR or equivalent and run make program in the uncompressed folder to compile and burn the example. "

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Need a nudge in the right direction

by shobley on Thu Jun 17, 2010 12:28 pm

Perfect! That's what I was looking for...
http://www.stephenhobley.com
http://www.youtube.com/shobley
For all your laser harp, tesla coil, and killer robots from outer space needs.
shobley
 
Posts: 184
Joined: Fri Sep 07, 2007 5:16 pm

Please be positive and constructive with your questions and comments.