• 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

esp32 used as SPI MASTER and SLAVE

Q&A Forum › Category: ESP32 › esp32 used as SPI MASTER and SLAVE
0 Vote Up Vote Down
Donald Wile asked 6 years ago

I’m trying to use two esp32’s….one as a SPI MASTER and the other as an SPI SLAVE. I can’t find any code to help with a simple example. All the Arduino code I find uses things like :

// Enable SPI as slave.
SPCR = (1 << SPE);

which the IDE doesn’t understand (doesn’t recognize SPCR or SPE)  for the esp32.

Can anyone point me to a clear example of working SPI MASTER and SLAVE code?  Thanks.

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

Hi Donald.

I don’t have an example on how to do that.

But, you can take a look at the spi_master.h and spi_slave.h files and see if you can figure out:
https://github.com/espressif/arduino-esp32/blob/master/tools/sdk/include/driver/driver/spi_master.h
https://github.com/espressif/arduino-esp32/blob/master/tools/sdk/include/driver/driver/spi_slave.h

You can also take a look at the IDF documentation:
https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/spi_slave.html#_CPPv420spi_slave_initialize17spi_host_device_tPK16spi_bus_config_tPK28spi_slave_interface_config_ti

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.