EPROM

From SaturnWiki
Jump to: navigation, search

Description

From Wikipedia, the free encyclopedia

An EPROM, or erasable programmable read-only memory, is a type of computer memory chip that retains its data when its power supply is switched off. In other words, it is non-volatile. It is an array of floating gate transistors individually programmed by an electronic device that supplies higher voltages than those normally used in electronic circuits. Once programmed, an EPROM can be erased only by exposing it to strong ultraviolet light. EPROMs are easily recognisable by the transparent window in the top of the package, through which the silicon chip can be seen, and which admits UV light during erasing.

As the quartz window is expensive to make, OTP (one-time programmable) chips were introduced; the only difference is that the EPROM chip is packed in an opaque package, so it can not be erased after programming. OTP versions are manufactured for both EPROMs themselves and EPROM-based microcontrollers. However, OTP EPROMs are being increasingly replaced by EEPROM chips, which offer similar price of silicon and reprogrammability in a windowless package.

A programmed EPROM retains its data for about ten to twenty years and can be read an unlimited number of times. The erasing window must be kept covered to prevent accidental erasure by sunlight. Old PC BIOS chips were often EPROMs, and the erasing window was often covered with a label containing the BIOS publisher's name, the BIOS revision, and a copyright notice.

Some microcontrollers, often those from before the era of EEPROMs and flash memory, use EPROM to store their program. This is useful for development, as using one-time programmable devices would be horribly wasteful for debugging.

Saturn PCMs

The EPROM used in Saturn PCMs is a 27C256, which is 256Kbits(32KB). The Program's version (PROM ID) is stored in the first two bytes of the chip, or in the CPUs address space: 0x8000. The checksum is two bytes long and is stored at 0x8006 - 0x8007.

Checksum

Description

Each version of Saturn's program runs a checksum on the EPROM and EEPROM to verify nothing disasterous has occurred (worst case scenario a data pin breaks off the PROM and now the 6th bit of every byte read is 0). While this is a smart feature, one problem is you couldn't modify anything without the checksum being thrown off and the PCM throwing DTC 51 and going into Backup Mode.

Computation

Luckily though, the checksum is very easy to get. The checksum the program expects is stored at 0x8006 in the CPU address space. The checksum function will start reading at 0x8008, adding the contents of the byte stored there to a 2-byte buffer (Y). It then increases its address pointer, and adds the contents of 0x8009 to Y, until it reaches 0xFFFF.

  • NOTE: This is not always true, as the 0x0909 program is set to skip $F37E - $FF9F. Quite nice to write our own stuff to without changing the checksum.

It then compares this to the expected checksum, and continues on. If you do not wish to change the original checksum (For example, you would like a Saturn dealerships Service Stall System not to throw errors because it detects an unrecognized checksum) you can just add random bytes to the end of the PROM, before the interrupts, to make the checksum become the same as the written one.

"Test Mode"

Saturn also included a sort of "testing mode" for testing beta PCMs i presume. If you plan on making a lot of changes to the PROM, and testing out each one, you can set the checksum at 0x8006 to 0xDEAD (that's not a string, that's hexadecimal, as in: 0xDE, 0xAD) and whatever checksum is read from the PROM is always approved as being good. While this is great for testing small changes one after the other, it is highly recommended that you don't leave it as this permanently, as any hardware type failure with the PROM (pin breaking off as an example) will cause the CPU to execute invalid opcodes most likely, thus causing the CPU to try to read the INVALID_OPCODE interrupt and throwing itself into an infinite loop. So always put in your new checksum after you have made a change you wish to keep permanent.