As my latest project is moving to a 3.3V design, I've been working with the AT28BV256 EEPROM. Earlier projects used the AT28C256 (5 volt part) and my Monitor code supported programming the device by copying a core routine into Page Zero, which would use the bit toggle mode of programming per the datasheet.
As I'm traveling, I always bring one of my projects along, which allows me to work on in my free time. I found out that this code didn't work with the AT28BV256... even though it supports the same insitu programming. Turns out I needed to read deeper into the Datasheet. There's a difference... the 3.3V part requires a byte sequence to unlock the write function, where the 5V part did not. I ended up making a minor modification to get this working. It's a sequence of writing 3 bytes to two different addresses of the EEPROM, followed by the standard byte or page mode programming.
Here's the modified routine that I copy to Page Zero... which I use from the Monitor commands to either edit single byte locations or larger blocks of space to program. The variable "EEPROM" is the offset in the memory map where the EEPROM is decoded to, which is $8000 on my Pocket SBC.
Code:
;Byte write code for EEPROM.
; Note: AT28BV256 requires an unlock sequence for all write operations.
; This is different from earlier Atmel EEPROMs (i.e., AT28C256). The
; sequence must be sent first to unlock the device, then data can be
; sent for programming. Note that byte writes can be 1 to 64 bytes.
; The EEPROM is defined in constants for the Offset of the EEPROM in
; the hardware memory map.
;
BYTE_WRS SEI ;Disable interrupts
;
LDA #$AA ;Get code $AA
STA EEPROM+$5555 ;Send to EEPROM
LDA #$55 ;Get code $55
STA EEPROM+$2AAA ;Send to EEPROM
LDA #$A0 ;Get code $A0
STA EEPROM+$5555 ;Send to EEPROM
;
LDA (SRCL) ;Get source byte
STA (TGTL) ;Write to target byte
LDA (TGTL) ;Read target byte (EEPROM)
AND #%01000000 ;Mask off bit 6 - toggle bit
BYTE_WLP STA TEMP3 ;Store in Temp location
LDA (TGTL) ;Read target byte again (EEPROM)
AND #%01000000 ;Mask off bit 6 - toggle bit
CMP TEMP3 ;Compare to last read (toggles if write mode)
BNE BYTE_WLP ;Branch back if not done
CLI ;Re-enable interrupts
BYTE_WRE RTS ;Return to caller
;
I've also modified my Flash routines, which allow me to update the BIOS and Monitor code areas without having to carry a programmer with me. Of course, if you update with bad code, you'll need to go back to a programmer to fix it. Fortunately, I managed to update both the BIOS and Monitor on my project and it's still working
The latest BIOS update included a modified ISR that support the SC28L92 transmit FIFO to decrease the interrupts when transmitting and the above code in the Monitor to allow insitu programming with the AT28BV256.
Lastly... the At28BV256 is rated at 200ns access times. I started with a 4 MHz CPU clock, but a while back, I started using an 8 MHz CPU clock and it's been running without issue for a few weeks now. It seems Atmel (now Microchip) are pretty conservative with their ratings. I've used the older AT28C256 parts (rated at 150ns) with 10 MHz CPU clocks without issue, but I still tend to keep the overall clocks closer to the actual part specifications.