After a long hiatus due to school, I've finally had time to put some more work into the 68000 tablet.
I was able to write a driver for the LCD screen, as well as some commands for writing text and controlling individual pixels. I tested this by drawing images manually over a serial connection. I also attempted to write a function to draw a Mandelbrot fractal on the display, but it kept crashing. I looked through the generated assembler code, but everything looked fine. So, I started to investigate.
Reliability issues
After adding the Mandelbrot code, I noticed other functions behaving strangely. For example, attempting to call sleep()
would often - but not always! - cause the board to reboot. At this point, I decided to add actual error handling to the board. Now, an exception would print a message stating the cause to the serial bus, and would halt execution. After adding this, calling the Mandelbrot function would halt the board with an "invalid instruction" exception. This wasn't my first time dealing with invalid instructions - previously, I accidentally set the target CPU to 68030, which caused gcc to generate instructions that didn't exist on the 68000. I went through all of the generated Mandelbrot assembler code and verified every instruction existed in the 68000 manual. Still, everything looked fine.
At this point, I thought the problem was related to the power bus. mandelbrot()
, being a very CPU-intensive function, would probably thrash the address and data busses, causing a current spike. I measured the board, and voltage hovered around 4.0V when the computer was running! Clearly, this was way out of spec for a 5V CPU. I connected a more powerful supply up, and was able to maintain a voltage of a little over 5V. mandelbrot()
still caused the board to halt immediately.
Debugging was starting to get difficult. Repeatedly plugging and unplugging the EEPROM from the programmer I built was causing the socket holes to widen. I'd have to fiddle with the chips until it made a solid connection, and then hit program. At this point, I realized that the same thing could be happening on the 68000 board.
While writing mandelbrot()
, I noticed that the resulting binary size had surpassed 8KB. Since the data bus is 16 bits, each EEPROM chip was now holding over 4KB of data. My theory was that a12 wasn't making a solid connection with one of the chips - not making a difference for the first 4KB, but rereading that 4KB for the next 12 bits of address space. This would mean that instructions in mandelbrot()
wouldn't be read - random data would be read instead. Using a multimeter, I checked the pins of the EEPROMs, and verified that a12 wasn't making a proper connection with the board.
I've ordered a proper EEPROM programmer, and I've also ordered some ZIF sockets, which I'm going to install on the 68000 board. Once that's done, hopefully all of the errors will disappear. Until then, I'm back to programming blind - like I did while waiting for parts to come in, many months ago.
Also, I wanted to post a picture of the screen displaying a message. Unfortunately, my current programmer can't make a good connection at all, and I corrupted the EEPROMs while trying to get write to them.