From: <hp...@sp...> - 2010-02-11 12:12:16
|
First, let me say that I am new to linux, so this might be a bit dirty, however; I have successfully programmed the AT90CAN128, based on the mega128 example and some small modifications. I am using: - Amontech JTAGkey-tiny - OpenOCD 0.4.0-rc1 dirty - libftdi - modified /src/flash/nor/avrf.c 1) Add the at90can128 to the list: /src/flash/nor/avrf.c line 53: struct avrf_type avft_chips_info[] = { // name, chip_id, flash_page_size, flash_page_num, eeprom_page_size, eeprom_page_num {"atmega128", 0x9702, 256, 512, 8, 512}, {"at90can128", 0x9781, 256, 512, 8, 512}, }; 2) However I still had problem erasing the chips with the command "avr mass_erase 0". So I moved the "avrf_mass_erase" code (line ~400) to the "avrf_erase" (line ~201) in the same file (/src/flash/nor/avrf.c): static int avrf_erase(struct flash_bank *bank, int first, int last) { LOG_INFO("HP HACKED: %s", __FUNCTION__); struct target *target = bank->target; struct avr_common *avr = target->arch_info; if (target->state != TARGET_HALTED) { LOG_ERROR("Target not halted"); return ERROR_TARGET_NOT_HALTED; } if ((ERROR_OK != avr_jtagprg_enterprogmode(avr)) || (ERROR_OK != avr_jtagprg_chiperase(avr)) || (ERROR_OK != avr_jtagprg_leaveprogmode(avr))) { return ERROR_FAIL; } return ERROR_OK; } So now the erase and programming of at90can128 is working! I hope this might be helpful for someone else. B.R. Hans Peter Mortensen -------------------------- This is the configuration: # for avr set _CHIPNAME avr set _ENDIAN little # jtag speed jtag_khz 4500 reset_config srst_only jtag_nsrst_delay 100 #jtag scan chain if { [info exists CPUTAPID ] } { set _CPUTAPID $CPUTAPID } else { set _CPUTAPID 0x0978103F } jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID set _TARGETNAME [format "%s.cpu" $_CHIPNAME] target create $_TARGETNAME avr -endian $_ENDIAN -chain-position $_TARGETNAME $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size 16384 -work-area-backup 0 flash bank avr1.flash avr 0 0 0 0 $_TARGETNAME #avr_program.cfg: # default ports telnet_port 4444 gdb_port 3333 tcl_port 6666 init jtag_khz 4500 reset init verify_ircapture disable halt wait_halt poll #avr mass_erase 0 flash probe 0 flash write_image erase /home/navis/test.hex reset run shutdown |