Ponyprog

All the development on TrxAVR-Picastar used an Atmel AVRISP2 USB programmer (cost £30 + VAT from Farnell)

Ponyprog is an alternative programmer.

The software can be downloaded free of charge from:   http://www.lancos.com/ppwin95.html

To program the Atmega2560, you must download and install version 2.07c beta or later
and then run PonyFix.exe.

PonyFix.exe simply replaces the PonyProg application file, PonyProg2000.exe with a modified version.
The modifications were carried out by Gerard Sexton, VK3CG.
The ATmega2560 has 256k of program memory. When we passed the 128k mark, we had to take some control
of where the different program modules were located in memory. This was done in order to ensure that all
functions that were referenced by 16 bit procedure pointers were in the lower 128k. The relocation resulted
in some modules being located in
their own code section in memory above the 128k mark..
PonyProg could not cope with this sectioned code above 128k. Gerard fixed it so that it did cope
(Internet searches revealed that we were not the only PonyProggers to have encountered this problem.)

The modified source code for this fix is in:    PonyProg2000-2.07d.zip
By making this source code available here, we comply with the terms of PonyProg's GNU licence.

PonyProg hardware

A suitable serial port programmer circuit ican be found at:

http://www.olimex.com/dev/images/avr-pg1b-sch.gif:

I have designed a single sided pcb for this circuit which you can download:

   Serial programmer layout (pdf)
   Serial programmer copper etching mask(pdf)

This board can carry the 10 pin IDC or the 6 pin IDC programming connector.
Use the 6 pin (The circuit shows a 10 pin connector)

Make sure that you use a DB9 pin right angled female connector that has the correct pin layout for the baord.
(I have found two variants.)

Programming instructions

Install Ponyprog. Run PonyFix.exe. Run PonyProg

Connect the programmer to your serial port and to TrxAVR-Picastar's programming socket.

Power up TrxAVR

Click Menu | Device | AVR micro    and select ATmega2560

Click Menu | Setup | IO interface      The window shown below appears

Make sure it is set to your selected COM port and is otherwise as below    

  

Click Ok to save

Click Menu | Setup | Calibration      Click Yes to proceed and expect a successful calibration

Click Menu | Command | Security and Configuration bits    The window below appears

  

Set the check-boxes as shown above and then click Write to send these settings to the ATmega2560.
Click OK to exit

Click Menu | Command | Write program (FLASH)

    

Set the check boxes as above (Hobcat will write the EEPROM later)

Click OK     programming will begin

The programming progress bar will reach about 30% after a minute of so and then will jump
to 50%. It will then steadily advance to about 75% and then jump to 100%. The verify process
will then begin. The verify progress runs 0% to 100% and so takes longer.

Encoders8

If you are using Encoders8 (built into TrxAVR-B) then you need to program the ATmega2560 in Encoders8.

Then go to Testing the processor and USB at the end of Setup 3 - programming

PonyProg - more explanation

We have advised setting the option to erase before programming. Erase sets every byte of the 256k flash
memory to 0xFF (ie: hexadecimal FF = decimal 256 = binary 1111 1111).
Note that we have advised setting the fuse to prevent erasing the internal EEPROM.

PonyProg first loads the .hex file into PC memory as follows:
It first allocates a block of memory the size of the device's flash memory (ie 256K for the 2560/1).
It then sets all of this 256k block to 0xFF.
It then places the code from the .hex file into this memory block at the places specified in the .hex file (Intel format).
So when it goes to program the device it is always working from a complete 256K buffer that matches the 2560’s flash.

When programming, PonyProg programs every block that is not “blank” ie set to 0xFF.
Blocks of 256 bytes which are 0xFF are skipped because that is the default state of the flash after an erase.

When programming TrxAVR, the status bar behaviour corresponds to where we have located the code in flash memory.
It moves slowly to around 30%, jumps to 50%, moves slowly to around 75% then jumps to verify.
( When doing the Encoders8 code, it will jump almost immediately to verify as there is very little code.)

In the verify stage, the same 256k PC memory block is used to verifie the device against.
The verify DOES work – however, it does assume you have an ERASED flash to start with
– if it is not erased, then it is likely that the verify will fail.
The verify process will go through the entire 256K of flash before reporting its result
and at present takes nearly twice as long as programming.

We therefore recommend that the flash is always erased before or as part of the programming sequence.
It is a chip erase and is VERY quick. As we have set the EESAVE fuse, the eeprom on the AVR chip will not be erased.

Doing this means that the verify WILL verify the correct programming of the AVR chip.
(However, it does take quite a while – several minutes.
Glenn reports a total elapsed time of about 10 minutes with his programmer).

 

TrxAVR-Picastar home page