Forum Discussion

AutoSpiderZ's avatar
AutoSpiderZ
Icon for New Contributor rankNew Contributor
5 years ago

SPI - slave

I am new to programming FPGA's in VHDL. One of my starter projects is to write VHDL that will receive a SPI message from my Raspberry Pi, that will then produce a PWM with the duty cycle set from the SPI message. For instance, the PI may send a 25, and the FPGA will create a PWM with 25% duty cycle. I am using this code to create the SPI slave portion of code

https://www.digikey.com/eewiki/pages/viewpage.action?pageId=7569477

My debug methods include LED's, lighting up the byte value when received. I also have an oscilloscope to try and verify the PI is sending the message, and that the clock is being correctly read by the FPGA. I am including a picture of my setup.

Is there a better way to watch the ports and the signals, because this method does not seem optimal and I think it is due to my not knowing what to do. It's not working, the rx_data vector does not give very stable results. One thing I found that I think is helping is connecting the Raspberry Pi ground to the FPGA ground.

Any advice is greatly appreciated, I feel I am kind of floundering. My goal is to eventually create a DMA as is used in the labview environment, which is where I first used an FPGA. I was able to create a PWM as was found here

https://www.digikey.com/eewiki/pages/viewpage.action?pageId=20939345

2 Replies