Wednesday, March 30, 2022

Wiring the logic analyzer to IOB6120, working on flashing the rom chip for IOB6120

 LOGIC ANALYZER CONNECTION TO IOB6120  MORE TWISTS AND TURNS

A clock is needed by the logic analyzer to know when to sample various signals, but the 50 pin expansion connector to the IOB6120 does NOT carry any clocking signals. The designer of that board depended on a much faster local FPGA clock to let him sample and detect the signals on the connector. I could do that and waste a lot of the limited memory space in my logic analyzer, but instead tied to the 5MHz clock on the SBC6120 CPU itself since that generates all the signals of note.

The FPGA runs at a bit over 29MHz, so I saved space in about a 6:1 ratio by finding the proper clock. It is present on pin 10 of the HD6120 microprocessor chip, which is where I snag it to wire to the logic analyzer clock input. 

MY APPARATUS TO PROGRAM FLASH CHIP STILL NOT PERFECT

With the change of the RD/BY# pin and the introduction of hardware to capture the low-hi transition of that signal, I had a setup that I believed could properly control the 29F400 flash chip to write the contents of my PC based file into the first 128000 bytes of the chip.

However, I found that it sometimes stalled partway through a block of 256 bytes - the transition wasn't detected or didn't occur, thus my code hung up. In addition, when I did a dump of the first block, I still saw the first value xE2 repeated for the first two locations, with everything else pushed 'rightwards' or 'downwards' one position. This could be a flaw in the reading or a flaw in the writing - more investigation is necessary.

I will refactor the code once again. My thinking is that I am free to issue a new command sequence as long as the RD/BY# signal is high, even if I didn't see it dip low for some interval. Thus the interrupt routines for the rising edge detection can go away. I will also carefully slow down the code that dumps one block, to make sure that I am not inducing the problem by changing address lines too close to when I read the results. 

Debugging my flash loading apparatus, gluing rubber sleeve to 1130 Expander chassis, hooking IOB6120 to logic analyzer

 DEBUGGING MY FLASH CHIP LOADING SETUP

My code to read the text file and respond to the prompts from the Arduino worked fine. The entire file can be transmitted, set up for writing and every checksum validates cleanly. However, when I write the contents to the flash I see an anomaly.

The first sector begins with a string of bytes, the first of which is xE2 but when the block of 256 is read back from flash, I see xE2 duplicated in locations 0 and 1, with the remainder offset by 1 and the final byte of the block lost.

My suspicions are focused on the RD/BY# signal and the handling of it by my Arduino sketch. This signal is an open collector output of the flash chip, requiring a weak pullup on the Arduino input to pull it high when not asserted low. 

I foolishly assigned this to pin 13 of the Arduino Mega, which as anyone who works with these knows is the pin that is wired to a resistor and LED on the board. Great for blinking a LED without wiring one up, but not so good as an input pin. 

I have reassigned this to pin 50, in the same port B as pin 13 but without the interference of the LED connection. I simply had to shift the bit patterns I used to make it input, turn on the pullup resistor and to read it with my sketch.

The other issue is timing. I really need to know that the pin went low and then returns to high to be sure that the automatic process, either writing (programming) a byte or erasing a sector, has completed. I suspect that I am not waiting thus barging in with a new request too early. Ideally this would be interlocked, the sketch requiring it to go low and then waiting for it to return to high.

I don't have sufficient control over timing to be sure that I am looking at the proper time for it to be low, so I will make use of the Atmel processor signal lines which trigger interrupts when the signal makes certain transitions. A bit more complicated to program but certain to catch a low to high transition. 

RUBBER SLEEVE GLUING WITH GORILLA GLUE IS WORKING WELL

I have to wait 2 hours for each glue joint to be fully set before moving on, thus there are four intervals of gluing required to get this in proper shape. Two were done this morning and the rest will get done when I return to the shop.

IOB6120 CONNECTION TO LOGIC ANALYZER

As I look at my carefully constructed line flipping cable, I seemingly have what I need to connect the logic analyzer and begin capturing status. I have a long lead header from the FP6120 where I can hook up the mirroring cable and also make connections to logic analyzer lines. 

Alas, I checked carefully and the SBC6120 does not buffer the signals going out on the connector, thus a ribbon cable introduces too much capacitive loading, signal distortion and delay to work properly. Back to the drawing board. Perhaps the best I can do is the long pin header between the sandwich of IOB6120 and FP6120. 

Tuesday, March 29, 2022

Gave up on finding Windows serial terminal to upload file with prompts; writing Python code to handle the job

TIRED OF DOWNLOADING PROGRAMS ONLY TO FIND THEY LACK PACING FOR FILES

I investigated more than a dozen programs, none of which offered the basic functionality I needed. I want the program to open a text file and feed lines to the serial port, but waiting for a prompt character from the far end before sending each line. 

PYTHON AND A WEE BIT OF CODING TO HANDLE THE JOB

It was a teeny bit of Python code to accomplish the task of reading all the lines of the text file and then looping, reading until we see the prompt character '>' from the Arduino then sending a line. When the input text file is exhausted we close the com port and go away. 

Investigating Arduino rig to write flash contents, completing IOB6120 probing cable

VERIFYING SIGNAL OUTPUTS OF ARDUINO MEGA USED FOR FLASH WRITING

I whipped up a sketch to assert and turn off the key control signals allowing me to verify that they worked properly on the Arduino I used. All was good with them, except for the data lines that run to the chip. I read the port directly after loading it but got back nonsensical values. 

It turns out that I failed to initialize port A as output, instead it was acting as an input so that when I wrote a 1, it turned on an internal pullup and when I wrote a zero it had no pullup, but in neither case was it driving output to the chip. A simple correction and then all was well. 

TESTING MY SKETCHES TO ERASE SECTORS, WRITE DATA AND VERIFY THE FLASH

My program to write a small bit of the flash chip now worked perfectly. When I ran the dump sketch the data coming out was exactly the 256 bytes that I wrote. Now I had to erase it again in order to program it with the proper contents from the file. I ran the eraseflash sketch and it reported all were erased to xFF. The dumpflash verified this was true. 

HUNTING FOR A TERMINAL PROGRAM OR WRITING A PYTHON SCRIPT TO LOAD FLASH

Each block of 256 bytes involves sending 32 text lines followed by a checksum line - repeated for the total of 128,000 bytes to be written. It is wholly impossible to hand type all those lines without any errors - not even considering the time it would take to accomplish this. 

The proper method is to have a terminal program that waits for a prompt character from my Arduino, such as a '>' and then sends one line of the text file. It should loop through the entire text file loading it to the sketch as fast as the Arduino completes processing each block of the file. 

Not only do I have to send all those lines, roughly 16,500 lines including checksums, but I have to do it a second time for the verification program that reads the flash and compares the contents to the file results. This underscores the need for a programmatic or application that handles the prompt and file transmission.

FINISHING THE PROBING CABLE AND HOOKING UP LOGIC ANALYZER

I moved the gear over near the logic analyzer and set up everything - the FP6120/SBC6120, the IOB6120, the power supply and the Surface Pro with the USB serial terminal program - to begin the debugging process. 

Connecting the cabling is more troublesome than I expected. Some of the connector ends are rounded on the side and won't fit into a standard 2x25 socket. Often I have two female sockets that must be connected, requiring some form of gender adapter such as a two ended male header. It is frustrating but eventually should be ready to run some debugging sessions.

AIR CONDITIONING OUT, PLUS ASR-33 WORK THIS WEEKEND WILL DISPLACE MY WORK

The air condition on the roof of the workshop gave up the ghost last week. It reaches mid to high eighties inside the shop, bearable but not pleasant. The coil sprang a leak, can't be repaired and must be replaced, thus we need to wait on the parts to arrive before the shop goes back to normal temps.

From Friday through Sunday I will switch over to work on the ASR/33 teletypes with a friend, hopefully getting them working properly so he can take them back to his place and put them to good use. 

GLUING RUBBER SLEEVE ON 1130 EXPANDER BOX OPENING - ROUND TWO

I cut some heavy rubber to fit around the opening of the chassis where the many signal wires run out to the 160 pin connector. I bought fast setting epoxy which I expected to hold it in place but the darned glue never set properly nor held the rubber in place. The flaps of the rubber are bent over 180 degrees around the metal of the chassis opening, which results in a fair amount of unbending force from the rubber. Even with clamps holding it for a week, the epoxy is not doing the job.

I switched over to Gorilla Glue, attempting the first of the four flaps this afternoon. The box claims that it requires 1-2 hours with clamps - I will leave it on overnight and evaluate tomorrow. I sure hope that works as my progress is stalled waiting on this mechanical issue to be resolved. 

Sunday, March 27, 2022

Building cable to probe IOB6120, testing eBay 28F400 chip, testing Arduino flash loader device

THE CHALLENGE MONITORING SIGNALS WITH LOGIC ANALYZER

The IOB6120 board plugs onto the rear of the FP6120 front panel board using a 2x25 header plus a 2 pin connector. The male part of the header is on the bottom of the IOB6120 and the female header socket is on the back of the panel. Thus when they are plugged together the connector is hidden in the sandwich of the boards and can't be accessed.

Almost all the parts on the IOB6120 are surface mount and often with very fine pitch pins, making it almost impossible to clip probes onto pins to capture signals. The only practical way to monitor its operation is to capture the signals over the 50 pin header.

Since the male header is on the bottom of a board and plugs into a female below it, the handedness of the pins is reversed between the two headers. That is, pin 1 is in the upper left on one of the connectors and the upper right on the other connector.

This obviates using a simple cable method to probe the signals. If the chirality didn't change, I could have used an internal SCSI cable with three connectors, plugging one onto the FP6120, one onto the IOB6120, the using the third to attach lines to the logic analyzer. However, with the flip of signals, a signal on pin 1 is carried to the wrong pin of the other side. 

internal SCSI cable and breakout for logic analyzer connection

BUILDING THE CABLE

I bought some cables that allow me to cut apart and easily resolder the wires between a pair of 2x25 header connectors such that the pins flip and create true connections between the IOB6120 and FP6120. I carefully checked the new connections before installing this on the FP6120. I could then make use of the three connector internal SCSI cable to plug in the IOB6120 and attach logic analyzer leads.

Starting to flip the pins to cure the mirror image issue

Setup ready to hook to scsi cable and front panel

EBAY FLASH CHIP INSTALLED AND TESTED ON IOB BOARD

I found a seller claiming to have new unused Intel 28F400 chips for sale. They arrived a few days ago and I soldered one down on the IOB board. If it is real and works properly, then I can use the firmware of the SBC6120 to load the flash contents via the FL (flash load) command. This takes the text file on my PC and transfers it over the serial connection to the SBC6120 system.

When I first tested it, the SBC6120 hung during initialization, at the point where it issues a read to the flash chip on the IOB6120. This could be caused by defects in the board I built but more likely was a problem with the newly installed flash chip.

I pulled out the continuity tester and validated the connection between the flash chip pins and the far end of each such signal. This ensured that the solder joints are good and as well I tested for shorts to adjacent pins. I found that address pin A6 and the RD/BY# (ready, not busy) pins didn't have good connections. 

Even with that repaired, however, the startup of the SBC6120 hangs during the testing of memory, thus the board still isn't working properly. There are many things this could be including a fake flash chip, but I really can't proceed further without the logic analyzer capturing state during the startup. 

PUTTING TOGETHER MY ARDUINO SYSTEM TO LOAD 29F400 FLASH

Now that I have a pretty well tested set of Arduino sketches, at least offline on the Wokwi.com simulator, It is time to test with the actual chip. I installed the surface mount chip on an adapter whose DIP 48 pins were plugged into a breadboard. I wired up the 19 address lines, 4 control lines and 8 data lines to the Arduino Mega 2560, having flashed the first program which reads the contents of the 128K where I will store the ROM data. 

setup to load and verify flash chip outside of IOB board

I can monitor key signals with my oscilloscope to ensure proper timing and operation, thus I should be able to test the first of the three sketches to be sure I am able to talk to the chip. I chose the programming sketch, the one that accepts the text file lines over the USB serial link to the Arduino, parses them and writes the contents to flash, with a brief initial use of the verify sketch just to watch my control signals. 

More accurately, writing on a flash is called programming and all it does is set bits to 0 when its input is 0, but ignores 1 bit inputs. Thus, one has to first erase the sector, which sets all bits to xFF, after which you program it to flip the desired bits to 0 and leave the others at 1.

The verify sketch will set up the control lines appropriately and then assert addresses to the flash chip, let them stabilize, then lower CE# followed by OE#. That is held at least 35 ns. It enables the chip and turns the data lines to output. Sometime during the 35 ns the contents of the byte on the chip should appear on the data lines, get captured by my Arduino sketch, after which I drop the two control signals. 

The result, for a factory fresh chip, should be all 1 contents since the sectors are initially erased out of the box. The best I can do to check the chip and my setup is to run this to read out a word of flash which should show up as xFF. If the signals look correct, the minimum times for signal assertion are obeyed and the output looks good, I can move on to program some contents.

I will switch to the programming sketch, write a bit of the file to the flash chip and verify that ti seems to respond properly. Each write is a sequence of four cycles where I assert CE# and WE# sending specific patterns as well as the byte address and data to be written. At the end of the four cycles, the chiip should take some time to accomplish the write, signaling successful completion by raising the RD/BY# output signal. 

TESTING THE ARDUINO LOADER AND FLASH CHIP

When I hooked everything up and ran the first sketch to read byte 0, or any byte, I got xFF which is plausible. However, I then ran the code to program the chip, which seemingly worked correctly as the RD signal was asserted saying the write was complete, but the attempt to read returned the same xFF contents. 

I hooked up my oscilloscope as a first cut at diagnosis. I watched the RD/BY# line from the chip and tried to trigger on it going low - which is what should happen when the write is underway - but it never dropped. I then moved the probes over to the control signals to the chip to observe the waveforms and timing. I expected to see OE# stay high but CE# drop to low for a while with WE# dipping low inside that interval. I found that WE# was low at all times, which is not correct. 

My sketch should drop it for a short period, otherwise it would be high. I disconnected the wir from the flash chip to see what the Arduino is outputting but that still was low. This doesn't make sense. I verified that an Arduino would keep that pin high except for the dip during a write, which isn't happening here.

I need to dig deeper into this result to understand what is happening. If it is low all the time, it will definitely keep the chip from receiving the programming command (write) and should keep it from being read as well since OE and WE should never be asserted at the same time. I suppose I could even have a broken Arduino Mega 2560 board. 

Friday, March 25, 2022

Testing code to load the flash chip without having an Arduino handy

WOKWI.COM ARDUINO SIMULATOR TO THE RESCUE

I don't have any Arduinos at home and, due to family visiting, am not going over to the workshop. I initially thought the best I could do was to desk check my programs, leaving actual execution until the guests have departed.

Fortunately, I discovered the Wokwi effort, an Arduino simulator, which lets me load my sketch (program) and execute it, sending text over the Serial Monitor provided by the simulator. I was able to add in plenty of diagnostic outputs, validate the results, and improve the code quality.

I was even able to wire up some virtual LEDs and slide switches so that I could see signals being asserted and change inputs. The actual chip control signals CE# and WE# are off only on the order of 30 microseconds per access of the chip, essentially they stay lit to the human eye. On the other hand, I could validate the OE# signal when the program switches to read mode for verification of the data we just wrote.

USED MY SPARE TIME AT HOME TO TEST EXHAUSTIVELY

I took advantage of the simulator to verify the operation of the program in depth, assuring me that the edge cases work properly and all the validation ensures that only properly formatted data is accepted over the USB serial link. 

The file provided with the IOB6120 to load the flash ROM does not have a specific delimiter at the end of the file, it just runs out of data, the read times out and the load command is considered complete. I decided I wanted to tailor my program with a more definitive termination, so I went to the last block of data, converted the octal block number to a 19 bit chip address and coded the outer loop to end when we finish that block.

I sent data lines with the next to last block number, which did not terminate the load portion of the program. When I sent data lines with the last block number, the code worked properly, exiting the loop after writing that block to flash.

The checksum verification for each block is just the summation of all the data bytes in the block, trimmed to the low 12 bits. I sent data lines with various values for the bytes and assured that the checksum had to match to successfully accept the block for writing. 

All the numbers must be valid octal digits, only characters '0' through '7' are acceptable. The line has mandatory spaces between the address and between each three character byte value, which I check. Too, the address has a decimal point between the block number of four octal digits and the relative byte start value of three octal digits. The end of the address is terminated by a '/' character. 

Monday, March 21, 2022

Code written to write a PC file to the flash chip for the IOB6120 board

FLASH CONTENTS IN PC FILE IN OCTAL WITH CHECKSUMS

The data to be loaded into the flash chip is in a text file in a specific format designed for the SBC6120. The data is written in octal, three characters per byte, with spaces separating them. Eight bytes of data are on each line, started with an address in octal and terminated by a line end. 

The addresses are of the form xxxx.yyy/ where the xxxx identifies which block of 256 bytes where the data belongs, and the yyy representing the relative address within that block of 256. The xxxx part of the address happens to advance sequentially in the data file I was given. The yyy value runs from 000 to 370 since the last line is for bytes 248 to 255 of the block. 

After each eight lines (one block of 256 bytes) we have a line with a four digit octal number that is the checksum of the preceding 256 bytes. Each byte is added to a running counter that is one PDP-8 word long (12 bits), rolling over as necessary, to form the checksum. 

0000.340/ 074 004 211 306 002 005 143 221 

0000.350/ 003 074 006 012 326 000 377 042 

0000.360/ 300 244 257 325 277 256 205 376 

0000.370/ 274 201 036 174 375 014 162 326 

1363

0001.000/ 014 056 374 373 040 014 372 047 

CODE WRITTEN TO READ THE FILE, CONVERT TO HEX AND VERIFY CHECKSUMS

The file will be read on the PC by the terminal program (PuTTY) and sent over line by line to the program running on the Arduino. In the Arduino sketch I will convert the text into a hex address and hex bytes. The hex bytes are added together in a long integer and then trimmed to 12 bits to verify against the checksum sent on the 9th line of each block in the file.

CODE WRITTEN TO WRITE THE CONTENTS OF THE FILE TO THE FLASH CHIP

The basics of writing to the flash chip involves quite a few steps:

  • set up the address field as x00AAA and the data field as xAA
  • turning on CE#
  • waiting a few microseconds
  • turning on WE#
  • Hold that state for 35 microseconds
  • WE# is turned off
  • waiting a few microseconds
  • turn off CE#
  • wait 35 microseconds
  • set up the address field as x00555 and the data field as x55
  • turning on CE#
  • waiting a few microseconds
  • turning on WE#
  • Hold that state for 35 microseconds
  • WE# is turned off
  • waiting a few microseconds
  • turn off CE#
  • wait 35 microseconds
  • set up the address field as x00AAA and the data field as xA0
  • turning on CE#
  • waiting a few microseconds
  • turning on WE#
  • Hold that state for 35 microseconds
  • WE# is turned off
  • waiting a few microseconds
  • turn off CE#
  • wait 35 microseconds
  • setting up the address field for each byte
  • setting up the data field
  • turning on CE#
  • waiting a few microseconds
  • turning on WE#
  • Hold that state for 35 microseconds
  • WE# is turned off
  • waiting a few microseconds
  • turn off CE#
  • wait until the RD/BY# signal goes high before looping again

We loop over the eight bytes of a line coming in over the USB link, first establishing the address field for the new line and then incrementing it as we write each of the eight bytes. The running checksum is updated for each write. When we have reached the end of a block of 256, the next line is going to be a checksum not a data line. We read it, convert to hex, and compare it to the low order 12 bits of our calculated checksum. Assuming it matches, we zero out the running checksum and prepare for the next line from the file.

CODE WRITTEN TO READ BACK AND VERIFY FLASH CONTENTS

To read the contents and verify it, we again send the text file via PuTTY over the USB link. For each data line, convert the address to hex and convert the eight bytes to hex. We won't bother doing checksums just a byte by byte comparison. For this task, WE# remains off.

Each data line has us do the following in a loop:

  • set up the address
  • turn on CE#
  • wait a few microseconds
  • turn on OE#
  • wait 50 microseconds
  • compare the data returned to the byte from the file
  • flag errors if they don't match
  • drop CE# and OE#
  • wait 35 microseconds
  • increment the address if still in the loop
For the checksum lines (each ninth line), just ignore the contents and go back to read the next line. When we reach the end of the file and haven't flagged any errors, we have a verified load.

CODE WRITTEN TO ERASE THE SECTORS WHERE OUR CONTENTS WILL BE WRITTEN

The way that flash memory works is a bit odd. The act of writing is actually called programming and all it will do is flip any bit to 0 if the data bit being written is 0, but it does NOT flip bits to 1. Thus, one has to erase the entire sector before writing into it. The act of erasing sets all bits on in the sector - every byte is xFF. 

This chip looks at address lines A17 to A12 as a sector number, not as an address of a byte in the array. There is a command sequence to start a sector erase which sets up the sector number in those address bits at the appropriate cycle of the command sequence. This will run autonomously in the chip, writing the xFF and verifying the correct state, until the entire sector is complete at which time the RD/BY# line goes high to signal completion. 

Our process of erasing a sector is:

  • set up the address field as x00AAA and the data field as xAA
  • turning on CE#
  • waiting a few microseconds
  • turning on WE#
  • Hold that state for 35 microseconds
  • WE# is turned off
  • waiting a few microseconds
  • turn off CE#
  • wait 35 microseconds
  • set up the address field as x00555 and the data field as x55
  • turning on CE#
  • waiting a few microseconds
  • turning on WE#
  • Hold that state for 35 microseconds
  • WE# is turned off
  • waiting a few microseconds
  • turn off CE#
  • wait 35 microseconds
  • set up the address field as x00AAA and the data field as x80
  • turning on CE#
  • waiting a few microseconds
  • turning on WE#
  • Hold that state for 35 microseconds
  • WE# is turned off
  • waiting a few microseconds
  • turn off CE#
  • wait 35 microseconds
  • set up the address field as x00AAA and the data field as xAA
  • turning on CE#
  • waiting a few microseconds
  • turning on WE#
  • Hold that state for 35 microseconds
  • WE# is turned off
  • waiting a few microseconds
  • turn off CE#
  • wait 35 microseconds
  • set up the address field as x00555 and the data field as x55
  • turning on CE#
  • waiting a few microseconds
  • turning on WE#
  • Hold that state for 35 microseconds
  • WE# is turned off
  • waiting a few microseconds
  • turn off CE#
  • wait 35 microseconds
  • setting up the address field bits A17 to A12 for each sector
  • setting up the data field to x30
  • turning on CE#
  • waiting a few microseconds
  • turning on WE#
  • Hold that state for 35 microseconds
  • WE# is turned off
  • waiting a few microseconds
  • turn off CE#
  • wait until the RD/BY# signal goes high before looping again
We need five sectors to hold the 128KB of contents going into the flash.