← index #10239Issue #6859
Related · high · value 3.537
QUERY · ISSUE

ports/esp32:a bug with Hardware SPI Initialize on ESP32-S3

openby EngineerWillopened 2022-12-16updated 2022-12-17
bugport-esp32

Hi,all:

Problem description and analysis

  • Hardware: ESP32S3
  • Firmware version: esp32/GENERIC_S3 v1.19.1 (2022-06-18) or master branch
  • Abstract: SPI(1) and SPI(2) need two initializations to work perfectly in each operation. If two initializations of different Baudrates are not carried out, SPI may not work.

code and pictures

  • Initialize with different baudrates()
self.spi = SPI(2,baudrate=4_000_000,polarity=0, phase=0,sck=Pin(SCK,Pin.OUT),mosi=Pin(MOSI,Pin.OUT))
self.spi = SPI(2,baudrate=8_000_000,polarity=0, phase=0,sck=Pin(SCK,Pin.OUT),mosi=Pin(MOSI,Pin.OUT))

image

  • Initialize with same baudrates(In order to reproduce the problem 100%, you also can initialize it once and run it again)
self.spi = SPI(2,baudrate=8_000_000,polarity=0, phase=0,sck=Pin(SCK,Pin.OUT),mosi=Pin(MOSI,Pin.OUT))
self.spi = SPI(2,baudrate=8_000_000,polarity=0, phase=0,sck=Pin(SCK,Pin.OUT),mosi=Pin(MOSI,Pin.OUT))

image

details

First time

I used the firmware V1.91.1 and found that SPI (1) initialization was abnormal. SPI(2) can work normally.
However, when I tried for the second time (after stop), I found that it could not work.
I tried to restart it and it could work again, but it still couldn't work the second time.
Then I tried various methods and accidentally found that baudrate could work after modification. So I conducted two initializations,The baudrate needs of the first initialization were different from that of the second initialization,The program could run perfectly, no matter whether it was STOP or not.

  • like
self.spi = SPI(2,baudrate=4_000_000,polarity=0, phase=0,sck=Pin(SCK,Pin.OUT),mosi=Pin(MOSI,Pin.OUT))
self.spi = SPI(2,baudrate=8_000_000,polarity=0, phase=0,sck=Pin(SCK,Pin.OUT),mosi=Pin(MOSI,Pin.OUT))

I found out that lssues #8634 suffers from a similar problem and saw the initialization issue solved in #9498

The second time

I tried to use the master branch to build a new firmware to try,
and then I found that SPI(1) and SPI(2) can be initialized normally and work, but the problem still exists that the initialization needs to be twice.

CANDIDATE · ISSUE

esp32: Hardware SPI not working with non-standard Pins

closedby kevinkk525opened 2021-02-07updated 2024-08-19

I recently came across the issue that the Hardware SPI (HSPI/VSPI) on the esp32 don't work with non-standard Pins. Accordings to documentations the esp32 should have no problem with non-standard ports but it doesn't work. Standard ports however do work and the SoftwareSPI worked on the non-standard ports I tried.
Firmware: micropython 1.14

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied