ESP32S3FH4R2 Super mini board printing out garbled data

So I recently wanted to just send SPI data, and learn how to use SPI on ESP32-S3, but all i get on my nanoDLA reader is garbled data (https://github.com/wuxx/nanoDLA/blob/master/README_en.md),

#include <SPI.h>

// Define SPI pins

#define CS    10

#define SCLK  13

#define MISO  12

#define MOSI  11

const char *data = "Hello world";

void setup() {

// Start serial communication

Serial.begin(115200);

// Set pin modes for SPI

pinMode(CS, OUTPUT);

pinMode(SCLK, OUTPUT);

pinMode(MISO, INPUT);

pinMode(MOSI, OUTPUT);

// Initialize SPI

SPI.begin(SCLK, MISO, MOSI, CS);  // Set up SPI (SCK, MISO, MOSI, SS)

// SPI settings: Adjust according to your device's specs

SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE1));  // 1MHz, MSB first, SPI Mode 0

}

void loop() {

// Start SPI communication

digitalWrite(CS, LOW);  // Enable the device (chip select low)

// Send the data over SPI

for (int i = 0; i < strlen(data); i++) {

SPI.transfer(data\[i\]);

}

// End SPI communication

digitalWrite(CS, HIGH);  // Disable the device (chip select high)

// Delay for 1 second

delay(1000);

}

Try running LSB first. your picture does not help, it is to granular.

I moved your topic to a more appropriate forum category @Awsome.

The Nano Family > Nano ESP32 category you chose is only used for discussions directly related to the Arduino Nano ESP32 board.

In the future, when creating a topic please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.

Thanks in advance for your cooperation.

Here is a close up of some of the signal changes you see in the previos picture. Also forgot to mention I have the latest version of Arduino IDE and default settings in the tools tab of Arduino IDE. Thank you for the suggestion, but what is LSB?

LSB is the opposite of MSB where LSB is least significant bit and MSB is most significant. If you break SPI down it is a simple shift register that you can shift left or right. Left left which places the most significant bit out first the the rest follow with each clock. However if you shift right the least significant bit comes out first.

In SPI (Serial Peripheral Interface), CPOL (Clock Active Low) and CPHA (Clockl Polarity High Active) defines how the clock behaves and when data is sampled by the receiver. If it is zero data is sampled on the first (leading) edge and if 1 data is sampled on the (traling) edge. They’re crucial because both master and slave must agree on them or communication breaks. Note the clock is ALWAYS generated by the master.

If CPO= 0 the clock is low when idle, conversely if CPOL is high then the clock is high when idle.

To break it down CPOL determines what logic level the clock is at during idle. CPHA tells you which edge you need to read the data bit on.

SPI Mode CPOL CPHA Clock Idle Data Sampled On
Mode 0 0 0 Low Rising edge
Mode 1 0 1 Low Falling edge
Mode 2 1 0 High Falling edge
Mode 3 1 1 High Rising edge

Hopefully this helps un-confuse what is going on.