-
Notifications
You must be signed in to change notification settings - Fork 33
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
U8G2 does not work on GD32 #92
Comments
I tested a SSD1306 display with the "Adafruit SSD1306" library and that worked at the time. Your pins are correct. ArduinoCore-GD32/variants/GD32F303CC_GENERIC/variant.h Lines 96 to 97 in a178ad6
Can you run the https://playground.arduino.cc/Main/I2cScanner/ sketch to see if it detects an I2C device on the bus at all? |
Hmm actually I just plugged in my SSD1306 and it worked fine with the library. Using #include <Arduino.h>
#include <SPI.h>
#include <U8x8lib.h>
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE);
void setup(void) {
u8x8.begin();
u8x8.setPowerSave(0);
u8x8.setFont(u8x8_font_chroma48medium8_r);
}
void loop(void) {
u8x8.drawString(0,3,"ChipTmp = ");
u8x8.setCursor(10,3);
u8x8.print("Test");
delay(1000);
} with [env]
platform = https://github.com/CommunityGD32Cores/platform-gd32.git
platform_packages =
framework-arduinogd32@https://github.com/CommunityGD32Cores/ArduinoCore-GD32.git
monitor_speed = 115200
lib_deps = olikraus/U8g2@^2.34.18
[env:genericGD32F303CC]
board = genericGD32F303CC
framework = arduino And HW connections between my Bluepill (GD32F303CC chip):
The code runs first try. What's your |
We do seem to have some.. room for improvement though, performance-wise. I've noticed that when you do a display clear and redraw, it's visibly slow. Somewhere it's hitting a timeout in the I2C code. You can lower the default timeout ( |
I tried your codes and changed another OLED, same black, hardware connection is the same with only Vcc to 5V (yours 3.3V). BTW, how to upload photo and video? below is my platformio.ini ; PlatformIO Project Configuration File [env:genericGD32F303CC] |
The SSD1306 OLED with 5V? Doesn't that kill it and would make all the I/O 5V? |
the spec says Vcc can accept 3.3V to 5V, there is a smt voltage regulator mounted on the board. |
What address does the I2C scanner report? #92 (comment) |
I got these two line under serial terminal. I2C Scanner Scanning... Scanning... |
Hm... Does my OLED maybe have 4.7K pullups to VCC on SCL and SDA? I haven't run the address scanner on my board yet, but given that the display reacts for me, I guess it should also be found. "No device" looks like either the device is not responding or there's an electrical problem on the I2C bus or the OLED. |
no lucky with 4.7k resistor pullup to 5V on both SCL and SDA. |
And when using only 3.3V? |
I think it is my problem, let me try it on breadboard again |
ok, I tried on breadboard, with same wiring, one works one does not. the one does not work is a GD32F303CG, and the one I just tested good as exactly what you did, is GD32F303CC. when I try to modify the platformio.ini from CC to CG, it comes with this compile error: Processing genericGD32F303CG (board: genericGD32F303CG; framework: arduino; platform: https://github.com/CommunityGD32Cores/platform-gd32.git)
now it comes with another question, how to make the CG work with Arduino-GD32? |
The GD32F303CC variant definition was inherited, while practically all other variant definitions were auto-generated. We don't yet have auto-generation of the Arduino variants for GD32F30x series, which would give is the CG definition. The problem may be that the CG chip belongs to the "XD" (extra-density) class while the CC chip is "HD" (high-density). This actually changes some very low level register and interrupt definitions. Could you please do the following as "hat trick": Use the [env:genericGD32F303CG]
platform = gd32
; use CC as a base board
board = genericGD32F303CC
; but make it seem like it's a XD chip (as the CG chip actually is)
build_unflags = -DGD32F30X_HD
build_flags= -DGD32F30X_XD
board_build.spl_sub_series = XD
; correct flash and RAM sizes to the bigger ones (of the CG)
board_upload.maximum_size = 1048576
board_upload.maximum_ram_size= 98304
framework = arduino
lib_deps = olikraus/U8g2@^2.34.18 |
use the provided platformio.ini does pass the compile, but does not solve the issue :-( |
Can you attach the debugger using the VSCode Debug -> Start Debugging menu, let the firmware run with the play button, and then pause it after some time? Does the call stack show that it's crashed in some exception handler? |
I'm not good at debugging, I tried to step into/step out/step over, it keeps going I do not see any crash (lose control?) happen. |
Let me create a dedicated Arduino variant for the CG chip and verify that it atleast looks and compiles good. Unfortunately I don't have a GD32F303CG chip or board to test with :( |
if you have a hot gun, you can replace the stm32F103C8T6 on bluepill by GD32F303CGT6, it is pin to pin replacement. the GD32F303CG itself is quite cheap, wildly available https://www.aliexpress.com/w/wholesale-gd32f303cgt6.html?catId=0&initiative_id=AS_20230606040937&origin=y&SearchText=gd32f303cgt6&spm=a2g0o.detail.1000002.0 but anway I give up the CG chip, the platformio delicately support CC chip with Arduino, and I do not actually need that much money to play with :-) let's focus our energy on CC chips first. |
Then let's have this tracked in #94 instead since it does work on the out-of-the-box supported CC chip as of now and CG is not yet officially supported herer. I just ordered a few of these CG chips (really cheap) and I should have a LQFP breakout board to solder them to and hook them up. |
I tried to port the I2C OLED code from STM32duino (which is working) to GD32 but failed, the HW I2C I'm using now with GD32 is SCL(PB8) and SDA(PB9), below is the STM32duino codes associated with OLED:
#include <U8x8lib.h>
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE);
void setup() {
...
u8x8.begin();
u8x8.setPowerSave(0);
u8x8.setFont(u8x8_font_chroma48medium8_r);
}
void loop() {
...
u8x8.drawString(0,3,"ChipTmp = ");
u8x8.setCursor(10,3);
u8x8.print(In_Temp);
delay(1);
}
the screen is just totally black
The text was updated successfully, but these errors were encountered: