Make a device to communicate to the WICE-4M
Leap Electronics WICE-4M EPROM Emulator Reverse Engineered
To make the experience fit your profile, pick a username and tell us what interests you.
Make a device to communicate to the WICE-4M
Factor code for testing code on WICE Interface PCB
factor - 3.02 kB - 10/08/2020 at 23:05
PDF of the first version, schematic that was drawn in DesignSpark
Adobe Portable Document Format - 488.28 kB - 09/21/2016 at 04:31
Yes still working on project, I have been concentrating mainly on he PC software. Will post more as time goes by.
Have been working on getting some routines I had running in spin to work in Propeller Assembly, So far so good, I basic read a byte write a byte, read and write a byte with increment. The speed is still not to my satisfaction as of yet. Might try to do 16 bit and 32 bit read and writes that will get some things moving.
I have knocked up some code on my Linux Mint machine to communicate with the my WICE interface. So far all look good.
But sorry folks, I did not use C code not even Assembly.
I did it in factor, I have been using this language for 5 years now, I like its forthy-ness, interactive interface and the library of functions.
First I need open serial, this took some time work, how to do this on linux environment. I use library "io.serial" use "termios" and "streams" libraries. I had some issue on read operation, transmission was the easiest, only thing to remember is use the "flush" function to send the data out after "write" function.
: wice-start ( -- ) "/dev/ttyUSB0" 115200 <serial-port> [ break wice-ack drop wice-status drop wice-reset drop wice-read-memory drop wice-read-minc drop wice-read-saddress drop wice-close drop 0 wice-open drop wice-reset drop 0 wice-write-memory drop wice-reset drop 0x55 wice-write-minc drop wice-read-u30 drop wice-read-u4 drop wice-read-u5 drop wice-read-u6 drop wice-reset drop 16 wice-dump drop ] with-serial-port-fix ;
wice-start basically sets up a serial port tuple. The with-serial-port-fix opens the serial port into a stream namespace and then executes all function in the quotation [ ] .
: with-serial-port-fix ( serial-port quot -- ) break [ open-serial ] dip [ [ serial-modify ] keep ] dip [ [ stream>> 10 seconds over set-timeout drop ] keep ] dip ! [ [ stream>> dup in>> buffer>> 1 >>size drop drop ] keep ] dip ! [ [ dup serial-fd F_SETFL 0 fcntl drop drop ] keep ] dip [ stream>> ] dip with-stream ; inline
So in the quotation I run some function like wice-ack. Which sends out $00 on the serial port and read 1 byte back, does a test to see if it is zero.
! acknowlge the device : wice-ack ( -- ? ) 0 1byte-array write flush 1 read-partial ?first 0 = ;
I test each command and then I do a memory read function of 16 bytes x 16 lines.
! read memory addressed by address counter and increment : wice-read-minc ( -- d ) 4 1byte-array write flush 1 read-partial ; ! dump one inline : wice-read-marray ( n -- array ) <byte-array> [ drop wice-read-minc first ] map ; : wice-dump ( n -- array ) f <array> [ drop 16 wice-read-marray ] map ;
The result in an array of 16 byte arrays read from the WICE all values are in decimal, next I will do print that out as hex dump. Then I will try to do write array to memory.
So far factor has made testing very easy.
Built a big loop that looks for the first data on serial port. This is the command byte, each command is put through case statement to run a function. Some commands will wait for 1 to 4 bytes for parameters. All commands must return something, this could be 1 to 4 bytes of data this may change if future.
List of current commands
|Name ||Command code ||Parameter ||Return Value ||Description|
|NOP||$00||None||1 byte||Awake Command will always return $00 manly here to see we get some kind of response. |
|STATUS||$01||None||1 byte||Get status so far we $01 port A is open and $02 port B open for reading and writing.|
|RESET||$02||None||4 bytes||Reset the Address Counter. This should always return four $00 bytes 32 bits|
|READ||$03||None||1 byte||Reads the data in memory at the address of counter|
|READINC||$04||None||1 byte||Reads the data in memory at the address of counter then increment address counter.|
|ADDRESS||$05||None||4 bytes||Get the current address from the counter shadow 32 bits|
|OPEN||$06||1 byte||1 byte||$01 Open port A for reading and writing, $02 open port B for reading writing. Returns the status e.g. command $01|
|CLOSE||$07||None||1 byte||Closes access to all port and goes into ROM Emulation mode.|
|WRITE||$08||1 byte||1 byte||Write to memory addressed by counter, a read of memory is performed after write and read data is returned.|
|WRITEINC||$09||1 byte||1 byte||Write to memory addressed by counter, read of memory after write is returned and address counter is incremented.|
|READU30||$0A||None||1 byte||Get the shadow value of U30 latch output|
|READU4||$0B||None||1 byte||Get the shadow value of U4 latch output|
|READU5||$0C||None||1 byte||Get the shadow value of U5 latch output|
|READU6||$0D||None||1 byte||Get the shadow value of U6 latch output|
|WRITEU30||$0E||1 byte||1 byte||Write a value to U30 shadow latch and return the new shadow value|
|WRITEU4||$0F||1 byte||1 byte||Write a value to U4 shadow latch and return the new shadow value.|
|WRITEU5||$10||1 byte||1 byte||Write a value to U5 shadow latch and return the new shadow value|
|WRITEU6||$11||1 byte||1 byte||Write a value to U6 shadow latch and return the new shadow value|
I was working way with c code "simple IDE" for the propeller and notice the memory space was getting smaller and smaller until I ran out, I must of had optimise setting wrong. I did spend sometime trying work out what when wrong.
I when back to my original spin code. I will get back the c code another time.
I have build basically a spin driver to handle all parallel hardware signals, created "wice" driver handle control of the parallel driver.
The wice driver handles the writing to latches and the reading and writing of wice memory and maintains a shadow memory of all the latches and the address counter.
So far the main code is only utilising one processor and no assembly. Another processor is running serial communication.
Will look at putting parallel driver into a separate processor to get some extra speed.
Have been working on the firm for the Propeller, I started out using spin code for basic testing of I/O all looks good.
Decided to build code in C using Simple IDE.
So far I am able to write to WICE-4M memory and Read it back ok.
More work required to transfer data from PC to Propeller and WICE-4M.
This is the new Parallel PCB all the level shifters have been changed for better drive of TTL IC for WICE-4M. So far all looks good no issue with talking to WICE-4M. Now time to write code to start communication.
The Parallel port has now been redesign, getting made right now.
Used level shifters with a extra output current.
This should work a bit better than last buld
I did not do much research on the TXB0108 series of level shifters, the output pins do not have enough drive to switch a Parallel port with pull up resistors with 1K on the WICE, My bad, a redesign is on the way.
I did quick PCB in KiCAD, Using Parallax Flip PCB. With some level shifters going to DB 25 Printer connector.
I am really like these Flip board for making prototypes easy. Depending on the circuit you can utilise the power coming from the USB. Also have access to 3.3V.
The design for this PCB can be found on my bitbucket on this project page.
Become a member to follow this project and never miss any updates