Help creating a SPI state machine in VHDL

OP #6700136
Rate this post
• ▲ useful
▼ not useful
Hi all, I'm new to FPGA but am really motivated to become well-adept in 
VHDL and FPGA. I am trying to program figure 31 (page 18) shown here: 
https://www.analog.com/media/en/technical-documentation/data-sheets/AD7352.pdf 
with the help of the timing specifications on page 5. I think there 
should be two states: SCLK = High and low and I was thinking about using 
a shift register to take the input of a vector of bits. But I am having 
difficulty 1) making the state machine 2) programming it into VHDL. I 
would appreciate any help!
#6700162
Rate this post
• ▲ useful
▼ not useful
Not that hard. Make a simple counter counting for the full cycle. For 
some time in the cycle toggle SCLK for enough clocks. Maybe 30 clocks 
will be enough?
Also use SCLK to shift in the value from SDATA.
At the end of the cycle, when counter is at it's maximum, store the two 
sample values in the shift register to some other register and set the 
counter to zero.
#6700406
Rate this post
• ▲ useful
▼ not useful
So here is the solution:
AD7352_sim.vhd simulates the very basic functionality of the ADC.
AD7352_read.vhd contains what you intend to do, read data from the ADC.
AD7352_bench.vhd connects them both together.

Have fun (-:
Attached files:

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.