Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32 - S3 build (ESP IDF 4) - Error Initialising SPI1 #2601

Open
SimonGAndrews opened this issue Jan 23, 2025 · 5 comments
Open

ESP32 - S3 build (ESP IDF 4) - Error Initialising SPI1 #2601

SimonGAndrews opened this issue Jan 23, 2025 · 5 comments
Labels
ESP32 This is only a problem on ESP32-based devices

Comments

@SimonGAndrews
Copy link
Contributor

See Forum Where issues identified by @devsnd result in a restart of the ESP32 - S3 when
SPI1.setup({ sck:D4, mosi:D5 });
is executed in a script.
The issue does not occur when this code is used:
var spi = new SPI(); spi.setup({ sck:D4, mosi:D5 });

The restart is preceeded with the message:

Image

spi_bus_initialize is called in Espruino from targets/esp32/jshardwareSpi.c
Investigation to follow.

@MaBecker MaBecker added the ESP32 This is only a problem on ESP32-based devices label Jan 23, 2025
@MaBecker
Copy link
Contributor

My guess: This could be some hard coded dma channel or an sdconfig issue.

@gfwilliams
Copy link
Member

Thanks for looking into this! As you say it looks like targets/esp32/jshardwareSpi.c has a hard-coded dma channel. It looks suspiciously like we may just be able to specify SPI_DMA_CH_AUTO? https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32/api-reference/peripherals/spi_master.html?highlight=spi_dma_ch_auto

You probably spotted the pins are hard-coded too, so ideally this could benefit from the same approach you used for I2C

@SimonGAndrews
Copy link
Contributor Author

Thanks, yep will check out the use of SPI_DMA_CH_AUTO
And look at the pins. The i2c2 pins need defining also. I’m not as familiar with SPI so doing a little home work this am. Should be able to sort.

@gfwilliams
Copy link
Member

I’m not as familiar with SPI so doing a little home work this am

Thanks! If you want a quick test, connect MOSI and MISO pins together, and you should then be able to do SPI.send("Hello") and get the same characters back!

@SimonGAndrews
Copy link
Contributor Author

Nice Tip. Thanks.
Just to confirm this issue also occurs in the ESP32C3_IDF4 (ESP32-C3 target) build so will fix for both targets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ESP32 This is only a problem on ESP32-based devices
Projects
None yet
Development

No branches or pull requests

3 participants