-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Unable to Change SPI SCLK in SPI.cpp when using different IDEs (Component vs. PlatformIO) #708
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
Comments
try make clean and make again... I have no clue really :) using as IDF component here as well and have no issues with SPI frequency at all. I bet it's something really stupid going on in the build. |
@me-no-dev I have tried Let me try to install this on a completely new linux VM and get back to you. Update:
|
I am able to reproduce the error on a new Ubuntu 16.04 VM while following exact instructions of setting up the ESP-IDF and arduino-esp32 as a component from the Wiki. |
I might have found the issue ;) https://github.com/neilpanchal/U8g2_Arduino/blob/master/src/U8x8lib.cpp#L420 |
Try compiling under ArduinoIDE, if it works, then the lib is needs some updates to get it to work |
To my knowledge ARDUINO always had a version number in standard Arduino IDE. "beginTransaction" was introduced around 1.6.0. I do not know what to change here. In order to make u8g2 compatible with older versions of the original Arduino IDE, i have to check the IDE version. |
yeah, but he is using IDF ;) |
Can someone educate me where exactly in the whole toolchain ARDUINO is defined? |
I'll add define for this in the component config and that should clear the issue :) |
Please pull the latest arduino and give it another go :) |
@me-no-dev Awesome. For my education, what does the default |
AFAIK should be 1.8 but maybe version numbers changed at some point. Added this long long time ago :D no clear memory at which lib/IDE I was looking for inspiration |
@me-no-dev Confirmed working on both original setup and the new ubuntu VM. Thank you! |
I have not tracked down where exactly this is defined, but the value for the ARDUINO macro is defined here: |
Amazing, but this is probably beyond the spec of the SSD1306 |
Hardware:
Board: ESP32 DevKit-C
Core Installation/update date: Latest
IDE name: Multiple (ESP-IDF Arduino Component vs. Platform IO)
Flash Frequency: 40Mhz
Upload Speed: 115200
Summary:
I've come across an interesting roadblock. I am not able to change the SPI SLCK frequency in the SPI.cpp library when using arduino-esp32 as a ESP-IDF component. When I use PlatformIO with identical settings, I am able to change the SPI SLKC frequency. It has nothing to do with the U8g2 library as I have tried to hardcode the SPI.cpp frequency values without success.
Description
Arduino-esp32 dictates 4 ways of using the Arduino API with ESP-IDF in the instructions/readme.
Method 1 - Using Arduino API as ESP-IDF Component [This doesn't work]
One of those ways is to use Arduino API as an ESP-IDF component as described here. I managed to add Arduino API to ESP-IDF using this method. Next, I've added a component.mk file to @olikraus's U8g2_Arduino fork.
Component.mk has the following options to add source directors and include files:
Now, U8g2 is a component of ESP-IDF.
Everything works except There is one problem. Usually, I am able to edit the SPI frequency in the u8x2_d_ssd1306_128x64_noname.c,
/* sck_clock_hz = */ 10000000UL,
however, no matter what frequency I set and upload to ESP32, I always get 8MHz as the clock freq. I've validated it using a scope.
I've hardcoded the SPI freq to 10 MHz in the arduino-esp32 SPI.c file and it still doesn't work:
So I tried to use arduino-esp32 using PlatformIO. This problem does not happen when I use Platform IO and downloading latest U8g2 library + arduino-esp32 platform.
Method 2 - Using PlatformIO [This works]
So, I tried the same test as above and I changed the
u8x8_d_ssd1306_128x64_noname.c LINE 235
to use 10 MHz as the clock frequency./* sck_clock_hz = */ 10000000UL,
This time, using Platform IO toolchain, it works! I checked it with a scope and I am getting 10 MHz as the clock frequency.
Scope screenshot says 9.62 MHz but it is 10 MHz when I change the horizontal scale.
I am pretty sure I am missing something obvious here.
Any ideas on what must be going on?
Sketch:
The text was updated successfully, but these errors were encountered: