I'm trying to put together a simple test setup using the ADAR1000-EVAL board. My hope was to connect via SPI and a Raspberry Pi 3 B+ and send the appropriate register commands to change the phases and amplitudes in a set manner from Python.
I had gotten the SDP-B and the Windows software and have played around with the basic GUI. I've successfully run the example script: RX1_MaxG_45.txt from that interface. Upon taking that board out of the picture, I switched to my raspberry pi setup, and connected the CE, MOSI,MISO,SCLK lines from the Pi GPIO to the relevant lines on the P3 interface.
I've got CPOL and CPHASE set to 0, with a max bus speed set to 50,000 Hz. I basically then send the registry address data followed by the data via the spi interface through Python, stepping through all the commands from RX1_MaxG_45.txt. However this does not seem to work; I have a continuous wave signal going directly into port RX1 and a spectrum analyzer hooked up to the RF_IO port. When operating with the SDP-B, I can see it go from no signal to a strong peak immediately after running through all the commands in the example script. However when trying through the SPI on the Pi, I only was successful at activating a signal twice - seemingly randomly out of the dozen of times I was mucking around with code. Why? I have no idea...
Which brings me to my questions:
1. Writing to registry 0, 0x0018 activates SDO and a 4 wire spi = but SDO is a 1.8V line - is that converted to 3.3V anywhere (i.e. the MISO line on P3)? I initially have just hooked up the MOSI, MISO, SCLK lines on the P3 connector and am going to the PI, yet I don't see anything signal coming in on the MISO line.
2. If I skip writing 0x0018, does that keep it in 3 wire spi mode?
3. Is there a simpler way to utilize the existing driver written for the windows eval software to interact with the board such that I can change phases and attenuators or an alternative to reading the SPI from the raspberry pi that anyone could recommend?
Thanks in advance!
I would like to ask just a few house keeping questions. Please confirm:
1) Your CE (CSB) line is active low?
2) Your total bit payload length is 24 bits for each Write?
3) The first bit you write is the Read/Write bit, ;'1' to initiate at Read or a '0' to initiate a Write
4) You expect data to be clocked in on the rising edge of the SCLK signal
5) Unless you've changed the setting in Reg 0x00, you clock in MSB first in the following order: [R/W bit] [15 Address Bits] [8 Data Bits]
6) All the Timing Specifications are being met shown on Page 6 of the datasheet?
Can you observe what you are writing with an oscilloscope? When de-bugging the SPI I like to capture all four of the lines to make sure I'm writing what I think I'm writing.
Answers to your questions:
1) Writing 0x0018 should active the SDO pin and make it a 4-wire bus. The 3.3V to 1.8V logic transform is done by the U5 and U2 chips on the eval for the SPI lines. The MISO line on P3 goes through the U5 level translator.
2) Yes, skipping the 0x0018 Write will keep the SPI in 3-wire mode. And unless you probe with a scope right at the SDIO pin, you will not see any data being read back from the part because the U5 level translator is set to be uni-directional.
3) I'm not familiar with the raspberry pi, so I cannot help you on that front unfortunately. Assuming it runs a standard SPI engine that can read and write multiples of 8-bit words, we should be able to get it to work with the ADAR1000.
First off, thanks for getting back to me!
#1&4) Yes, I've confirmed that in software and on the oscilloscope, I've also hooked up the oscilloscope to observe, and it does look like I now have Ch1 (Top) MOSI being clocked on the rising edge of the sclk (CH2- bottom). Wasn't the case when I first started, had an incorrect cphase assigned. Not shown in the picture, I had a line hooked up to the CE, to confirm it drops low and stays low until the write is complete. I did try hooking up the MISO, but that line stayed flat.
#6) I have the maximum clock rate set per the table, but I need to look into seeing how the rest of those values are defined in the raspberry pi spi interface. It doesn't seem to have easy access to such other settings...How critical is it to have the rest of those values exactly set?
#2,3,5) After hooking up the oscilloscope and going through a few other of your points, I'm still having issues getting the chip to respond. Which makes me believe I'm having issues with tacking on the r/w bit infront of the 15 bit address.
Writing the data bit is easy, as the python function I'm using (spidev.xfer2()) seems to take an array of hex values, so I can just write 0x## and be good to go. I'm looking into the dealing with the address bit further... (bitwise math is not my strong suit)
I think i see your problem: If the waveforms in the picture are really representative of what you are Writing to the ADAR1000, I do not believe you will have any success. The waveforms should look much more like what is shown in Figures 2, 3, 4, or 5.
I would connect the SDP to the ADAR1000-EVALZ board and use ADI's control software and capture a Write on your scope - the waveforms should look like the aforementioned figures. They should be essentially square-wave and go from 0V to 3.3V. Also, it looks like your y-scale is about 0.2V; if this is true, the amplitude of your current waveforms aren't nearly large enough.
Looks like I had attenuation enabled on the probes, and was writing way too fast. At any rate, swapped to a new oscilloscope and have been having much better luck at capturing the signal. Per your suggestion I hooked up the SDP board and did a comparison between the two. I used the GUI to write 2e7f (to enable the rx components) to the board, and then tried writing the same 2e7f command via the pi and my code. Results are as follows, showing channel 1 as SCLK, and channel 2 as MOSI:
I don't quite get why the SDP has a high rise for the MISO before the SCLK activates. It looks like the second half of my command is acting as one would expect...
I'll have to check the code to figure out why MOSI goes high before the clock starts. If CSB has not gone low, the MOSI does not have any affect on the part.
My apologies I forgot to reply back. I did get the writes sorted out - it was a grounding issue (too long of a cheap wire mostly). Soon as I shortened that up and got a better ground the chip responded better. Though I still was seeing that MOSI rise before the clock starting. Thanks for the initial help!