Author Topic: ISP programming avr IC  (Read 1846 times)

0 Members and 1 Guest are viewing this topic.

Offline ChrisWTopic starter

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 1
ISP programming avr IC
« on: September 27, 2011, 07:27:46 PM »
i'm not sure where to drop this question as it involves all three aspects.....

i'm trying to program an atmega168p with an ISP programmer made by sure-electronics (AVR STK500 V2.0 USB ISP Programmer clone) i didn't buy direct from them but a more local supplier (Solarbotics). yes i've given up on the HC11's for now :D

the setup:

using a 4 AA pack i have it regulated down to 5 V. The only things I have hooked up to the IC are Vcc (5V), Gnd (pins 8 & 21), Aref (5V), AVcc (5V), a 8.0 MHz crystal (with 2 22pF caps to gnd), 12K pull up resistor on reset (pin 1) and the 6 pin ISP programmer pins.

i found out the programmer will not work with studio 5 so i loaded on studio 4.19 (build 730).
It does detect as a stk500 and will get some info from my breadboarded circuit but is still doing this:

Getting isp parameter.. SD=0x03 .. OKOKOK
Reading FLASH input file.. OK
Reading EEPROM input file.. OK
Setting mode and device parameters.. OK!
Entering programming mode.. FAILED!
Leaving programming mode.. OK!

Do i need to setup the studio 4 programming wizard with the right .hex files or are they auto loaded after a successful build?
Do I need to upgrade the firmware on the programmer?
The programmer does have a open spot on the bottom of the case that I could insert a couple of pins but I'm not aware of what it would do so I didn't try it either. I do know that the unit will not auto load a firmware upgrade as the programmer needs to be in a boot mode or some such.

oh and here is the code: (sorry C kids it is in assembler)

.include "m168pdef.inc"

.def Temp = R16          ;Gives "Defines" Register R16 the name Temp

.org 0x0000             ;Places the following code from address 0x0000
   rjmp  RESET          ;Take a Relative Jump to the RESET Label
   
RESET:                  ;Reset Label
   ldi Temp, 0xFF       ;Store 255 in R16 (Since we have defined R16 = Temp)
   out DDRB, Temp       ;Store this value in The PORTB Data direction Register

Loop:                   ;Loop Label
   out PORTB, Temp      ;Write all highs (255 decimal) to PORTB
   dec Temp             ;Decrement R16 (Temp)
   rjmp Loop            ;Take a relative jump to the Loop label

just trying to light up some LEDs for a first go at these newer micros and hitting the proverbial wall. been beating my head against it for the last few days and finally decided to give a shout out for help.

any kick in the right direction will do. should note that my experience using studio 4 is pretty much limited to this weekend's frivolities, i was used to using dos based assembler compilers for old microcontrollers, but windows 7 is not DOS friendly.

thanks,
-Chris

Offline joe61

  • Supreme Robot
  • *****
  • Posts: 417
  • Helpful? 16
Re: ISP programming avr IC
« Reply #1 on: September 27, 2011, 08:32:37 PM »
Have you verified somehow that the ISP pins are connected to the right pins of the AVR? The failure to enter programming mode might be due to not bringing the reset line low.

I don't use Studio or Windows, so can't help you there. Sorry.

Joe

Offline Neuport

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: ISP programming avr IC
« Reply #2 on: September 27, 2011, 10:06:01 PM »
I have also had similar problems with my AVR Dragon programmer if there is something connected to SCK that sinks around 10mA or more.  It may also be sensitive on other of the ISP pins.  In my case I was programming an ATtiny85 with a optoisolator in my project circuit that was driven by SCK.  It failed to enter programming mode unless I disconnected that wire.  Eventually, I increased the current limit resistor on that line to drop the current to around 8mA and it now works fine.  You might try programming it with nothing else on the pins at first.

Interestingly, my chinese clone USBasp programmer and my Arduino Uno as ISP setup both work fine with the original circuit.  It was just the AT brand, much more expensive programmer that struggles with this situation.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: ISP programming avr IC
« Reply #3 on: September 28, 2011, 07:18:28 AM »
Hi,

Interestingly, my chinese clone USBasp programmer and my Arduino Uno as ISP setup both work fine with the original circuit.  It was just the AT brand, much more expensive programmer that struggles with this situation.
It's easy to make a programmer that can supply lots of current, but connect it up wrong and something dies - Quality programmers are usually designed with that in mind.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

 


data_list