Reading hex files from CheapStat

  • I'm trying to fetch the existing hex codes in CheapStat through AVRdude using WinAVR which isn't working - it shows timeout error. Are the read and write lock bits of the ATMega chip enabled?
    Do we need to attach the AT25DF041A-SH-B IC in order to be able to modify the firmware?

  • @AheliGhosh

    You will need to use an AVR ISP programmer - on the 6-pin PDI header. The programmer needs to be capable of programming xmegas such as the AVR ISP MKII (or one of the various clones).

  • @Will-Dickson Thank you for your advice. I'm using an AVR USB Programmer having an ISP connector. Could you please tell me whether some changes in the fuse bits are to be made? I have selected device name as AtMega32.
    My programmer is not able to detect the CheapStat microcontroller. It shows "Error communicating with AVR Device. Initialize communication with your AVR Chip failed."

  • @AheliGhosh

    No lock bits have been set. Note, not all AVR programmers can program xmega chips - they don’t use the AVR ISP method for interacting with the chip and burning new firmware like the atmegas. The xmegas use PDI–a different pin layout and protocol–and you need a compatible programmer. Do you have the make and model of your programmer - I can check whether or not it is capable of programming xmegas. The AVR ISP MKII programmers can program xmegas however some other programmers e.g. STK500, cannot.

  • @Will-Dickson I'm using the AVR USB Programmer of Robokits. The following link contains the model.

  • @Will-Dickson Also if the above programmer is incompatible, can you suggest whether the following one will be compatible or not

  • @AheliGhosh

    The mcu on the cheapstat is ATXMEGA32A4 which is on the supported list for the model : RKI-1043 programmer in your first link. I haven't used that programmer - so I can't really give you any advice on using it. However, it does look like it is compatible with avrdude. I do have repository online with modified version of the cheapstat firmware which is set up so that you can build/flash the firmware from the linux command line (using avrdude) as follows

    make hex - builds software and creates .hex and .eep files.
    make flash - flashs firmware to cheapstat using the avrispmkII programmer
    make clean - clean source directory

    Note, you may need to modify the "-c" option in the call to avrdude in the Makefile in order to specify your programmer.

  • @AheliGhosh

    Sorry here is the link to the repository

  • @Will-Dickson

    The following avrdude command should read the flash and eeprom to .hex files

    avrdude -c avrispmkII -p x32a4 -U flash:r:cheapstat_flash.hex:i -U eeprom:r:cheapstat_eeprom.hex:i

    Again you may need to modify the -c option for your programmer.

  • @Will-Dickson

    You could use the following to use the resulting files to program another device

    avrdude -c avrispmkII -p x32a4 -U flash:w:cheapstat_flash.hex -U eeprom:w:cheapstat_eeprom.hex

    I tested it out with the AVR ISP MKII and seems to work fine with the Cheapstat that I have. Again you may need to change the "-c" option for your programmer.

  • Thank you for all your suggestions. I tried using the programmer of the first link I sent to you through avrdude in linux by replacing -c option with both stk500 and stk500v2. It shows the following error - 'program enable instruction not defined for part "ATxmega32A4"'. The supplier of the programmer informed us that the product does not support PDI and has only ISP. We have decided to go for an AVRISPMKII programmer hoping that would solve the issue.
    It would be of great help if you could suggest us the better one of the following two options or provide us the link of the supplier from where you got the hardware. Thanks in advance.
    Thanks in advance.

  • @Will-Dickson I found out that stk500 and stk500v2 do not support PDI programming. And only these two are supported by the programmer available with me. So I think I will have to discard this one and go for an actual AVRISPMK2 programmer. I'm looking forward to your suggestions.

  • @AheliGhosh

    I haven't used these programmers - so I can't really recommend one over the other. However, if they work as advertised either should work.

  • @Will-Dickson Thank you so much for the suggestions. I could make it work with the AVRISPMKII programmer. Also, your modified firmware, especially the makefile was very helpful and made my work absolutely easy. Thank you once again.

Log in to reply