Forum: FPGA, VHDL & Verilog Help creating a SPI state machine in VHDL

von Michael N. (minaknim)

Rate this post
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: 
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!

: Moved by Moderator
von Gustl B. (-gb-)

Rate this post
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.

von Gustl B. (-gb-)

Rate this post
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 (-:


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.