-
Notifications
You must be signed in to change notification settings - Fork 66
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
HWSPI works on ESP8266 but not ESP32. SWSPI works on ESP32 but is slow #27
Comments
Thanks for reporting this. I’ll take a look. HWSPI should be working for both. |
So, to be fair, the HWSPI situation on ESP32 is not super clear, as there are 2 default SPIs, VSPI and HSPI. I have a little cheat sheet that I paste in my code and that you are welcome to borrow from if you'd like to include it in your code samples too:
I know @ladyada told me in a prior PR I sent to add pinouts for other chips that she wasn't really interested in it, but at the same time, you do have it in some other library examples like this one While you don't have to include https://github.com/adafruit/Adafruit-SSD1331-OLED-Driver-Library-for-Arduino/pull/25/files as is, I think something similar to what you have for ST7735, would make things easier for people testing (including you when looking at a report like this one :) ). As far as wiring goes, I have confirmed that VSPI pins with HWSPI works on my ESP32 with ILI9341, as well as ST7735, and the writing works with SSD1331 as long as I define the pins as SWSPI.
causes the SPI to hang. |
I think the pins used for the ST7735 Library were submitted as part of a PR that I merged in. The reason I let those be added in was because the PR organized all the examples to be consistent which made it easy to be able to add PyGamer and PyBadge pin sets since they use the ST7735R display. One reason including the ESP32 pins is useful in the ST7735 library and not so much here is because there is a featherwing that uses the ST7735R display (Mini TFT plus joystick) so it can be easily matched with the Huzzah32 Feather, but the SSD1331 is only available in a breakout. That being said, it might be nice to add a comment into this library that basically says the ESP32 uses VSPI by default. |
yeah i dont like having non-fixed-hardware-devices in #ifdefs. it can cause a lot of confusion and support on our side :/ |
@makermelissa https://github.com/adafruit/Adafruit-ST7735-Library/blob/master/examples/graphicstest/graphicstest.ino is actually an example of what I'd like to see more :) Counter example is Now, to take @ladyada 's comment into account, maybe just mentioning the pins as part of a comment (i.e. not an ifdef), whether it's the small table I gave above, or some other way, would still be a very helpful pointer IMO. Anyway, just my thoughts, you obviously have more insight about the pros and cons here. |
Any update on having HWSPI working on ESP32? |
For anyone also seeing this problem, and not being ok with the SWSPI speed on ESP32 (I get only 7fps for full frame refresh), you can switch to https://github.com/moononournation/Arduino_GFX which supports HWSPI without crashing, and even HWSPI with DMA, which is even faster (I get around 160fps at 80Mhz) |
This is still an issue in 2024 which is hilarious 😅. Following @marcmerlin's advice, all works well. If like me you'd also like to use the AnimatedGIF library, there's an example of that provided in the library here. Be sure to choose the correct display class if yours doesn't match the display in the example. |
@terishrimp I gave up on this lib and using Arduino_GFX exclusively. The main reason for using my lib on top is that you can then replace the underlying hardware lib to one of 8 different things and your code will keep working |
I'm using the last version from git with arduino 1.8.9 on ESP32
The code works as is but is slow due to SWSPI.
Adafruit_SSD1331(cs, dc, rst); hangs as soon as I run display.show()
Adafruit_SSD1331(&SPI, cs, dc, rst) hangs too
and the full definition of tftSPI using VSPI default pins, also hangs.
The text was updated successfully, but these errors were encountered: