Arty A7 & OLEDrgb Pmod Struggles
Updated: Nov 29, 2021
Update: I have the OLEDrgb display working! See bottom of post.
First things first... I am new to FPGA development. I am currently reading several books and completing several online, self-paced courses on FPGA development (focused on VHDL for the moment). I am working to rebuild Ben Eater's 8-bit CPU on my Arty A7. I realize the deliverable from this won't be overly impressive, but it's the learning journey that provides me the value. So far, I have the clock module implemented in VHDL. I would like to implement an OLED display to show status of the clock, registers, counters, bus, control word, output, etc. With this in mind, I have purchased an OLEDrgb Pmod to connect to my Arty. Unfortunately, I am struggling to get display output to work on the OLEDrgb.
I have programmed the FPGA and it appears to be running the program to output to the OLEDrgb, but I am not seeing anything on the OLED screen. Below are the steps I have taken to get to this point. If you have any suggestions on how I can best debug/troubleshoot/resolve the lack of display output, I would be grateful for any recommendations.
I have installed Xilinx Vitis and Vivado, version 2021.2. Digilent board files, including constraint files, have been installed and are seen from Vivado. Per Digilent's documentation, I am using the alternate version of the board files for Microblaze.
Using Getting Started with Digilent Pmod IPs, Getting the PmodOLEDrgb to Work on Zybo, and Getting Started with Vivado and Vitis for Baremetal Software Projects as references, I created a Vivado project for my Arty.
I created the following block design with shown clocking wizard setup, connected to Connector JA of the board, and with a design wrapper. I validated the design with a successful result. The synthesis, implementation, and bitstream generation completed successfully.
I exported the hardware platform (*.xsa).
In Vitis, I created a new Application Project using the .xsa hardware platform file that was exported from Vivado. I selected standalone OS platform, microblaze processor, language of C, and empty application.
I then copied the OLEDrgb sample application files (bitmap.h and main.c) to the src folder.
I increased the memory size of the following to 0x6FFF:
I then built the project in Vitis, programmed the Arty from Vitis, and ran the debugger.
I found an old thread on Digilent's forums titled Pmod OLED rgb and ARTY. User M_bipartitus mentions usleep() call issues. I did try updating PmodOLEDrgb.c and removing all "1000 *" references in the calls to usleep(). For example, instead of usleep(1000 * 20); I used usleep(20);. This did not seem to help.
When debugging the code on the Arty, I can't get past the DemoInitialize() function. It seems to get in a loop with SPI-related calls.
I have tested with both USB power and an external power supply (12V, 3A).
I updated the design to use JB instead of JA and moved the OLEDrgb to the JB connector.
Further debugging of the code, the following snippet is where it appears to get stuck. This is in the XSpi_Transfer() function in xspi.c. ByteCount rolls 1 to 0 to 0xffffffff. Possibly, XSpi_GetStatusReg should be returning a non-zero number after ByteCount is 0, but it doesn't, so the loop keeps going.
How can I best debug the issue at this point? Do you see anything obvious above that I missed or should look into? What information should I post that would be helpful? Thank you in advance!
I made some good progress. I scrapped my original Vivado project and started from scratch. This time, I implemented a Memory Interface Generator (MIG) as part of the design. With this, my clock setup was a bit different. My current thought is that somewhere in my first design I had a clock messed up. To the right, you can see the OLEDrgb running the demo code provided by Digilent.
Below is the current block design that is working. I plan to start over again and confirm that I end up with a working display, documenting the steps along the way; I will post a write-up of the full walkthrough once I get that done.
I have posted a full walkthrough at https://www.rehsdonline.com/post/arty-a7-oledrgb-pmod-walkthrough.