There are only two things you need to do to turn an AVR into an UberGROM. (After that, use it on the board in the TI and stop thinking of it as an AVR, it's a product at that point. ). You can and should load software with GROMCFG, or even the standalone loader GROMLOAD, unless you know better - that tool is meant to make it easier to distribute and load finished images. People are free to distribute the standalone loading tool with their products.
Those two things are :
- set the fuses
- load the firmware
The fuses are the configuration settings for the microcontroller. On my VS4800's "VSPEED" software it's under "Set->Config or Encrypt". Every AVR has a slightly different set, but the 1284P has the following settings which should be SOMEWHERE on the relevant dialog. The settings are just bytes, but most programmers split them up into checkboxes for ease of writing. Mine looks like this:
fuses.jpg 60.86KB 14 downloads
First is the lock bit byte, containing:
BLB01, BLB02, BLB11, BLB12 - These set the lock mode for the boot block
LB1, LB2 - These set the lock mode for the rest of the memory
These are used to secure the chip against accidental writes and against reading back the data. Since we need to be able to write to the chip and we aren't trying to hide the code, they should all be unset (and on the AVR, unset is a '1'). So nothing selected, and the final byte value should be 0xFF. (Some tools like the VSPEED I use writes hex with an 'H', so 'FFH' instead).
Don't play with these settings to see how they work unless you are prepared to erase the full chip and start from blank again - they can not be unchecked without a chip erase. (They wouldn't be very good security otherwise! )
The "Extended Fuse Byte" has just three bits defined:
BODLEVEL0, BODLEVEL1, BODLEVEL2 - this sets the level of a Brown-out detector. It's purpose is to hold the chip in reset when the voltage is too low to operate. Setting 0 and 1 puts the brown out voltage at 4.3V, which I recommended just in case the TI power supply comes up unevenly. The AVR can run just fine down to 3v, so that level ensures power is stable when it starts. This results in a write value of 0xFC.
The "Fuse High Byte" might also be presented as the high byte of a 16-bit value. I'll split it into High and Low because that's what the datasheet does. The high byte sets 8 bits:
OCDEN - enables an on-chip debug mode that runs the clocks even in sleep mode. Should be DISABLED.
JTAGEN - enables the JTAG debug interface. MUST be DISABLED (we use the pins to talk to the TI).
SPIEN - enable serial programming mode. I often use this so I leave it ENABLED.
WDTON - Watchdog timer always on. The software doesn't use watchdog so this MUST be DISABLED.
EESAVE - preserves EEPROM during chip erase. For UberGROM leave it DISABLED.
BOOTSZ1,BOOTSZ0 - sets the size of the boot memory (firmware in this case). Both MUST be ENABLED which results in an 8k boot area.
BOOTRST - moves the reset vector to the start of the boot memory. MUST be ENABLED.
This results in a high byte value of 0xD8.
The "Fuse Low Byte" has these 8 bits:
CKDIV8 - divides the system clock by 8. Should be DISABLED unless you like a really slow system.
CKOUT - outputs the clock on one of the pins. MUST be DISABLED (we use that pin to talk to the TI)
SUT1,SUT0 - start up time delay. Both should be ENABLED which is fastest start because the brown out detector will watch the power for us in hardware.
CLKSEL3,CKSEL2,CKSEL1,CKSEL0 - clock selection. All but CKSEL1 MUST be ENABLED, CKSEL1 MUST be DISABLED. This selects the internal 8MHz clock.
This results in a low byte value of 0xC2.
It was those CLKSEL bits that were giving people problems. If they are set to (almost) ANYTHING ELSE, then the chip has been told to use an external clock. With no clock, nothing happens, so it appears to be dead. Nothing is broken or bricked, they told it to use an external clock then didn't attach an external clock! This is where we were talking about getting an external oscillator to feed a clock signal for recovery - I posted a picture showing that it even works just dangling from three wires. It's more than enough to get in and fix the fuse setting anyway.
Anyway, once those fuse bits are set, program and verify them (on VSPEED it's just clicking 'ok' then reloading the dialog to make sure it took).
That was the hard part. Loading the firmware is just like programming a flash chip. Almost.
Download the archive from my website (http://harmlesslion.com/software/grom). Of all the stuff in the archive, the only thing you care about is "ubergrom.hex".
Remember when I told you all the files you load into your programmer are BINARY until you know better? Here's a case where you know better. "Intel Hex" is a common old-school way for program images to be passed around - it's literally a text file containing the hex bytes in readable ASCII, with some special formatting and checksums for good measure.
So when you go to load the data, tell your software that it's an Intel HEX file. Leave the offsets all default -- Intel HEX files also contain address pointers, so it should load to the right place. After it loads, your buffer should be all FF until you scroll all the way down to 0x1E000 (note the number of digits - more than 64k!). This is the bootloader area of the chip. You'll want to double-check that. On mine it looks like this:
bootloader.jpg 132.66KB 8 downloads
Go ahead and program that. When it's done, it's ready to load into the UberGROM board and run on the TI. You do not need the 512k flash chip to run the GROM, and you do not need the GROM to run the 512k flash chip -- so you can go ahead and test the GROM before you worry about the flash.
You only ever need to do the above steps once! Unless it somehow becomes corrupted (which I have never seen happen!), the firmware will stay put no matter what you do on the TI Side. The TI interface code is not able to overwrite the firmware, not even accidentally.
A quick technical note, skip if not interested in the technical parts - on startup the AVR code checks if the configuration area in EEPROM is blank, which it will be in this case. When it finds this, it does a basic initial configuration. This initial configuration was designed to activate a test program, but that test program isn't loaded anymore, so you'll just see a basic configuration in GROMCFG when you get there. Thus it is fine to not load any EEPROM data on a fresh chip.
When you boot it up, it will be completely blank, so in order to load any software you need access to a program loader. You can either use the Playground loader that was developed for XB27 (which runs from TI BASIC), or just hold space bar while turning on the console. This space bar recovery only works the first time you power on -- it does not work on reset (not even if you have a reset button!). This is just to minimize conflicts. (NOTE: this startup recovery is not yet implemented in Classic99). When you do this, you'll get two additional options added to the selection menu:
recovery.jpg 72.51KB 3 downloads
"EASY BUG" is the Easy Bug debugger from Mini-Memory (but the CS1 parts are removed). This may be useful to poke around a little bit. "RUN PROGRAM FILE" is the program image loader from Editor/Assembler, and can be used to run GROMCFG. (GROMCFG is also included in the archive. GROMLOAD is the loader-only version).
In most cases, if you're an end user, you hopefully just have a save dump from GROMCFG (such as the XB27 image), you can run GROMLOAD from your disk system and load the file.
GROMLOAD looks like this, just follow the prompts:
gromload.jpg 57.48KB 5 downloads
GROMCFG looks like this, consult the UberGROM manual:
gromcfg.jpg 93.11KB 3 downloads
A BIG WARNING: DO NOT RUN THESE PROGRAMS ON FINISHED, RELEASED CARTRIDGES. If you erase the settings or the GROM, the cartridge won't work anymore and you'll have to reload it. We had some trouble where GROMCFG was setting default parameters on launch without saying anything and people's XB27 stopped working -- there's no guarantee all such bugs are caught. Use this software only for making new cartridges or reloading/updating existing ones, not just to look around.