SPI(1) configurations

Razeen
Posts: 2
Joined: Wed Mar 21, 2018 6:02 am

SPI(1) configurations

Postby Razeen » Thu Mar 22, 2018 9:52 am

As I understood, the esp32 has SPI(1), SPI(2) and SPI(3). I was able to interface my SPI devices with the SPI(2) and SPI(3) - which also known as VSPI and HSPI. But I couldn't get the SPI(1) to work. Could you please let me know if there is a way that I can use SPI(1)?

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: SPI(1) configurations

Postby ESP_Sprite » Thu Mar 22, 2018 1:26 pm

At the moment: not really. The issue is that there actually is a 4th SPI peripheral, let's call it SPI0. While you've probably never configured or consciously used SPI0, you actually do use it all the time: it's the SPI peripheral that's responsible for grabbing your code and data from the flash chip it lives in while your program is running. Now, SPI0 is quite special in that it can only be used by the logic that does that; you can't manually send commands to it. In order to do this anyway, we have SPI1. SPI1 is a device that is essentially the same as SPI2 and SPI3, but is connected to the same lines as SPI0. We use it if we want to e.g. grab the flash chip ID or write a sector to flash or do something else that is not mindlessly fetching data. However, because SPI1 is connected to the same lines as SPI0, which is always active fetching instructions and data, if you were to use it for other purposes, you need to be very cautious not to interrupt that. Well, the long and short of it is that at the moment the SPI driver does not have logic for that built in, so instead we essentially do not allow it to control SPI1.

Razeen
Posts: 2
Joined: Wed Mar 21, 2018 6:02 am

Re: SPI(1) configurations

Postby Razeen » Fri Mar 23, 2018 2:28 am

Thank you very much for clarification.

Who is online

Users browsing this forum: No registered users and 97 guests