Thanksgiving has come and gone and my life is back to the usual schedule. That means I have time to experiment with my XP2 board! In my last post I made sure that I could access the XP2 board from a terminal. I now want to do this in a programmable way with software. Instead of using a standard terminal interface, my long-term plan is to use a binary serial protocol to communicate between my PC software and the FPGA on the XP2 board.
I coded up some simple C language functions that access and perform I/O via the serial port using standard POSIX functions. It was simple and did not require much effort, and I’m left wondering why if serial ports can be supported for Linux, why other POSIX platforms like Mac OS X have no support. I suppose the GNAT supporters have their reasons…probably due to business “use cases”.
Nonetheless, using standard POSIX interfaces worked fine on Mac OS X. For example, the following screen capture shows the result of reading 512 bytes from the serial port after resetting the XP2 board:
The output matches the terminal output I captured last time with the screen program, and my simple C code serves to prove that we are ready on the software side to interact with theXP2 board. I will not publish the C code just yet–I plan to make it more adaptive and provide an Ada interface as well. Just using C would be no fun, I’d learn nothing new. But interfacing C and Ada, especially since GNAT does not provide serial port support for OS X, is a great opportunity to learn more about Ada.
My USB programmer cable arrived in the mail recently, and now that we have the software interface working as expected, it is time to make sure the JTAG interface on the hardware works as expected. Once we have the JTAG programmer figured out, we can try to implement some simple logic in the FPGA.