Step-4: Programming the MC-1 CPU.
Once you can complete Step-3 successfully you are ready to
do some programming! Click on the 'WriteEEprom'
button and get the
following message,
Uploading
Intel Hex file to EEPROM memory
Addr: 00000 writing byte |4D|
Addr: 00001 writing byte |43|
Addr: 00002 writing byte |2D|
Addr: 00003 writing byte |31|
Addr: 00004 writing byte |20|
Addr: 00005 writing byte |56|
Addr: 00006 writing byte |65|
Addr: 00007 writing byte |72|
Addr: 00008 writing byte |20|
Addr: 00009 writing byte |37|
Addr: 0000A writing byte |2E|
Addr: 0000B writing byte |30|
Addr: 0000C writing byte |20|
Addr: 0000D writing byte |2D|
Addr: 0000E writing byte |20|
Addr: 0000F writing byte |20|
Addr: 00010 writing byte |48|
Addr: 00011 writing byte |65|
Addr: 00012 writing byte |6C|
Addr: 00013 writing byte |6C|
Addr: 00014 writing byte |6F|
Addr: 00015 writing byte |20|
Addr: 00016 writing byte |57|
Addr: 00017 writing byte |6F|
Addr: 00018 writing byte |72|
Addr: 00019 writing byte |6C|
Addr: 0001A writing byte |64|
Addr: 0001B writing byte |21|
Write from file to chip EEPROM was
successful
If it did not work properly then slow down the timing by altering the
timing value to a bigger number as in Step-3 above.
Now click
on the 'EraseALL' button then on the
'Test' button followed by the 'WriteFlash' button and get the
following,
Attempting
to write the program Flash Type-2
Uploading Intel Hex file
files/upprog.hex to Program Flash memory
Writing Addr: 00000 Data|05C0|
Writing Addr: 00100 Data|002D|
Writing Addr: 00200 Data|0D91|
Writing Image to Program Flash
Writing Page: 0000
Writing program Flash Page:0 to
chip
Verifying Page 00:80 Addr 00080
Writing Page: 0001
Writing program Flash Page:1 to
chip
Verifying Page 01:80 Addr 00100
Writing Page: 0002
Writing program Flash Page:2 to
chip
Verifying Page 02:80 Addr 00180
Writing Page: 0003
Writing program Flash Page:3 to
chip
Verifying Page 03:80 Addr 00200
Writing Page: 0004
Writing program Flash Page:4 to
chip
Verifying Page 04:80 Addr 00280
Write from file to Program
Flash was successful
Notice that you must click on the
'EraseALL'
button then the
'Test'
button and test the Flash for erasure before trying to program the
Flash! The EEprom can be programmed at anytime but you must set the
'EESAVE' fuse yourself (unset by
default) to prevent the
'EraseALL'
button from erasing the EEprom along with the Flash. Also once the
'EESAVE' fuse is set then the
'Test' button only checks the Flash
for erasure.
Step-5: Program the Fuses.
Click on the 'FuseBits'
button and set the 'EESAVE'
box. Click the 'FuseBits' button
again to see if it reads back as set. Repeat this sequence but unset
the box to see if the fuse is unset on reading back.
Now let us set the fusebits so that the chip will function correctly in
Demo-9.
Set the fusebits as shown below in Figure-6 . This enables ATmega128
mode ( unset M103C ) , turns
off the JTAG interface (unset JTAGEN
) and
set for the external crystal oscillator.
Fig-6 MC-1 Fuse Map Settings
Once the fusebits have been set as above in Figure-6, click on 'Apply' but be careful not to set
all 'CKSEL' fuses on as you
will then need an external clock source signal attached to the
'XTAL1' pin with the crystal removed to recover! ( You need to
have some form of clock source to run the 'SPI'
module in the chip so that you can do your programming! ) Why not alter
the software to block this? Well there are times when an external clock
source might be needed, and you have been warned!
Now check with an oscilloscope or logic probe that your crystal is
oscillating!
Close the programming software 'dbavrprog' and switch the MC-1 power
supply off then back on. Re-launch the programmer software and after
clicking on 'SetSerial' click
on 'ReadID' this should return
the
message,
'Looking for signature bytes = :
1E : 97 : 02 : '
If it does then you have moved from the default internal
oscillator to your crystal oscillator successfully! If not then you
need to replace the crystal and maybe the capacitors attached varying
the values within the range set by the AVRmaga128 workshop manual until
it oscillates.
Step-6: Verify the Programming and End.