Connecting ADC to Opb_Spi core

Hallo, I'm trying to connect a Spi 16 bit ADC to Opb_Spi core.

Where I could find some software examples?

I have made some searches into Google but I don't have found anything.

The only example into EDK documentation is about an eeprom.

What is the meaning of : Status = XSpi_SetOptions(&Spi, XSP_MASTER_OPTION | XSP_MANUAL_SSELECT_OPTION);

In this way ADC is a master?

When acquiring data, ADC must be set as a master?

Many Thanks in Advance Marco

Reply to
Marco
Loading thread data ...

"Marco" schrieb im Newsbeitrag news:dae5ja$pij$ snipped-for-privacy@news.ngi.it...

1 there are no examples to be found by googling (my guess) 2 the meaning of what you asked is defined in the opb ip core manual, you better read it

your setup seems to be OK, eg you set master and manual SS, that is you must yourself write to SS register to assert-deassert the ADC select signal

Antti PS I almost always use a GPIO bit bang SPI emulation at first testing, the soft SPI code is a only a few lines of C code. only when the software SPI works with the connected hardware I proceed with special SPI hardware, controlling hardware SPI is usually more complex (need to read the manuals!!) then doing it 100% in sw.

Reply to
Antti Lukats

I posted because I don't have found the core manual very clear...

I have another doubt: ADC is 16 bit, but XSpi_Transfer works with 8 bit data buffer.

That means to obtain a 16 data I must use 2 8bit buffers? In example a vector of 2 elements?

Reply to
Marco

"Marco" schrieb im Newsbeitrag news:dae9vd$r6d$ snipped-for-privacy@news.ngi.it...

you

the

SPI

data

no you use MANUAL SS assertion, you already had that setup in your code snippet actually

so you set SS active do 8 bit transfer do another 8 bit transfer de assert SS

ADC 'sees' one 16 bit transfer

but I would says doing it that way is more complex and takes more time than bitbang software method

Antti

Reply to
Antti Lukats

Hi Marco

Try reading your ADC manual. Because SPI is more a matter of "Send 1 byte" "Read 1 byte" than what the byte mean ... that all depends of the connected device.

Sylvain

Reply to
Sylvain Munaut

"Marco" schrieb im Newsbeitrag news:dael9c$vcg$ snipped-for-privacy@news.ngi.it...

anything.

you

testing,

hardware,

you connect your ADC SPI to 'normal' GPIO ports and set/clear the bits in software.

the C code is maybe 10 lines for the SPI

Antti

Reply to
Antti Lukats

Could you explain what is bitbang software method, please?

Reply to
Marco

Ok, I'll try it!

Many Thanks to everyone for help and patience Marco

Reply to
Marco

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.