USB Host Shield and AD5602 (DigiPot) together freezes everything

Hi all,
I have a project where i'm trying to control my drone controller using a PS4 Controller and a set of digital potentiometers to control the stick positions on the drone controller. So far, my best try is to do the digipot through software using shiftout() but the output is really messed up. Everything is fine on the serial monitor but the sticks readout on the drone controller is all over the place.

The example sketch is just supposed to go from full on, smoothly down to off, one channel at a time, then start over, but its going to random channels and values(slightly less random values through channel 3(as in ch0, ch1, ch2, ect.) ) but it is consistent through each loop so i dont think it's my digipot(also i have 2 and they both do the same thing. I'm not really sure how else to describe it without making a video.

I have dug through the internet for anyone using both the USB Host Shield and the AD5206 together with no luck.

Can someone please help me figure out what i'm missing?

AD5206 Datasheet
https://www.analog.com/media/en/technical-documentation/data-sheets/AD5204_5206.pdf

Modified from the DigitalPotControl example in the Arduino IDE.

/*
  Digital Pot Control

  This example controls an Analog Devices AD5206 digital potentiometer.
  The AD5206 has 6 potentiometer channels. Each channel's pins are labeled
  A - connect this to voltage
  W - this is the pot's wiper, which changes when you set it
  B - connect this to ground.

 The AD5206 is SPI-compatible,and to command it, you send two bytes,
 one with the channel number (0 - 5) and one with the resistance value for the
 channel (0 - 255).

 created 10 Aug 2010
 by Tom Igoe

 Thanks to Heather Dewey-Hagborg for the original tutorial, 2005

*/
const int dataPin = 5;
const int clockPin =7;
const int slaveSelectPin = 6;

void setup() {
  Serial.begin(9600);
  // set the dataPin, clockPin and slaveSelectPin as outputs:
  pinMode(dataPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(slaveSelectPin, OUTPUT);
  // initialize SPI:
//  SPI.begin();
}

void loop() {
  // go through the six channels of the digital pot:
  for (byte channel = 0; channel < 6; channel++) {
    // change the resistance on this channel from min to max:
    for (byte level = 0; level < 255; level++) {
     // digitalPotWrite(channel, level);
      //delay(50);
    }
    // wait a second at the top:
    //delay(10);
    // change the resistance on this channel from max to min:
    for (byte level = 0; level < 255; level++) {
      digitalPotWrite(channel, 255 - level);
      Serial.print(" Channel: ");
      Serial.print(channel, BIN);
      Serial.print(" Level: ");
      Serial.print(level, BIN);
      Serial.println();
      delay(10);
    }
  }

}

void digitalPotWrite(byte address, uint8_t value) {
  // take the SS pin low to select the chip:
  digitalWrite(slaveSelectPin, LOW);
  //  send in the address and value via shiftOut()
  shiftOut(dataPin, clockPin, MSBFIRST, address);
  shiftOut(dataPin, clockPin, MSBFIRST, value);
  // take the SS pin high to de-select the chip:
  digitalWrite(slaveSelectPin, HIGH);
  delay(5);
}

Edit:
I'm basically trying to constantly read the PS4 controller and write to the digipot as much as possible. I didn't think it would work through spi alone before i even started this, thats what i thought the shiftOut() was for but i think i'm doing something wrong.

The datasheet says it uses 3 bits for the address and 8 bits for the value. I think this is what i need to mess with because the shiftOut() thing says it sends out 8 bits at a time. To me, that says its overlapping something and that's causing the sporadic output.

Can someone point me to an example or two that uses this bit bashing shiftOut(), or is this just completely the wrong way to go about doing this?

So i have tried the void shiftOut function thing for a while but i could still not get it to work.

And after searching through a LOT of custom libraries and examples of "bit banging" and software spi/shiftout commands, I decided to just try a direct approach, just to see if i can get it to do something that i want it to do. I tried as direct of an approach as i could think of.

Between page 5, 12 and 15 of the datasheet, i was able to come up with this...

/*just a few functions
 * ssl brings the slave select pin low
 * ssh brings the slave select pin high
 * dpl brings the data pin low then
 *     brings the clock pin high then
 *     brings the clock pin low
 * dph brings the data pin high then
 *     brings the clock pin high then
 *     brings the clock pin low
 */

const int dp(5);  //data pin
const int cp(7);  //clock pin
const int ss(6);  //slave select pin

int hi = 200; //high value      never actually used these
int me = 128; //medium value
int lo = 55;  //low value

void setup() {
  Serial.begin(115200);
  
  pinMode(dp,OUTPUT);
  pinMode(cp, OUTPUT);
  pinMode(ss, OUTPUT);
  
  digitalWrite(cp, LOW);
  digitalWrite(dp, LOW);
  digitalWrite(ss, HIGH);
  
  Serial.print("0-6: ");
  Serial.print(0, BIN);
  Serial.print(":");
  Serial.print(1, BIN);
  Serial.print(":");
  Serial.print(2, BIN);
  Serial.print(":");
  Serial.print(3, BIN);
  Serial.print(":");
  Serial.print(4, BIN);
  Serial.print(":");
  Serial.print(5, BIN);
  Serial.print(":");
  Serial.print(6, BIN);
  Serial.print(":");
  Serial.print(" lo/med/hi: ");
  Serial.print(55, BIN);
  Serial.print(":");
  Serial.print(128, BIN);
  Serial.print(":");
  Serial.print(200, BIN);
  Serial.println(":");

}

void loop() {
/*channel 0 low*/
  ssl;  //slave select low
  //3 bit channel 0 byte
  dpl;   //0
  dpl;   //0
  dpl;   //0
  //8 bit lo value 55 byte
  dpl;   //0
  dpl;   //0
  dph;   //1
  dph;   //1
  dpl;   //0
  dph;   //1
  dph;   //1
  dph;   //1

  ssh;  //slave select high
  Serial.println("Channel 0 Low");

//  delay(750);
  
/*channel 0 med*/
  ssl;
  
  dpl;
  dpl;
  dpl;
  
  dph;     //128 in binary 10000000
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;

  ssh;
  Serial.println("Channel 0 Med");

//  delay(750);
  /*channel 0 hi*/
  ssl;
  
  dpl;
  dpl;
  dpl;
  
  dph;     //200 in binary 11001000
  dph;
  dpl;
  dpl;
  dph;
  dpl;
  dpl;
  dpl;

  ssh;

//  delay(750);
  Serial.println("Channel 0 Hi");

/*channel 1 low*/
  ssl;
  
  dpl;
  dpl;
  dph;
  
  dpl;
  dpl;
  dph;     //55 in binary 00110111
  dph;
  dpl;
  dph;
  dph;
  dph;

  ssh;
  Serial.println("Channel 1 Low");

//  delay(750);
  
/*channel 1 med*/
  ssl;
  
  dpl;
  dpl;
  dph;
  
  dph;     //128 in binary 10000000
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;

  ssh;
  Serial.println("Channel 1 Med");

//  delay(750);
  /*channel 1 hi*/
  ssl;
  
  dpl;
  dpl;
  dph;
  
  dph;     //200 in binary 11001000
  dph;
  dpl;
  dpl;
  dph;
  dpl;
  dpl;
  dpl;

  ssh;
  Serial.println("Channel 1 High");

//  delay(750);

/*channel 2 low*/
  ssl;
  
  dpl;
  dph;
  dpl;
  
  dpl;
  dpl;
  dph;     //55 in binary 00110111
  dph;
  dpl;
  dph;
  dph;
  dph;

  ssh;
  Serial.println("Channel 2 Low");

//  delay(750);
  
/*channel 2 med*/
  ssl;
  
  dpl;
  dph;
  dpl;
  
  dph;     //128 in binary 10000000
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;

  ssh;
  Serial.println("Channel 2 Med");

//  delay(750);
  /*channel 2 hi*/
  ssl;
  
  dpl;
  dph;
  dpl;
  
  dph;     //200 in binary 11001000
  dph;
  dpl;
  dpl;
  dph;
  dpl;
  dpl;
  dpl;

  ssh;
  Serial.println("Channel 2 High");

//  delay(750);

/*channel 3 low*/
  ssl;
  
  dpl;
  dph;
  dph;
  
  dpl;
  dpl;
  dph;     //55 in binary 00110111
  dph;
  dpl;
  dph;
  dph;
  dph;

  ssh;
  Serial.println("Channel 3 Low");

//  delay(750);
  
/*channel 3 med*/
  ssl;
  
  dpl;
  dph;
  dph;
  
  dph;     //128 in binary 10000000
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;

  ssh;
  Serial.println("Channel 3 Med");

//  delay(750);
  /*channel 3 hi*/
  ssl;
  
  dpl;
  dph;
  dph;
  
  dph;     //200 in binary 11001000
  dph;
  dpl;
  dpl;
  dph;
  dpl;
  dpl;
  dpl;

  ssh;
  Serial.println("Channel 3 Hih");

//  delay(750);
  
/*channel 4 low*/
  ssl;
  
  dph;
  dpl;
  dpl;
  
  dpl;
  dpl;
  dph;     //55 in binary 00110111
  dph;
  dpl;
  dph;
  dph;
  dph;

  ssh;
  Serial.println("Channel 4 Low");

//  delay(750);
  
/*channel 4 med*/
  ssl;
  
  dph;
  dpl;
  dpl;
  
  dph;     //128 in binary 10000000
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;

  ssh;
  Serial.println("Channel 4 Med");

//  delay(750);
  /*channel 4 hi*/
  ssl;
  
  dph;
  dpl;
  dpl;
  
  dph;     //200 in binary 11001000
  dph;
  dpl;
  dpl;
  dph;
  dpl;
  dpl;
  dpl;

  ssh;
  Serial.println("Channel 4 High");

//  delay(750);

  /*channel 5 low*/
  ssl;
  
  dph;
  dpl;
  dph;
  
  dpl;
  dpl;
  dph;     //55 in binary 00110111
  dph;
  dpl;
  dph;
  dph;
  dph;

  ssh;
  Serial.println("Channel 5 Low");

//  delay(750);
  
/*channel 5 med*/
  ssl;
  
  dph;
  dpl;
  dph;
  
  dph;     //128 in binary 10000000
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;
  dpl;

  ssh;
  Serial.println("Channel 5 Med");

//  delay(750);
  /*channel 5 hi*/
  ssl;
  
  dph;
  dpl;
  dph;
  
  dph;     //200 in binary 11001000
  dph;
  dpl;
  dpl;
  dph;
  dpl;
  dpl;
  dpl;

  ssh;
  Serial.println("Channel 5 High");

//  delay(750);

}

void ssl(){
  __asm__("nop\n\t");   //supposed to be either 62.5 or 125 nanoseconds, not really sure
  digitalWrite(ss, LOW);
  __asm__("nop\n\t");
}

void ssh(){
  __asm__("nop\n\t");
  digitalWrite(ss, HIGH);
  __asm__("nop\n\t");
}

void dpl(){
  __asm__("nop\n\t");
  digitalWrite(dp, LOW);
  __asm__("nop\n\t");
  digitalWrite(cp, HIGH);
  __asm__("nop\n\t");
  digitalWrite(cp, LOW);
  __asm__("nop\n\t");
}

void dph(){
  __asm__("nop\n\t");
  digitalWrite(dp, HIGH);
  __asm__("nop\n\t");
  digitalWrite(cp, HIGH);
  __asm__("nop\n\t");
  digitalWrite(cp, LOW);
  __asm__("nop\n\t");
}

I get absolutely nothing, no change what so ever out of the digipot. i tried all sorts of different delays(1, 5, 10, and 20 in both milli and micro) and not even a wiggle on the output. I'll keep poking in the dark but at this point, I've hit a wall.

I have given up on the AD5206 and have moved on to 6x MCP4151-103.

Check it out, it works.

https://forum.arduino.cc/index.php?topic=591044.0