Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Amp ADC interfacing using VHDL for Spartan-3A

Status
Not open for further replies.

NJ176

Newbie level 5
Joined
Jul 18, 2017
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
283
Hello!

I am relatively new to VHDL. I have tried some smaller tasks and have been successful. I have been working interfacing amp and ADC of a Spartan-3A starter kit for my project. I have been working on it for months and haven't been able to make any progress. I got a reference code from https://www.edaboard.com/threads/213091/

But I am not able to understand some things:
Why are we checking bit 12? --- if(amplitude1_buffer(12) = '1') then

What does this command mean? -- SPI_MOSI <= gain2(3 - cnt);

Why does mclk do? And what is the trigger used for?

Also, if anyone has a UCF file and if you've written a code for this, can you please please please send it to me?
I really need a reference.


I am really looking forward to your help.

Thanks and regards,
NJ176
 

Hi
I don't want to read the whole foreign thread...
I assume bit 12 is the MSN and therefore the sign bit..
According trigger and MCLK: it is urgent for you to read the ADC datasheet.

Klaus
 

What does this command mean? -- SPI_MOSI <= gain2(3 - cnt);
Because the code writer is clueless about how to write a proper shift register.

As cnt increments 0, 1, 2, 3 you select gain2(x) where x is 3, 2, 1, 0. Later it uses gain2(7-cnt) for 7, 6, 5, 4.

Shows the coder doesn't know what a shift register is.

Looks like the ADC must have a SPI interface. I'd go find a better SPI implementation than this code.
 
  • Like
Reactions: NJ176

    NJ176

    Points: 2
    Helpful Answer Positive Rating
Thank you so much for all your replies, especially ads-ee.

Could you please help me figure what does mclk do? Because I have checked the data sheet and I am still not able to figure it out. The data sheet only mentions the use of one clock. And mclk is an input, so where would this input come from?

Thank you so much for your replies in advance.
 

mclk is a higher frequency clock used to generate the divided down timing of the SPI. As I've stated before you should probably find a better representation of SPI code as this version was likely written by someone with a software background as it uses more of a software approach to the design. Anyone familiar with a hardware implementation of SPI would use shift registers and would avoid using variables for counters as that results in the addition with 1 occurring after the FFs.

I'm pretty sure this design synthesizes to something quite a bit bigger than a more optimal implementation, specifically due to the multiplexing done to replicate the much simpler shifting.
 
  • Like
Reactions: NJ176

    NJ176

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top