Adafruit_ST7735 > 1.1.0 not working

User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Adafruit_ST7735 > 1.1.0 not working

Post 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.... :x

Edit: Got it!
deleted
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Adafruit_ST7735 > 1.1.0 not working

Post 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
User avatar
Bakisha
Posts: 139
Joined: Fri Dec 20, 2019 6:50 pm
Answers: 5
Contact:

Re: Adafruit_ST7735 > 1.1.0 not working

Post 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.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Adafruit_ST7735 > 1.1.0 not working

Post 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.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Adafruit_ST7735 > 1.1.0 not working

Post by fpiSTM »

Kenjutsu
Posts: 27
Joined: Tue Apr 07, 2020 10:58 am
Answers: 2

Re: Adafruit_ST7735 > 1.1.0 not working

Post by Kenjutsu »

fpiSTM wrote: Fri Aug 27, 2021 9:14 am I've made a PR:
https://github.com/adafruit/Adafruit-GF ... y/pull/359
Thank you! I can confirm that this now works as expected for both the F103 Blue Pill and F411 Black Pill. 8-) Only tested SPI1 however.
Pieter

OSX: 11.6.8
Arduino IDE: 1.8.19
PlatformIO: 6.1.4
STM32 Core: 2.3.0
Get a $5 off coupon on your first purchase at Kaiweets
Kaiweets Affordable & Smart Electrical Testing Tools
Kenjutsu
Posts: 27
Joined: Tue Apr 07, 2020 10:58 am
Answers: 2

Re: Adafruit_ST7735 > 1.1.0 not working

Post by Kenjutsu »

Just another FYI:
  • SPI2 tested and working
  • Adafruit_ILI9341 library tested and working, both SPI1 and SPI2
Pieter

OSX: 11.6.8
Arduino IDE: 1.8.19
PlatformIO: 6.1.4
STM32 Core: 2.3.0
Get a $5 off coupon on your first purchase at Kaiweets
Kaiweets Affordable & Smart Electrical Testing Tools
nealix58
Posts: 1
Joined: Thu Apr 21, 2022 12:25 am

Re: Adafruit_ST7735 > 1.1.0 not working

Post 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
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Adafruit_ST7735 > 1.1.0 not working

Post 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.
Post Reply

Return to “STM32F4 based boards”