Using examples from other threads in this forum, I managed to control individual ADAR1000-EVALZ boards with MATLAB, using an Arduino Nano to send the SPI signals.
In this case, the arduino D10-D13 pins are connected to P1's pins 16-19 on the EVAL-board, and the ground pins are connected as well.
This setup can succesfully control the gain and phase settings of all channels, and I've verified that each board only responds to commands with the correct address header (0x00, 0x20, 0x40 or 0x60).
I'd like to control the four boards in a daisy chain, and for that
- I replaced the shorts R73 and R74 with 50 Ohms, as recommended to avoid damage due to bus contention
- I gave each of our 4 boards a unique address using P10 (0x00, 0x20, 0x40 and 0x60)
- Connectors P1 and P2 of adjacent boards are fully connected
- The first board is connected to a lab supply (3.3V and -5V)
When I use the SPD-S and the ADAR1000 evaluation software GUI, with all of the boards daisy-chained, I’ve been able to manually write commands to each individual chip address, for example:
00 00 81 // Reset all chips
X0 00 18 // Activate SDO for Chip with address X0
X0 2F 7F // All channels and subcircuits enabled
X0 31 42 // Turn on bias currents Tx
X0 38 60 // Select SPI instead of internal RAM for channel settings
X0 36 2D // Write bias current settings
X0 37 06 // Write bias current settings
X0 1C 7F // Set channel 1 gain value
X0 20 36 // Set channel 1 VM value I
X0 21 35 // Set channel 1 VM value Q
X0 28 02 // Load values from registers
When I apply these manual commands, the bias current starts flowing (approx. 350 mA) and I see that the channel 1 of chip with address 0xX0 activates as expected.
Here's the problem: when I apply the exact same commands through through an Arduino, controlled via Matlab, the daisy-chaining does not seem to work.
Only chip 0x00 will respond to the commands, for chips 0x20, 0x40 and 0x60 the bias current will not even start flowing.
Example code for daisy chain:
ADDR = 0x20; % Options: 0x00, 0x20, 0x40, 0x60
a = arduino;
ADAR1000 = device(arduino, 'SPIChipSelectPin', 'D10','BitOrder','msbfirst','BitRate',0.5e6);
writeRead(ADAR1000, [0x00 0x00 0x81]); % Reset all chips in daisy chain
writeRead(ADAR1000, [ADDR 0x00 0x18]); % Activate SDO-pin for requested Chip
writeRead(ADAR1000, [ADDR 0x2F 0x7F]); % All Tx channels and subcircuits enabled
writeRead(ADAR1000, [ADDR 0x31 0x42]); % Current On, enable Tx, control TR through SPI
writeRead(ADAR1000, [ADDR 0x38 0x60]); % Select SPI instead of internal RAM for channel settings
writeRead(ADAR1000, [ADDR 0x36 0x2D]); % write bias current settings
writeRead(ADAR1000, [ADDR 0x37 0x06]); % write bias current settings
writeRead(ADAR1000, [ADDR 0x1C 0x7F]); % set gain value
writeRead(ADAR1000, [ADDR 0x20 36]); % set VM I
writeRead(ADAR1000, [ADDR 0x21 35]); % set VM Q
writeRead(ADAR1000, [ADDR 0x28 0x02]); % Load values from registers
I’ve read about the bus contention error, when the SDO pins of all ICs are active at the same time, and I’ve tried to ensure that only the IC being communicated with has an active SDO pin using the following code:
if ~ADDR %% Use a different procedure for chip ADDR 0x00
writeRead(ADAR1000, [0x00 0x00 0x18]); % Activate SDO-pin for all chips in daisy chain
writeRead(ADAR1000, [0x20 0x00 0x00]); % De-activate SDO-pin for Chip 2
writeRead(ADAR1000, [0x40 0x00 0x00]); % De-activate SDO-pin for Chip 3
writeRead(ADAR1000, [0x60 0x00 0x00]); % De-activate SDO-pin for Chip 4
else
writeRead(ADAR1000, [0x00 0x00 0x00]); % De-activate SDO-pin for all chips in daisy chain
writeRead(ADAR1000, [ADDR 0x00 0x18]); % Activate SDO-pin for requested Chip
end
This made no difference.
I'm stuck, hoping someone here recognizes what the problem can be. Is there something I'm missing, that the GUI / SPD adapter does differently than my implementation of the four-wire SPI commands?
Thank you in advance.