Line: 1 to 1 | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
%DASHBOARD{ section="banner"
image="/twiki/pub/Cosmac/RaspiElf/raspi-elfmemcard-s.jpg" | ||||||||||||||||||||||||||||||||||
Changed: | ||||||||||||||||||||||||||||||||||
< < | title="A Serial EEPROM as Mass Storage" | |||||||||||||||||||||||||||||||||
> > | title="Serial EEPROMs as Mass Storage" | |||||||||||||||||||||||||||||||||
titlestyle="color:#F00000;"
}%
Intro
| ||||||||||||||||||||||||||||||||||
Changed: | ||||||||||||||||||||||||||||||||||
< < | Forth without mass storage (blocks, screens) is a not complete. A SD-Card interface could be a reasonable solution but it is an overkill for a small Forth system. Small serial EEPROMs are for my opinion more suitable. | |||||||||||||||||||||||||||||||||
> > | Forth without mass storage (blocks, screens) is a not complete. A SD-Card interface could be a reasonable solution but it is an overkill for a small Forth system. Small serial EEPROMs are for my opinion more suitable. | |||||||||||||||||||||||||||||||||
Changed: | ||||||||||||||||||||||||||||||||||
< < | EEPROM Serial Communication
| |||||||||||||||||||||||||||||||||
> > | SPI EEPROMs
| |||||||||||||||||||||||||||||||||
SPI EEPROMs | ||||||||||||||||||||||||||||||||||
Changed: | ||||||||||||||||||||||||||||||||||
< < | Serial Peripheral Interface SPI, MC is the SPI master, the host is the slave. e.g. AT25M02 SPI EEPROM 2Mbit (256 KiB, $3), 25LC1024 (128 KiB, $2), or 25LC512 (64 KiB, $1.50). DIL8 Package. 64/128/256 KiB seems very small for today's standards where storage is quantified in GiB, but I think it's more than enough for a small Forth system. If you want more memory there is 16 MiB serial EEPROM W25Q128J from WINBOND, please note that is a 3.3 V part! | |||||||||||||||||||||||||||||||||
> > | The Serial Peripheral Interface SPI or four-wire serial bus is easy to use. The CDP1802 (MC) is the SPI master, the EEPROM is the slave. There are many different EEPROM types and sizes available e.g. AT25M02 (2Mbit, 256 KiB, $3), 25LC1024 (128 KiB, $2), or 25LC512 (64 KiB, $1.50). All available in DIL8 packages. 64/128/256 KiB seems very small for today's standards where storage is quantified in GiB, but I think it's more than enough for a small Forth system, the size is similar to early floppy disks. If you want more memory there is 16 MiB serial EEPROM W25Q128J from WINBOND, please note that is a 3.3 V device! | |||||||||||||||||||||||||||||||||
CLK MC ->- host MOSI MC ->- host | ||||||||||||||||||||||||||||||||||
Line: 62 to 61 | ||||||||||||||||||||||||||||||||||
Changed: | ||||||||||||||||||||||||||||||||||
< < | Sharing the LED and Switch port, you loose two LEDs and one switch. Possible conflict with the bootstrap loader, if there is a read sequence (CS and read pattern 0000 0011). To prevent this, set the EEPROM into HOLD state e.g. with the WAIT signal. | |||||||||||||||||||||||||||||||||
> > | Sharing the LED and Switch port, you loose three LEDs and one switch or IN. Possible conflict with the bootstrap loader, if there is a read sequence (CS and read pattern 0000 0011). To prevent this, set the EEPROM into HOLD state e.g. with the WAIT signal. | |||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||
Line: 77 to 76 | ||||||||||||||||||||||||||||||||||
Changed: | ||||||||||||||||||||||||||||||||||
< < | Raspberry Pi can emulate SPI EEPROM. On RaspiElf the switches/LEDs are already connected to Raspi's GPIOs. No need for additional hardware. But I have to write an SPI server for the Raspberry Pi.
Raspi's SPI interfaces can't be used because of conflicting port usage.
| |||||||||||||||||||||||||||||||||
> > | Raspberry Pi can emulate SPI EEPROM. On RaspiElf the switches/LEDs are already connected to Raspi's GPIOs. No need for additional hardware. But I have to write an SPI server for the Raspberry Pi. Raspi's SPI interfaces can't be used because of conflicting port usage. | |||||||||||||||||||||||||||||||||
Read Byte | ||||||||||||||||||||||||||||||||||
Line: 231 to 215 | ||||||||||||||||||||||||||||||||||
Added: | ||||||||||||||||||||||||||||||||||
> > | Serial EEPROM connected to Raspberry Pi
Serial EEPROM connected to Raspberry Pihttp://www.netzmafia.de/skripten/hardware/RasPi/RasPi_SPI.html
Read ByteWrite Byte | |||||||||||||||||||||||||||||||||
Line: 1 to 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Added: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > |
A Serial EEPROM as Mass Storage
Intro
Forth without mass storage (blocks, screens) is a not complete. A SD-Card interface could be a reasonable solution but it is an overkill for a small Forth system. Small serial EEPROMs are for my opinion more suitable.
EEPROM Serial Communication
SPI EEPROMsSerial Peripheral Interface SPI, MC is the SPI master, the host is the slave. e.g. AT25M02 SPI EEPROM 2Mbit (256 KiB, $3), 25LC1024 (128 KiB, $2), or 25LC512 (64 KiB, $1.50). DIL8 Package. 64/128/256 KiB seems very small for today's standards where storage is quantified in GiB, but I think it's more than enough for a small Forth system. If you want more memory there is 16 MiB serial EEPROM W25Q128J from WINBOND, please note that is a 3.3 V part!CLK MC ->- host MOSI MC ->- host MISO MC -<- host SS MC ->- host or other peripherals (optional)A high-to-low transition on the CS pin is required to start an operation and a low-to-high transition is required to end an operation. Invalid Opcode: If an invalid opcode is received, no data will be shifted into AT25M02 and the Serial Data Output (SO) pin will remain in a high impedance state until the falling edge of CS is detected again. This will reinitialize the serial communication. While in Hold mode, the SO pin will be in a high impedance state. In addition, both the SI pin and the SCK pin will be ignored. 25LCxxxx Instruction Set
Serial EEPROM Connected to MC's Centronics Connector (Switches and LEDs)
Serial EEPROM Connected to MC's Centronics Connector (Switches and LEDs)Sharing the LED and Switch port, you loose two LEDs and one switch. Possible conflict with the bootstrap loader, if there is a read sequence (CS and read pattern 0000 0011). To prevent this, set the EEPROM into HOLD state e.g. with the WAIT signal.
Read ByteCS0 EQU 0b1101111 CS1 EQU 0b0010000 CLK0 EQU 0b1011111 CLK1 EQU 0b0100000 DATA0 EQU 0b0111111 DATA1 EQU 0b1000000 ; MSB first READBYTE: LDI 0 PLO R5 LDI 0xFF PHI R6 LDI 0xFF - 8 PLO R6 SEX R0 BITLOOP: OUT4,0b01000000 ; CLK for SPI OUT4,0b00000000 INC R6 GHI R6 ; set CARRY SHRC GLO R5 B4 SETBIT ; branch if bit set SHL ; bit not set BR SAVEBIT SETBIT: SHLC SAVEBIT: PLO R5 GLO R6 BNZ BITLOOPabout 230 cycles for one byte -> 1 ms -> 1 KiB takes about 1 s @ 1.79 MHz Write ByteWRITEBYTE: LDI 0 PHI R6 LDI 8 PLO R6 SEX R0 BITLOOP: GLO R5 ; get the next bit SHLC , next bit is in the carry PLO R5 BDF SETBIT OUT4,0b01000000 ; CLK for SPI with data bit cleared OUT4,0b00000000 BR NEXT SETBIT: OUT4,0b11000000 ; CLK for SPI with data bit set OUT4,0b10000000 NEXT: DEC R6 GLO R6 BNZ BITLOOP Serial EEPROM patched on MC PCB
Serial EEPROM patched on MC PCBSPI Mode 0, data is always latched in on the rising edge of SCK and always output on the falling edge of SCK. For CS one output port bis is needed e.g. O7 or N2 (INP4) to start/end operation (A high-to-low transition on the CS pin is required to start an operation and a low-to-high transition is required to end an operation).
Read Byte; MSB first LDI 0 PLO R5 LDI 0xFF PHI R6 LDI 0xFF - 8 PLO R6 SEX R6 BITLOOP: OUT2 ; CLK for SPI, INC Rx GHI R6 ; set CARRY SHRC GLO R5 B2 SETBIT ; branch if bit set SHR ; bit not set BR SAVEBIT SETBIT: SHRC SAVEBIT: PLO R5 GLO R6 BNZ BITLOOPabout 200 cycles for one byte -> 1 ms -> 1 KiB takes about 1 s Write ByteWRITEBYTE: LDI 0 PHI R6 LDI 8 PLO R6 SEX R0 BITLOOP: GLO R5 ; get the next bit SHLC , next bit is in the carry PLO R5 LSNF OUT2,0b00000000 ; CLK for SPI with data bit cleared LSDF OUT2,0b00000001 ; CLK for SPI with data bit set DEC R6 GLO R6 BNZ BITLOOP Kermit/ZModem
Kermit/ZModemWhat about using KERMIT or ZMODEM protocol for the file transfer and use the file system on the host? No need to add additional hardware (SD-card is anyway to modern You could use an old CP/M or even a PDP11 as host. The C-Kermit Local Server mode, e.g. MC can read/write the blocks as filesblock.0 , block.2 , block.255 .
The serial communication is really slow, not only because of the 9600 baud, but you have to wait after each character to give CDP1802 some computation time.
https://github.com/utoh/pygmy-forth/blob/master/extras/kermit/pfkerm.doc
Comments |