Vidor Music Jukebox
I'm proud to share my music jukebox project using the Arduino MRK Vidor 4000. It is my first project entirely using Verilog HDL!
Hardware Build
These are my connections on a breadboard.
After that I soldered it onto a veroboard to make it permanent.
Here's a block diagram schematic of how it works.
Some setbacks faced
To start off, I was too adventurous and spoilt the Wifi module. When configuring the serial port RX/TX pins, I could communicate with the Wifi NINA module. After that, I added SPI pins and messed up the directions by assigning one of the pins in the wrong order. Due to my mistake, 2 output pins were directly assigned together and damaged the Wifi NINA module. Now the module does not respond anymore, it is completely dead.
In the PCB schematic, the pins were wired directly from the FPGA to the Wifi Module without resistors. Maybe the Arduino team can improve on this and make it more fool-proof. If 2 outputs are configured together, a resistor should help to limit the current and prevent damage. Anyway, after ruining the Wifi module. I decided not to touch the Arduino code anymore, I'll make all the microcontroller pins into inputs (unused) and focus on FPGA in Verilog only and here is what I did...
Story of the build process
These are some useful guides to set up the Arduino IDE and Quartus Prime IDE
- https://www.arduino.cc/en/Tutorial/VidorGSVHDL
- https://www.arduino.cc/en/Tutorial/VidorQuartusVHDL/
- https://maker.pro/arduino/tutorial/how-to-program-the-arduino-mkr-vidor-4000s-fpga-with-intel-quartus-ide
Read up on the specifications of the MKR Vidor 4000
Firstly, I made this Arduino sketch to set all the pins to inputs. As I will be using the FPGA only, I do not need the microcontroller pins and by making it an input, it will prevent shorting the FPGA output to the microcontroller output. I also added Serial pins as later I will be using it for testing.
I am using this modified template with the Intel Quartus software. I am using the Verilog language to configure the FPGA.
https://github.com/wd5gnr/VidorFPGA
First I tried a flashing LED on pin A6. The clock is 48MHz from the SAMD microcontroller. In this case I made a counter and it used the 22nd bit.
Next I made a PWM fading LED on pin A5.
As you can see, both codes run simultaneously and my main struggle when I first started was understanding that the FPGA code is similar to building actual hardware.
ie. Important to think in terms of sequential circuits, state diagrams and combinational logic
Adding on, here's a buzzer setup where I used frequencies to play tones. This is a simple "Do, Re, Mi" test.
This website shows a list of frequencies for a music note used.
Code is getting pretty long so I wrote it into a separate Verilog file for the 16x2 Character LCD display.
It was challenging too to make the sequential logic and scrolling text across the screen.
Lastly I added a UART module so that I can send commands from my PC
After playing around with the devices separately. Finally, I merged the code together to make the musical jukebox.
I have published my project code on Github too!
https://github.com/zst123/Vidor-Music-Jukebox
Conclusion
Thanks again to element14 for sending me an Arduino MKR Vidor 4000 for this project! Was great fun learning about FPGAs and I hope you enjoyed my blog post!
Top Comments