SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
User avatar
By roach
#10608
Finally got it working. It looks like some compiler optimizations were doing something funny with the end result .hex file. I removed all optimizations (the hex file jumped in size from 700 bytes to 10K), and it seems to work fine now...

One thing I noticed when programming the uC, is that if pin 21 is connected to anything, the programmer will fail (device not detected, or somesuch). Any ideas as to why this might be? Whenever I wanted to re-program, I would have to disconnect my LEDs from VCC in order for the programmer to detect the uC...

Next Steps:

- Bootloader (prolly the STK500-emulating one)
- Terminal experiments using on board UART with my cp2103 breakout.
- ...
- PROFIT!
By transcendentnb2
#10609
roach wrote:One thing I noticed when programming the uC, is that if pin 21 is connected to anything, the programmer will fail (device not detected, or somesuch). Any ideas as to why this might be? Whenever I wanted to re-program, I would have to disconnect my LEDs from VCC in order for the programmer to detect the uC...
That's a redundant Vcc for the uC. Are you putting some sort of load on it that is bringing the voltage down too low?

http://www.sparkfun.com/datasheets/AVR/AVR-H128-sch.gif

EDIT: Ah, wait... The problem is probably just because you have your LEDs hooked up to PB1, which is the serial clock when programming through SPI. Disconnecting the Vcc of the LEDs (which I take is pin21 for you) will make them floating points in the circuit and hence won't effect anything.

The only way to get around that is by using a high impedance switching device for the LEDs (a transistor). Or, maybe put a switch between the LED's and Vcc so you can turn it off when needed?

EDIT2: On second thought.... it's probably simply because you don't have the series resistor. ...?
User avatar
By roach
#10615
transcendentnb2 wrote:The problem is probably just because you have your LEDs hooked up to PB1, which is the serial clock when programming through SPI.
I figured it was something like this, since LED #2 (on PB1) would light up whenever I plugged in the ICSP :)
The only way to get around that is by using a high impedance switching device for the LEDs (a transistor). Or, maybe put a switch between the LED's and Vcc so you can turn it off when needed?
I plan on using a bootloader over UART1, so this probably won't be an issue.
EDIT2: On second thought.... it's probably simply because you don't have the series resistor. ...?
heheh. Actually, I followed your excellent suggestion earlier, and there IS a series resistor on there now (shared between all the LEDs' VCC pins, since there's only ever one activated at a time).

Thanks everyone for all your help!