Page 1 of 1

Adafruit_ST7735 not working on pin PA1

Posted: Tue Jun 08, 2021 8:06 am
by bobemoe
I'm have a working project on a STM32F411, using the Adafruit ST7735 TFT display and their official TFT library. I've configured the TFT pins to be CS=PB10, RST=PB1 and DC=PB2, also the internal SCLK1 and MOSI1 pins PA5 and PA7. This is all working fine.

Now we need to rewire the display to different pins. We want to use CS=PA1, RST=PA2, DC=PA3. But when I do so the display stops working. Just white screen.

I've narrowed it down to the CS pin. RST and DC seem happy on the new pins PA2 and PA3 and if I put CS back to PB10 it works again. It just wont work with CS on PA1.

Looking on the oscilloscope the CS pin is constant low when its not working. On a working pin the CS pin seems to have some data on it.

I've made a test sketch and can control PA1 pin as an output, high, low, pwm all work fine.

I can't understand why the Adafruit_ST7735 library seems to be having issue outputting to PA1?

I found some threads suggesting special pins for JTAG need to be disabled but this didn't include PA1.

Possibly Serial TX/RX using PA0/PA1 but I disabled my serial and still no luck.

Seems strange also that if I connect the CS pin to +3.3v that the screen doesn't work. I thought CS was meant to select the SPI device when high? I wasn't expecting to see data on that pin.

So, does PA1 have some special usage that prevents some libraries using it?

Further tests show it not working on PA0 either. It works on PB4 but not PB1. What's going on?

Re: Adafruit_ST7735 not working on pin PA1

Posted: Tue Jun 08, 2021 8:42 am
by stevestrong
viewtopic.php?f=2&t=301
Which core?
Which board?
Maybe the board has already reserved these pins for other purpose.

Re: Adafruit_ST7735 not working on pin PA1

Posted: Tue Jun 08, 2021 9:47 am
by bobemoe
Sorry, its WeAct BlackPill v3.0, using stm32duino core https://github.com/stm32duino/BoardManagerFiles

I don't think the pin is reserved as I said I have confirmed its working as an output just fine with normal digitalWrite()/analogWrie() but I've not managed to confirm this for sure with any docs.

In fact if I analogWrite(128) to the pin the screen does flicker as if sometimes the signal matches what it is expecting. digitalWrite HIGH or LOW does set the expected output to the pin but no screen joy.

Thanks

Re: Adafruit_ST7735 not working on pin PA1

Posted: Tue Jun 08, 2021 10:03 am
by bobemoe
This is the closest docs I could find, its for F401 though, is that close enough?

http://194.19.86.155/nRF_Connect_SDK/do ... index.html

Looking at it it seems PA1 should be an available GPIO pin.

Re: Adafruit_ST7735 not working on pin PA1

Posted: Tue Jun 08, 2021 12:01 pm
by ag123
i didn't tried with 7735, but while working with ili9341 spi
https://github.com/ag88/Adafruit_ILI9341_SPI_stm32duino
what i did is to send spi commands to request status from the device (lcd). that is a first step to get the 'driver' working.
it need to respond to your spi commands and u'd need to get the response to be assured that there is no connectivity problems

Re: Adafruit_ST7735 not working on pin PA1

Posted: Tue Jun 08, 2021 4:30 pm
by AndrewBCN
bobemoe wrote: Tue Jun 08, 2021 8:06 am I'm have a working project on a STM32F411, using the Adafruit ST7735 TFT display and their official TFT library. I've configured the TFT pins to be CS=PB10, RST=PB1 and DC=PB2, also the internal SCLK1 and MOSI1 pins PA5 and PA7. This is all working fine.

Now we need to rewire the display to different pins. We want to use CS=PA1, RST=PA2, DC=PA3. But when I do so the display stops working. Just white screen.

I've narrowed it down to the CS pin. RST and DC seem happy on the new pins PA2 and PA3 and if I put CS back to PB10 it works again. It just wont work with CS on PA1.
...

So, does PA1 have some special usage that prevents some libraries using it?

Further tests show it not working on PA0 either. It works on PB4 but not PB1. What's going on?
I can confirm PA1 is not reserved. What SPIx interface are you using?
How do you assign the SCKx, MOSIx and MISOx pins?
What is the code you are using to assign pin PA1 to the SPI interface CS?

I use the following pins and code:

Code: Select all

// BMP280 - SPI
#include <SPI.h>
#include <Adafruit_BMP280.h>
#define BMP280_CS   (PA4)              // SPI1 uses PA4, PA5, PA6, PA7
Adafruit_BMP280 bmp(BMP280_CS);        // hardware SPI, use PA4 as Chip Select
...
void setup()
{
...
  // Initialize BMP280
  bmp.begin();
  ...
and in my case the BMP280 library works fine with the hardware SPI interface provided by the STM32F411CEU6.