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

How to use both VSPI & HSPI SPI buses simultaneously? #790

Closed
neilpanchal opened this issue Oct 30, 2017 · 2 comments
Closed

How to use both VSPI & HSPI SPI buses simultaneously? #790

neilpanchal opened this issue Oct 30, 2017 · 2 comments

Comments

@neilpanchal
Copy link

@neilpanchal neilpanchal commented Oct 30, 2017

Hardware:

Board: ESP32-DevKit-C
Core Installation/update date: Latest
IDE name: IDF Component

Description:

Trying to use both VPSI & HSPI busses simultaneously to drive two OLED displays. By default, SPIBegin() works with VSPI pinouts.

Sketch:

I've tried the suggested code here: olikraus/u8g2#377 (comment)

Is the usage of HSPI + VSPI through arduino API possible currently? If so, what is the best way to achieve this?

@me-no-dev

This comment has been minimized.

Copy link
Member

@me-no-dev me-no-dev commented Oct 30, 2017

SPIClass SPI2(HSPI);

void setup(){
  SPI2.begin(...);
  //... your code
}

In order to use the OLED with the other SPI you might need to alter the lib to take SPIClass &spi`` as argument and use that instead of SPI```

@neilpanchal

This comment has been minimized.

Copy link
Author

@neilpanchal neilpanchal commented Nov 5, 2017

@me-no-dev

I tried replacing all references to SPI and replaced them to SPI2 in this file:
https://github.com/olikraus/U8g2_Arduino/blob/master/src/U8x8lib.cpp#L394
That's the only place SPIClass object is called. I still have the OLED display connected to the following pins. The code compiles fine and I made sure the SPI2 is instantiated in SPI.cpp in the ESP32-Arduino Library.

SDA = IO 23
SCLK = IO 18
D/C = IO 21
RST = IO 22
CS = IO 5

and oled works fine. It didn't switch to HSPI pins.

So, looks like the VSPI (3) and HSPI (2) #defines are not being executed? I need to debug more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.