E0 SPI Slave Garbage MISO Data

Having some issues getting the SPI Slave to work on E0.

I am using the default SPI pins (A2-A5) and the general configuration described in the docs, with the exception that I’ve configured the clock speed explicitly at 100k (slow).

Am seeing this super strange behavior on the MISO line. The first byte, 0xFF, is sent properly. Then the E0 just spits out garbage, the MISO line is the second in the image. Bus is wired directly to an ESP32 with no pulls or termination, only other connection is the Logic.

Code included below… Should be relatively straight forward, also this is using an E0 eval board powered via USB. Any advice greatly appreciated.

SYSTEM_MODE(MANUAL);

#include "lte_gtw.h"

// SPI SLAVE PARAMETERS 
static char spi_rx_buffer[] = {0,0,0,0,0,0};    
static char spi_tx_buffer[] = {0,0,0,0,0,0};
volatile uint8_t has_transmitted = 1; 

// GLOBAL PARAMETERS 
volatile uint8_t vehicle_state = 0;       // default to off--see enums in header 
volatile uint8_t vehicle_gear = 0;        // default to park--see enums in header 

void myFunction(uint8_t nothing){
  // Serial.println("look at me "); 
}

// runs when the master has finished sending us datas 
void spiTransferFinished() {
  // update the global parameters from the SPI data 
  vehicle_state = spi_rx_buffer[VEH_STATE_INDEX];
  vehicle_gear = spi_rx_buffer[VEH_GEAR_INDEX];
  uint8_t test_1 = spi_rx_buffer[1];
  uint8_t test_2 = spi_rx_buffer[2];
  uint8_t test_4 = spi_rx_buffer[4];
  uint8_t test_5 = spi_rx_buffer[5];
  Serial.print("Vehicle state is: "); Serial.println(vehicle_state);
  Serial.print("Test 1 is: "); Serial.println(test_1);
  Serial.print("Test 2 is: "); Serial.println(test_2);
  Serial.print("Vehicle gear is: "); Serial.println(vehicle_gear);
  Serial.print("Test 4 is: "); Serial.println(test_4);
  Serial.print("Test 5 is: "); Serial.println(test_5);
  Serial.println(); 
  
  // update data out to master 
  spi_tx_buffer[0] = 0xFF; 
  spi_tx_buffer[1] = 0x11; 
  spi_tx_buffer[2] = 0x22; 
  spi_tx_buffer[3] = 0x33; 
  spi_tx_buffer[4] = 0x44; 
  spi_tx_buffer[5] = 0xFF; 

  has_transmitted = 1; 
}



void setup() {
 
  #ifdef SERIAL_DEBUG
    Serial.begin(112500);
    delay(100);
  #endif 

  // SPI INITIALIZATION 
  spi_tx_buffer[0] = 0xFF; 
  spi_tx_buffer[1] = 0x11; 
  spi_tx_buffer[2] = 0x22; 
  spi_tx_buffer[3] = 0x33; 
  spi_tx_buffer[4] = 0x44; 
  spi_tx_buffer[5] = 0xFF; 

  SPI.begin(SPI_MODE_SLAVE, ELEC_CS); 
  SPI.setClockSpeed(100000);
  SPI.setDataMode(SPI_MODE0);                       
  SPI.onSelect(myFunction);
}

void loop() {
    // SPI COMMUNICATION 
    if(has_transmitted) {
      has_transmitted = 0; 
      SPI.transfer(spi_tx_buffer, spi_rx_buffer, sizeof(spi_rx_buffer), spiTransferFinished);
    }
}