This has been a huge problem concerning my work with microcontrollers and various data buses. I can design a uC circuit to act as a slave on some data bus, but to test it, I am forced to program an additional uC to act as the bus master. If the slave doesn't work correctly, I am faced with the problem of finding the fault. Is it the slave, or did I not program the master correctly? Then there is the additional issue of needing to test every possible command code to ensure the slave is reacting appropriately. These commands cannot always be sent at once, so again, I am forced to juggle the programming of two separate uC circuits at once.
At the time of this writing, I have three separate circuits, each designed and tested for correct functionality, but waiting to be strenuously tested for every possible command code which could be sent. Doing so would just have taken up to much of my time, so I never finished them. That is where this circuit comes in. I have created a manual data bus controller which can be used to test multiple slaves on a bus at once. The prototype version can handle either TWI or SPI commands.
I had been toying with the idea of this circuit for quite some time, so I had a pretty good idea of what I wanted it to do long before I actually started working on it. Most importantly, there needed to be a lot of buttons for command input, and a lot of pins for data output. Adding an LCD screen would make the data entry much easier. I eventually settled on a fairly simple hardware setup based around at Atmel ATmega328p chip. I also incorporated a 4x4 matrix keypad for the data input and a couple of LEDs for quick status indication, but that latter is primarily because I had a few left over i/o pins. Although three status LEDs are shown in the schematic I only used two, but one of them is bi-color. I didn't feel like creating a new schematic symbol at that time...
The TWI and SPI buses are connected directly to the uC, with a 74595 8 bit shift register providing the chip select lines used for SPI communication. I used a 7805 voltage regulator in the TO220 package to provide enough supply current for whatever slave devices may be added to the data bus. A slide switch selects which bus is active. The LCD screen to be used in this version is a stand alone device I picked up from Sparkfun which operates serially, hence the RS232 connections. In a future version, an LCD screen may incorporated into the actual hardware design.
Stay tuned; more information and
software design are coming soon!