AVR Dragon and AT90CAN128

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello!

I'm trying to program my AT90CAN128 with my AVR Dragon:

I'm using a test avr command in terminal: 

avrdude -p c128 -c dragon_isp -e

But all I get is:

avrdude: jtagmkII_getsync(): sign-on command: status -1

--------------------------------------------------

I've also tried USBASP with code:

avrdude -p c128 -c usbasp

but I got:

avrdude: error: program enable: target doesn't answer. 1 
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

 

Help?

Code is everything, code is life :D
 

Last Edited: Wed. Mar 15, 2017 - 10:31 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Add -v to avrdude to get more info about what's going on. Add more -v for more detail (up to 4 of them).

 

You didn't give much info about the environment though - is this even Windows or Linux for example?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have made some progress, but I got this:

avrdude -p c128 -c dragon_isp -U flash:w:Actuator_2k17.hex -F



avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.15s

avrdude: Device signature = 0x535353
avrdude: Expected signature for AT90CAN128 is 1E 97 81
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "Actuator_2k17.hex"
avrdude: input file Actuator_2k17.hex auto detected as Intel Hex
avrdude: writing flash (7992 bytes):

Writing | ##                                                 | 3% 0.23savrdude: stk500v2_command(): warning: Sampling of the RDY/nBSY pin timed out
avrdude: stk500v2_paged_write: write command failed
Writing | ###                                                | 6% 0.46s

and it just sits there

Code is everything, code is life :D
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using linux, was developing on eclipse with the avr plugin...

avrdude -p c128 -c dragon_isp -vv -U flash:w:Actuator_2k17.hex 

avrdude: Version 6.2
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/silard_g/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : dragon_isp
avrdude: stk500v2_dragon_isp_open()
avrdude: usbdev_open(): Found AVRDRAGON, serno: 00A20004966E
avrdude: jtagmkII_getsync(): Sending sign-on command: 0x86 (26 bytes msg)
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
  boot-loader FW version:        255
  firmware version:              7.39
  hardware version:              1
S_MCU:
  boot-loader FW version:        255
  firmware version:              7.39
  hardware version:              7
Serial number:                   00:a2:00:04:96:6e
Device ID:                       AVRDRAGON
avrdude: jtagmkII_setparm()
avrdude: jtagmkII_setparm(): Sending set parameter command (parm 0x03, 1 bytes): 0x80 (1 bytes msg)
avrdude: jtagmkII_getsync(): Sending get sync command: 0x80 (1 bytes msg)
         AVR Part                      : AT90CAN128
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     8    0 no       4096    8      0  9000  9000 0xff 0xff
           flash         65     6   256    0 yes    131072  256    512  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : DRAGON_ISP
         Description     : Atmel AVR Dragon in ISP mode
avrdude: jtagmkII_getparm()
avrdude: jtagmkII_getparm(): Sending get parameter command (parm 0x06): 0x81 (3 bytes msg)
         Vtarget         : 5.0 V
         SCK period      : 10.37 us

avrdude: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00savrdude: stk500isp_read_byte(.., signature, 0x0, ...)
avrdude: stk500isp_read_byte(): Sending read memory command: avrdude: stk500isp_read_byte(.., signature, 0x1, ...)
Reading | #################                                  | 33% 0.10savrdude: stk500isp_read_byte(.., signature, 0x2, ...)
Reading | ################################################## | 100% 0.15s

avrdude: Device signature = 0x535353
avrdude: Expected signature for AT90CAN128 is 1E 97 81
         Double check chip, or use -F to override this check.
avrdude: stk500v2_jtagmkII_close()
avrdude: jtagmkII_close()
avrdude: jtagmkII_close(): Sending sign-off command: 0x80 (1 bytes msg)

avrdude done.  Thank you.

 

Code is everything, code is life :D
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why oh why oh why do people use -F ?!?

 

avrdude already told you "this is not going to work" when it said:

avrdude: Device signature = 0x535353

but you use -F(orce) to say "I don't care if you get errors I want you to continue on regardless even though it is utterly pointless".

 

It was a very sad day when they added (or rather documented) -F in avrdude. What possible use could it possibly have?

 

I suppose there is that rare occasion where you are using some variant of an AVR that is not directly supported but has a very similar existing model. So you tell it to use -F and it may say:

avrdude: Device signature = 0x1E9782
avrdude: Expected signature for AT90CAN128 is 1E 97 81

But that's OK because you know a ...82 will work just like a ...81. But when you get values like:

avrdude: Device signature = 0x535353

then it cannot possibly be talking to an AVR as they all start 0x1E (which means "Atmel"). As soon as you see something like 0x53 then all bets are off and -F is not going to fix it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay, thanks for the loving reply on why not to use -F, usefull... So what can I do here? Erase the chip flash or?

Code is everything, code is life :D
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Clearly the dialog from avrdude to the Dragon is working. The bit that appears to not work is from the Dragon on to the AVR. The usual issue is wiring.

 

I see you say dragon_isp and it's a CAN128 then I guess you know that chip is one of a small bunch of unusual AVRs that do not use the same pins for SPI as ISP? So are you actually connecting to the correct pins on the chip?

 

The SPI is on pins PB0..PB3 but the pins for ISP are:

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have it like this:

1. 5V

2. PE0

3. PE1

4.PB1

5. RESET

6.GND

Code is everything, code is life :D
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is interesting. I also have a USBASP and I tried programming it with it:

avrdude -p c128 -c usbasp -U flash:w:Actuator_2k17.hex 

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9781 (probably c128)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "Actuator_2k17.hex"
avrdude: input file Actuator_2k17.hex auto detected as Intel Hex
avrdude: writing flash (7992 bytes):

Writing | ################################################## | 100% 3.67s

avrdude: 7992 bytes of flash written
avrdude: verifying flash memory against Actuator_2k17.hex:
avrdude: load data flash data from input file Actuator_2k17.hex:
avrdude: input file Actuator_2k17.hex auto detected as Intel Hex
avrdude: input file Actuator_2k17.hex contains 7992 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 2.11s

avrdude: verifying ...
avrdude: 7992 bytes of flash verified

avrdude: safemode: Fuses OK (E:F0, H:D9, L:FF)

avrdude done.  Thank you.

it worked... what the hell?

Code is everything, code is life :D
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dragon has been known to be flaky - how is it powered? In the past there have been suggestions to use it in a powered USB hub.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just use the usb from my laptop.

Code is everything, code is life :D
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The USB from your Laptop will be fine. Your CAN128 needs to be powered too. Perhaps from a different USB port.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The board is powered by 12v battery and a 5v regulator

Code is everything, code is life :D
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just check that you have everything wired correctly.