Skip to content

How to use custom SPI pins on ESP32-S3? #1051

Answered by S5NC
S5NC asked this question in Q&A
Discussion options

You must be logged in to vote

Here is the working code which I am using to set custom SPI pins on the ESP32-S3 and SX1262:

#include <RadioLib.h>
#include <SPI.h>

#define SX1262_CS 14
#define SX1262_SCK 21
#define SX1262_MOSI 38
#define SX1262_MISO 39
#define SX1262_RESET 40
#define SX1262_BUSY 41
#define SX1262_DIO1 42

#define SX1262_DIO2_AS_RF_SWITCH 1
#define SX1262_TXEN RADIOLIB_NC
#define SX1262_RXEN 10

SX1262 radio = new Module(SX1262_CS, SX1262_DIO1, SX1262_RESET, SX1262_BUSY);

void checkState(int16_t state) {
  if (state != RADIOLIB_ERR_NONE) {
    Serial.print(F("[SX1262] configuration failed with code "));
    Serial.println(state);
    while (true) {}
  }
}

void setup() {

  Serial.begin(115200);

  SPI.b…

Replies: 6 comments 46 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
8 replies
@S5NC
Comment options

@StevenCellist
Comment options

@S5NC
Comment options

@StevenCellist
Comment options

@S5NC
Comment options

Comment options

You must be logged in to vote
37 replies
@jgromes
Comment options

@jgromes
Comment options

@S5NC
Comment options

@S5NC
Comment options

@S5NC
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@HeadBoffin
Comment options

Answer selected by S5NC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants