Testing and Troubleshooting Arduino Connection to CPLD
I spent much of last night and this morning getting the Arduino communicating properly with the CPLD. I was able to see the bus control in action, but I wasn’t able to get the address lines working last night. All the CPLD really is is a set of shift registers. How hard can it be?
Finally, I wrote some code that sends back the 5 pin statuses to the C# program in progress responses which can are display while it’s waiting for the final response. Thus I was able to see what the pins are actually doing.
The first thing I did was look at Dout to see if I was shifting out what I was shifting in.
I found a bug in the Verilog with the control register and realized I can’t use it on that particular register:
I’ll keep the bugged CPLD for now since I don’t use the Dout from the control register. I don’t have the same bug in the other shift sections.
Then, I noticed that my address bits weren’t even getting shifted out. Turns out I had my for loop start and end variables reversed. Once that was solved, I was able to see the bits shifting out. And then I saw them on the address lines! Yay!
Next, I looked at the data lines. The first and last seemed to work. I wasn’t sure that the driving was ending properly. But wirewrapping makes it easy to pop a 10K resistor on the board and connect to ground and a data line and Vcc and a data line and write 1 and 0 and make sure that that pulldown/pullup works as expected. And it did!
Here is an example of the flashProg.exe output (address was already programmed):
So, at this point, it looks like the CPLD is working as expected, except for the minor bug.
I’m ready to start wiring up the 39SF020A. I need to write the bulk reading and writing in flashProg.exe.
I should also add a pullup for the ENABLE signal. It has to be high when the Arduino is not connected. That means I need to mount one of the 10K resistor nets with the 8 10K resistors.