Since we had a good success with writing a program and running it on the I/O card, we need to start writing the initialization routines for the various hardware bits on that card, as well as writing the protocol for communicating back and forth between it, and the driver on the 68K side.
The UART took a little bit of trickery. If you look back at the schematic, the baud clock for the UART IC is driven from one of the PIO chip's internal timer.
We decided to setup the UART to work with 1200 baud. Slow? yes... but it provides a method for getting characters in and out of the 68K system so we will stick with this.
Initializing the UART:
And, setting up the initial PIO states and setup to produce the proper baudclock:
Presto! Now, we need to write some protocol code so I can send commands across the bus back and forth to the UART, an ex:
Seems pretty simple in concept, doesn't it? It does, however it took a lot of time and iterations/modifications and rewriting the ROM over and over to get this to work correctly. And when I say a lot.. I mean A LOT of trial and error.
Anyways... that's basically it in a nutshell.
The mainloop handles all of the commands coming across the bus, it also has a Watchdog reset you must keep happy or the I/O card will keep resetting on you.
So with that mostly complete, we need to test each part of the firmware as we go along so we dont get caught up in bug hell...
Testing the UART <-> Bus communication:
Success!!! We can communicate across the bus from the arduino, to my protocol, and out of the UART.
So we are well on our way to making functional I/O card firmware
Next part is to make sure the protocol is working with the 68K's System bus by testing it in an actual system.
The trouble is, we have not written any 68K code at all yet. So quickly, I grabbed a copy of VASM and made a simple little ROM that keeps the watchdog happy on the CPU card, and then i sent a random LED set byte across the bus over to the I/O card and then loop forever. a very simple "hello world" program on the 68K side:
perfect! We knocked two birds out with one stone here. one, we confirmed the 68K can communicate with my firmware on the I/O card, and then the 68K CPU itself can run a "Hello World" ASM program assembled with VASM and send a byte out to the I/O card.
I know, I jumped way ahead here but i needed to demonstrate the functionality of the IO card.
Next up... the data card.