• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

How to use 2 SPI devices, LoRa and SD Card, on ESP32 TTGO T1 V1.3

Q&A Forum › Category: ESP32 › How to use 2 SPI devices, LoRa and SD Card, on ESP32 TTGO T1 V1.3
0 Vote Up Vote Down
Pepe Alcaide Soret asked 4 years ago

How to use 2 SPI devices, LoRa and SD Card, on ESP32 TTGO T1 V1.3
Good moorning,
I am using these modules in order to send and save data from BME280 sensor.
TTGO T1 ESP-32 V1.3
https://es.aliexpress.com/item/4001229463219.html?src=google&albch=shopping&acnt=439-079-4345&isdl=y&slnk=&plac=&mtctp=&albbt=Google_7_shopping&aff_platform=google&aff_short_key=UneMJZVf&gclsrc=aw.ds&&albagn=888888&&ds_e_adid=487540931172&ds_e_matchtype=&ds_e_device=c&ds_e_network=u&ds_e_product_group_id=1161613595211&ds_e_product_id=es4001229463219&ds_e_product_merchant_id=105381714&ds_e_product_country=ES&ds_e_product_language=es&ds_e_product_channel=online&ds_e_product_store_id=&ds_url_v=2&ds_dest_url=https://es.aliexpress.com/item/4001229463219.html?&albcp=11896381096&albag=115883339016&isSmbAutoCall=false&needSmbHouyi=false&gclid=CjwKCAiAjp6BBhAIEiwAkO9WuvOsa0-mHfAed1LxcUORiEYGYmSEv4_Nvsd2cMWRX-EANE_Y14rTwBoC5FoQAvD_BwE
Adafruit RFM95W LoRa Radio Transceiver Breakout
https://www.adafruit.com/product/3072
BME280
https://www.aliexpress.com/i/32959552723.html?albagn=888888&&src=google&albch=search&acnt=479-062-3723&isdl=y&aff_short_key=UneMJZVf&albcp=653902457&albag=33232068455&slnk=&trgt=dsa-401928029209&plac=&crea=427719926346&netw=g&device=c&mtctp=b&memo1=&albbt=Google_7_search&aff_platform=google&gclid=CjwKCAiAjp6BBhAIEiwAkO9WuhnFHM6F–M1ItYiM1M-eKgtI6K0qsWE24r6DSnabOhFKYQWtrCBxxoCIe8QAvD_BwE&gclsrc=aw.ds
However, I need to solve a problem relate to two SPI devices on an esp32. LoRa and SD card module using SPI.
There are a number of articles out there on how to do what you want but not much with the ESP32.
https://learn.sparkfun.com/tutorials/serial-peripheral-interface-spi/all
https://cdn-learn.adafruit.com/downloads/pdf/arduino-ethernet-sd-card.pdf
https://stackoverflow.com/questions/57454066/how-to-use-2-spi-devices-lora-and-sd-card-on-esp32
However, I haven’t found a right option.
Any help in the correct direction would be appreciated.
Thanks in advance 😉

Question Tags: SPI
1 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Pepe.
You can use two or more SPI devices on the ESP32 on the same SPI pins as long as each module is connected to a different chip select (CS) pin.
In your board pinout, we can see that these are the pins for the SD card:

  • MOSI: GPIO 15
  • MISO: GPIO 2
  • SCK: GPIO 14
  • CS: GPIO 13

You can use those same pins to connect your LoRa transceiver module, except the CS pin that must be unique. Or you can use the VSPI pins:

  • MOSI: GPIO 23
  • MISO: GPIO 19
  • SCK: GPIO 18
  • CS: GPIO5

And finally, you also need to connect G0 (DI0 in our instructions). You can connect it to GPIO 27, for example.
You can see the pinout for your board here:

I see that you have access to the “Learn ESP32 with Arduino IDE” course. Take a look at Project 4 (Unit3) that uses SD card and LoRa. That will help you with the code.

I hope this helps.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.