SPI ADC VHDL code


offroad
  • Here is a nice project put together by offroad that gives an example of reading the SPI ADC used in the LogicStart MegaWing, RetroCade MegaWing, and Analog Wing with VHDL.

"Ouch", because at the end of a long and painful debug process came the insight that the 2nd ADC on my board is broken. Works only when I push it down... will try resolder it tomorrow. Edit: Fixed.. the little fella had one foot off the dancefloor.

Anyway, one result is an ADC demo that got out of necessity a little more polished than planned.

  • Controls LED brightness with input 1 (the one closest to the SD card). The signal pin faces the edge of the board.
  • Dumps all 16 channels through USB. Set up virtual com port for the 2nd USB interface, open Teraterm and connect with default settings (9600 baud, 8 bits, 1 stop bit)
  • There is some information out there regarding control of this ADC that I find questionable, after reading the data sheet (It states explicitly that there are no timing requirements between falling edges of CS and CLK so they may change in the same cycle and the whole control logic simplifies greatly)
  • ADCs run at 50 % of maximum throughput, that is, they take turns. 8 frames are captured in one shot.
  • The data sheet shows 10 bits even though it's an 8-bit ADC. The implementation picks the correct ones, others are apparently zero (edit: no they are not - you get 10 bits of data out of the ADC)

 

post-36723-0-79204400-1390603661.png

Don't pay attention to values from unconnected (floating) inputs. Lower channels will "leak" over into higher, undriven channels and the terminal output gets quite noisy. Putting jumpers between signal and +5V gives clean readings (but double-check, the other position would short +5V to GND).

The archived project is for PlanAhead, which comes with the ISE 14.7 download.

impl.bit

PapiliioProRetrocadeAdcDemo.pa.zip



  Report Article



User Feedback


There are no comments to display.



Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.