On a custom ESP32-S3 PCB, none of my SPI devices respond

I am working on a custom PCB hexacopter using sensors such as the MLX90393, DPS310, RA-02 (LoRa), MPU6050, and BU03 UWB. All sensors except mpu6050 that use custom SPI pins on the ESP32-S3 are not working, while the MPU6050 works correctly over I²C. I have verified the 3.3 V power and checked all PCB traces, but I still cannot identify the issue. I suspect there may be a problem with the SPI configuration or pin mapping. Below is the schematic of my PCB—please help in identifying the problem.

Welcom to the forum @space_12.

That might be the case, but since you have not posted any of your code, we have no idea how you have customized the pins, although from your circuit diagram it appears that both the default I2C and SPI pins have been re-assigned.

Please note that pins 45 and 46 are bootstrapping pins and should not be used.

i have already tried this with development board and sensors connected with non default spi pins and it worked , but the same setup is not working in a pcb setup. For example this is the code I am using to test UWB bu03 -
`#include "dw3000.h"
#include <SPI.h>

#define APP_NAME "READ DEV ID\r\n"

// ===== ESP32-S3 CUSTOM SPI PINS =====
static const uint8_t PIN_RST = 17; // DW3000 RSTn
static const uint8_t PIN_IRQ = 18; // DW3000 IRQ (GPIO8)
static const uint8_t PIN_SS = 42; // DW3000 CSn

static const uint8_t PIN_SCK = 39; // SPI CLK
static const uint8_t PIN_MISO = 40; // SPI MISO
static const uint8_t PIN_MOSI = 38; // SPI MOSI

void setup() {
UART_init();
UART_puts((char *)APP_NAME);

// ---- Reset DW3000 ----
pinMode(PIN_RST, OUTPUT);
digitalWrite(PIN_RST, LOW);
delay(5);
digitalWrite(PIN_RST, HIGH);
delay(10);

// ---- Initialize SPI with custom pins ----
SPI.begin(PIN_SCK, PIN_MISO, PIN_MOSI, PIN_SS);
SPI.setFrequency(1000000); // 1 MHz for bring-up
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(MSBFIRST);

// ---- Init DW3000 SPI interface ----
spiBegin(PIN_IRQ, PIN_RST); // attaches IRQ + reset
spiSelect(PIN_SS); // selects CS pin

delay(2); // allow DW3000 to enter IDLE_RC

// ---- Read & validate Device ID ----
if (dwt_check_dev_id() == DWT_SUCCESS)
{
UART_puts((char *)"DEV ID OK\r\n");
}
else
{
UART_puts((char *)"DEV ID FAILED\r\n");
}
}

void loop() {
// nothing
} `

I think there is some thing wrong with the pcb schematic and design.

Its a lot easier, in my experience, to debug ‘schematics’ by putting the components on a breadboard, its then heaps easier to work out if the basic wiring of devices is correct.

Did you breadboard the schematic before designing the PCB ?

I did with all sensors individually , never tried to connect all the sensors together on the same spi on breadboard tho but I know some open source designs with a similar setting of connecting esp32s3 with multiple sensors on a custom spi.

Build the PCB in distinct stages, starting with a bare PCB, such as;

Add and test the power supply.

Add the ESP32S3, run a LED Blink program.

Add one of the SPI devices and test it ………….

I already succesfully uploaded blink on it , tried running other sensors working on i2c and everything is working well except the sensors using spi.

U5 DPS310 - Digital Pressure Sensor
According to schematic Pin 8 VDD and pin 6 VDDIO are both connected to LDO with their own (decoupling?) capacitators.

I expected the decoupling capacitators to be usually connected like U1 MLX90393SLW: LDO is connected to pin 8. Between pin 8 and ground there is a decoupling capacitator C29 0,1 uF.

If the actual PCB is made according to schematic, DPS310 have no power and can disturb SPI signals.

Yeah I know about it and I have already fixed that by removing those capacitors and adding decoupling caps between LDO and ground

I am trying to make lora ra-02 work using this code but it fails to start , is there a problem with spi ?

#include <SPI.h>
#include <LoRa.h>

/* ===== Custom SPI pins ===== */
#define SPI_MOSI 38
#define SPI_MISO 40
#define SPI_CLK  39

#define LORA_CS  13
#define LORA_RST 14
#define LORA_DIO0 15
/* =========================== */

SPIClass spi(FSPI);   // REQUIRED on ESP32-S3

void setup() {
  Serial.begin(115200);
  delay(1000);

  Serial.println("ESP32-S3 LoRa test");

  pinMode(LORA_CS, OUTPUT);
  digitalWrite(LORA_CS, HIGH);

  // Start SPI on custom pins
  spi.begin(SPI_CLK, SPI_MISO, SPI_MOSI, LORA_CS);

  // Bind LoRa to this SPI bus
  LoRa.setSPI(spi);
  LoRa.setPins(LORA_CS, LORA_RST, LORA_DIO0);

  if (!LoRa.begin(433E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }

  Serial.println("LoRa started successfully");
}

void loop() {
  Serial.println("Sending message...");
  LoRa.beginPacket();
  LoRa.print("Hello from ESP32!");
  LoRa.endPacket();
  delay(2000);
}

Are you sure that all your SPI devices tri-state the MISO pin when not selected?

What does ‘tri-state’ mean in this context? At the moment I am only trying to get a single SPI device working, not multiple SPI sensors on the same bus.

Is the LoRa device the only device connected to the SPI bus ?

no 3 more sensors (dps310 , uwb bu03 and mlx90393) are also connected to the same spi bus

Then they could be a cause of the problem.

Remove the other devices and see what happens.

actually they are already soldered on the pcb isn't there another way to check it out

You could look at the SPI pins on a scope, to see if they look OK.

As @jim-p suggested its possible one of the many devices on the SPI buses is not behaving properly, even if they are allegedly disabled via there CS pins.

Check out the setup on a breadboard seems the easiest way if you have an already assembled PCB.

It means the the device releases the MISO pin so that other devices on the bus can use it.

I am only trying to get a single SPI device working,

Doesn't matter if you also have other devices connected.

how do I ensure that all other spi sensors tri-state the miso pin

Without additional hardware you can't but first you should read and understand the datasheets for all the devices/ICs you are using. If you do not find the answer in the datasheets, then it is time to get out the scope and start debugging the PCB.

It could also be a layout or assembly issue. Make sure all the parts are orientated correctly, make sure the solder connections look good, make sure the correct values were used, etc.