2018.7.9 AVR-BAT program

  I had some problems programming the produced . Here is what worked well for me:

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

1. Install Atmel Studio 7.0
2. Launch Atmel Studio 7.0 Command Prompt
3. Make sure that you do not have a CU connected to the RU.
4. Connect AVRISP mkII to RU/jig.
5. Find serial number of AVRISP mkII:
atprogram list

Output:
simulator No serialnumber found
atmelice J41800030546
avrispmk2 000200173037 <---- serial

6. Program eeprom:
atprogram -s <programmer_serial> -i ISP -d attiny44a program --eeprom --format ihex --file HPRU_hex_eeprom.a90 --verify

Output:
Firmware check OK
Programming and verification completed successfully.
7. Program flash:
atprogram -s <programmer_serial> -i ISP -d attiny44a program --flash --format ihex --file HPRU_hex_flash.a90 --verify

Output:
Firmware check OK
Programming and verification completed successfully.
8. Set fuses
atprogram -s <programmer_serial> -i ISP -d attiny44a write -fs --values E2DDFF --verify

Output:
Firmware check OK
Verification of write OK
Write completed successfully.

9. Set lockbits
atprogram -s <programmer_serial> -i ISP -d attiny44a write -lb --values FC --verify

Output:
Firmware check OK
Verification of write OK
Write completed successfully.

10. Connect cu with ru-test software to perform automatic testing.

That's it.

TROUBLESHOOTING

If you get output like the following:

Firmware check OK
[ERROR] Could not establish connection to device. Please check input parameters, hardware connections, security bit, target power, and clock values.
Failed to enter programming mode. Error received from tool:
Connection failed on the data line (MOSI)
Connection failed on the reset line
Connection failed on the clock line
Target connector seems to be reversed. (TCF Error code: 1)

You might have forgotten to disconnect the test-CU.

--

If the atprogram.exe command does not work, you can try to connect using Atmel Studio 7.0.
Start the program, go to the Tools menu and click "Device Programming".
Select Tool=AVRISP mkII, Device=ATtiny44A, Interface=ISP, click Apply, then Read device signature
and target voltage.

Another useful command may be

atprogram -s 000200173037 -i ISP -d attiny44a info

with output like the following

Firmware check OK
Tool avrispmk2 has firmware version: 01.18
Target voltage: 3.30 V

Device information:

Name: attiny44a
JtagId: N/A
Revision: A
CPU arch.: AVR8
Series:

Memory Information:

Address Space StartAddress Size

prog 0x0 0x1000

signatures 0x0 0x3

fuses 0x0 0x3

lockbits 0x0 0x1

data 0x0 0x160
REGISTERS 0x0 0x20
MAPPED_IO 0x20 0x40
IRAM 0x60 0x100

eeprom 0x0 0x100

io 0x0 0x40

osccal 0x0 0x1

Signature: 0x1e9207
OscCal: 0x8b
Lockbits: 0xff

Fuses:
EXTENDED (0b11111111):
SELFPRGEN OFF

HIGH (0b11011101):
RSTDISBL OFF
DWEN OFF
SPIEN ON
WDTON OFF
EESAVE OFF
BODLEVEL 0x5

LOW (0b11100010):
CKDIV8 OFF
CKOUT OFF
SUT_CKSEL 0x22

原文地址:https://www.cnblogs.com/huangbaobaoi/p/9285052.html