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.
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.
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?
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.