How to connect multiple SPI Devices using MicroPython? #13371
Replies: 4 comments 4 replies
-
|
You can connect them both at the same SPI bus with CLK, MOSI, MISO. Only the CS pins must be different. You use the same SPI object for both devices and use the CS pins to address them. If they run at different speeds, you can use spi.init(baudrate=xxx) to change the speed as requested. |
Beta Was this translation helpful? Give feedback.
-
|
I’m using MicroPython on an ESP32‑C6 and trying to connect multiple SPI devices I found this statement in PR #16702: This implies that SDCard() takes exclusive control of the SPI bus, My questions for the MicroPython maintainers and community: The ESP32‑C6 hardware and ESP‑IDF both support multiple SPI devices on the same bus, <----------- Any information, guidance, or plans regarding SPI sharing on the ESP32‑C6 would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
-
|
To connect multiple SPI devices in MicroPython, use separate CS (Chip Select) pins for each device while sharing the same SPI bus (MOSI, MISO, SCK). spi = SPI(1, baudrate=1000000, polarity=0, phase=0, cs1 = Pin(10, Pin.OUT) #setting def spi_transfer(cs, data): Key rules:
|
Beta Was this translation helpful? Give feedback.
-
|
from machine import SPI, Pin spi = SPI(1, baudrate=1000000, sck=Pin(14), mosi=Pin(13), miso=Pin(12)) cs1 = Pin(10, Pin.OUT, value=1) To communicate with device 1cs1.value(0) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
How do you connect two SPI devices in one microcontroller using MicroPython?
I could not find an example (or maybe I don't know the correct keyword).
I have a Raspberry Pi Pico W with a TFT Display and MFRC522 RFID reader. They both used SPI. How do you connect those two in my Pico and how can I program them using MicroPython?
Still learning about MicroPython
Beta Was this translation helpful? Give feedback.
All reactions