Page 2 of 2
Re: Adafruit_ST7735 > 1.1.0 not working
Posted: Thu Aug 26, 2021 8:05 am
by fpiSTM
Underscore usage is not correct except if someone add a PR to this lib to use PinName instead of standard Arduino pin number....
Edit: Got it!
deleted
Re: Adafruit_ST7735 > 1.1.0 not working
Posted: Thu Aug 26, 2021 4:55 pm
by fpiSTM
Ok I've understand all the issue.
Adafruit uses int8_t for each pins give to the constructor:
Code: Select all
Adafruit_ST7735(int8_t cs, int8_t dc, int8_t mosi, int8_t sclk, int8_t rst);
Adafruit_ST7735(int8_t cs, int8_t dc, int8_t rst);
Adafruit_ST7789(int8_t cs, int8_t dc, int8_t mosi, int8_t sclk, int8_t rst = -1);
Adafruit_ST7789(int8_t cs, int8_t dc, int8_t rst);
So for the Blackpill PAx are defined like this:
Code: Select all
#define PA0 PIN_A0
#define PA1 PIN_A1
#define PA2 PIN_A2
#define PA3 PIN_A3
#define PA4 PIN_A4
#define PA5 PIN_A5
#define PA6 PIN_A6
#define PA7 PIN_A7
They are Analog pins, so PIN_Ax start from 0xC0 then the constructor use it as an negative value which is not correct.
Instead of using PA4, using D4 or 4 will work. PA_4 works because in this case it is equal to 4.
It should be an uint8_t as specified by the Arduino Core API:
https://github.com/arduino/ArduinoCore- ... mmon.h#L91
Re: Adafruit_ST7735 > 1.1.0 not working
Posted: Thu Aug 26, 2021 9:45 pm
by Bakisha
I can confirm that it's working using D2/D3/D4 (and 2/3/4) instead of PA_2/PA_3/PA4.
I guess i've just being lucky.
What about port B pins? PB1 should work without underscore? I can't test that at the moment.
Re: Adafruit_ST7735 > 1.1.0 not working
Posted: Fri Aug 27, 2021 7:29 am
by fpiSTM
Bakisha wrote: Thu Aug 26, 2021 9:45 pm
What about port B pins? PB1 should work without underscore? I can't test that at the moment.
Yes except for PB0 and PB1 which are analog.
I will try to provide a PR to the Adafruit GFx library to avoid this issue.
Re: Adafruit_ST7735 > 1.1.0 not working
Posted: Fri Aug 27, 2021 9:14 am
by fpiSTM
Re: Adafruit_ST7735 > 1.1.0 not working
Posted: Fri Aug 27, 2021 11:29 am
by Kenjutsu
Thank you! I can confirm that this now works as expected for both the F103 Blue Pill and F411 Black Pill.

Only tested SPI1 however.
Re: Adafruit_ST7735 > 1.1.0 not working
Posted: Sun Aug 29, 2021 10:40 am
by Kenjutsu
Just another FYI:
- SPI2 tested and working
- Adafruit_ILI9341 library tested and working, both SPI1 and SPI2
Re: Adafruit_ST7735 > 1.1.0 not working
Posted: Thu Apr 21, 2022 12:41 am
by nealix58
@fpiSTM:
I was having this same problem. So right now, I replaced the older Adafruit_GFX lib with the version at
your pull request link provided above. And I am getting ready to experiment and see if I can fix this.
My next question; To free up Analog pins on the STM32F411 Black Pill, I want to move to using alternate SPI
pins PB_12 through PB_15. Using your lib, where you converted to using uint8, what syntax should I use
in order to make SPI use PB_12 through PB_15 on the black pill module?
(With the old lib, I wasted an entire day compiling and flashing, just to find out nothing worked

)
I am still new to this, and I do not have a good grasp yet about the differences between pin names and numbers,
and absolute numbers such as here:
https://github.com/stm32duino/Arduino_C ... L_F411CE.h
so, for example, what is the difference between PB12, PB_12, and just "27" using the above URL/Link?
Sincere thanks for fixing the lib.
Neal
Re: Adafruit_ST7735 > 1.1.0 not working
Posted: Thu Apr 21, 2022 8:06 am
by fpiSTM
PB12 == 27 == D27 --> Pin number, used for all standard Arduino API
PB_12 --> pin name it is: <GPIO port><GPIO pin> used to get the correct type for the HAL/LL API.