• rehsd

Arty A7 & OLEDrgb Pmod Struggles

Updated: Nov 30, 2021

Update: I have the OLEDrgb display working! See bottom of post.


Original 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.


Initial Problem

Arty A7 with OLEDrgb (not powered on)
Arty A7 with OLEDrgb (not powered on)

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.


Steps Taken

  • 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.

Sample of main.c
Sample of main.c
  • I increased the memory size of the following to 0x6FFF:

microblaze_0_local_memory_ilmb_bram_if_cntlr_Mem_microblaze_0_local_memory_dlmb_bram_if_cntlr_Mem

  • I then built the project in Vitis, programmed the Arty from Vitis, and ran the debugger.

XSCT Console
XSCT Console
Arty running code
Arty running code

Additional Notes

  • 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.

main() - Can't get to DemoRun();
main() - Can't get to DemoRun();

Stuck in SPI-related code
Stuck in SPI-related code

  • 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.



Next Steps

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!



Progress!

Working OLEDrgb!
Working OLEDrgb!

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.

Block design for the working OLEDrgb above
Block design for the working OLEDrgb above

Full Walkthrough

I have posted a full walkthrough at https://www.rehsdonline.com/post/arty-a7-oledrgb-pmod-walkthrough.





111 views0 comments

Recent Posts

See All