[Solved]blue pill and ILI9341 tft

Post here all questions related to STM32 core if you can't find a relevant section!
svod616
Posts: 9
Joined: Mon Mar 16, 2020 5:10 pm
Location: Ukraine

[Solved]blue pill and ILI9341 tft

Post by svod616 »

Hi, I immediately apologize if I created the topic in the wrong section and ask me to send it in the right direction. In the STM32 topic recently, before that, I used the arduino mini for a long time, but in the current project I’m sorely lacking in speed for normal operation with a display based on the ILI9341 chip.
The problem is that I just can’t connect this display to my blue pill. The first time I used this core: https://github.com/rogerclarkmelbourne/Arduino_STM32, but on the built-in library I could not even compile example, now I installed the officially core from STM, substituted the libraries from the first kernel: Adafruit_ILI9341_STM, Adafruit_GFX_AS , SPI, as well as the official Adafruit_GFX library (without it, the sample code did not compile). Now when I try to initialize the display with the command
Adafruit_ILI9341_STM tft = Adafruit_ILI9341_STM (PA4, PB1, PA7, PA5, PB10, PA6);
when compiling, I get the message: no matching function for call to 'Adafruit_ILI9341_STM :: Adafruit_ILI9341_STM (int, int, int, int, int, int) int' 'as I understood the pin numbers that I declared do not match the data type, but in all the manuals that I saw written appeal to the pin only by full name! Tell me where can I find a solution to this problem?well, or tell me where you can find the manual for using this display with stm32duino.
version of arduino IDE 1.8.9 flashing through Chinese Stlink 2.
and apologize for my bad english i use google translator
by ag123 » Tue Mar 17, 2020 11:37 am Go to full post
svod616
Posts: 9
Joined: Mon Mar 16, 2020 5:10 pm
Location: Ukraine

Re: blue pill and ILI9341 tft

Post by svod616 »

svod616 wrote: Mon Mar 16, 2020 5:31 pm not match the data type, but in all the manuals that I saw written appeal to the pin only by full name!
upd: in file variant.cpp (way^ appdata\local\arduino15\packages\stm32\hardware\stm32\1.8.0\variants/pill_f103xx) i find next:
PB_9, //D0
PB_8, //D1
PB_7, //D2
PB_6, //D3
PB_5, //D4
PB_4, //D5
PB_3, //D6
PA_15, //D7
PA_12, //D8 - USB DP
PA_11, //D9 - USB DM
PA_10, //D10
PA_9, //D11
PA_8, //D12
PB_15, //D13
PB_14, //D14
PB_13, //D15
PB_12, //D16 - LED Blackpill
/* Right side */
PC_13, //D17 - LED Bluepill
PC_14, //D18
PC_15, //D19
PA_0, //D20/A0
PA_1, //D21/A1
PA_2, //D22/A2
PA_3, //D23/A3
PA_4, //D24/A4
PA_5, //D25/A5
PA_6, //D26/A6
PA_7, //D27/A7
PB_0, //D28/A8
PB_1, //D29/A9
PB_10, //D30
PB_11, //D31
PB_2, //D32 - BOOT1
PA_13, //D33 - SWDI0
PA_14, //D34 - SWCLK

for test this numeration of pin I modified the blink example as follows:

Code: Select all

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(17, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(17, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(100);                       // wait for a second
  digitalWrite(17, LOW);    // turn the LED off by making the voltage LOW
  delay(100);                       // wait for a second
}
and the built-in LED on the board began to flash at a given frequency, I also checked PA_2, writing its number from the found table (22) and it worked again, however, substituting the port numbers in the display initialization, I again got the error no matching function for call to ' Adafruit_ILI9341_STM :: Adafruit_ILI9341_STM (int, int, int, int, int, int) 'what could be the problem? because above the line with the initialization code is a comment:

Code: Select all

// If using the breakout, change pins as desired(PA4,PB1,PA7,PA5,PB10,PA6)
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

from which it follows that all 6 conclusions can be indicated. but in the library file I found only such a function that has 3 arguments:

Code: Select all

Adafruit_ILI9341_STM(int8_t _CS, int8_t _DC, int8_t _RST = -1);
i'm desperate help me somebody.
stas2z
Posts: 131
Joined: Mon Feb 24, 2020 8:17 pm
Answers: 8

Re: blue pill and ILI9341 tft

Post by stas2z »

according to https://github.com/rogerclarkmelbourne/ ... 9341_STM.h this library have only one constructor
Adafruit_ILI9341_STM(int8_t _CS, int8_t _DC, int8_t _RST = -1);
so your compile error is ok
it assume to use predefined hardware spi class, not bitbanging
but im not sure that lib will compile or work with this core anyway
svod616
Posts: 9
Joined: Mon Mar 16, 2020 5:10 pm
Location: Ukraine

Re: blue pill and ILI9341 tft

Post by svod616 »

it assume to use predefined hardware spi class
could you tell me which pins should be used for this?
stas2z
Posts: 131
Joined: Mon Feb 24, 2020 8:17 pm
Answers: 8

Re: blue pill and ILI9341 tft

Post by stas2z »

for F103 chip default spi pins are MOSI=PA7, MISO=PA6, SCK=PA5, SS=PA4
svod616
Posts: 9
Joined: Mon Mar 16, 2020 5:10 pm
Location: Ukraine

Re: blue pill and ILI9341 tft

Post by svod616 »

SPI port 1, ok, I'll try it, thanks
svod616
Posts: 9
Joined: Mon Mar 16, 2020 5:10 pm
Location: Ukraine

Re: blue pill and ILI9341 tft

Post by svod616 »

and what do we have? The SPI library requires the libmaple_types.h file from the Roger core version, which for some reason I can’t find in its core. The official core SPI library gives a compilation error:

Code: Select all

C:\Users\����\Documents\Arduino\libraries\Adafruit_ILI9341_STM/Adafruit_ILI9341_STM.h:150:48: error: 'class SPIClass' has no member named 'write16'
 150 |   inline void    spiwrite16(uint16_t c) { mSPI.write16(c); } // 8 bit mode"
 
well, we’ll continue to figure out what the problem may be, if I still manage to launch this display with my blue pill, I’ll definitely post a step-by-step instruction here with all the libraries that will have to be fixed and the complete connection diagram. it’s unfair that it took me 15 minutes to start this display on uno / nano / mega8, and now it's the morning of the fourth day as I try to do the same with STM.
or maybe there’s still instructions for launching displays on ILI9341 and the blue pill in stm32duino and I was just not looking well enough?
User avatar
fpiSTM
Posts: 1745
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: blue pill and ILI9341 tft

Post by fpiSTM »

If you use the STM32 core, then do not use Maple built-in library.
Use the standard Adafruit library not the custom one.
svod616
Posts: 9
Joined: Mon Mar 16, 2020 5:10 pm
Location: Ukraine

Re: blue pill and ILI9341 tft

Post by svod616 »

please show me where can I get a library for working with my display using the SPI protocol?
This library http://www.rinkydinkelectronics.com/library.php?id=51 also does not work with the official STM core?
ag123
Posts: 1657
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: blue pill and ILI9341 tft

Post by ag123 »

Post Reply

Return to “General discussion”