[SOLVED] mcufriend and STM32

As for now I have tested with succes mcufriend with 2.8 TFT LCD (8 bits Shield ILI9341) on UNO.

Then, with your help, I made it work fast on MEGA by wiring (special USE_MEGA_8BIT_PROTOSHIELD)

And now I would like to see the how fast is this screen on STM32F103C8T6 but I don't know what I must uncomment in "mcufriend_special.h"?

You don't need to do anything. It supports BLUEPILL with this wiring:

//LCD pins  |D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0 | |RD |WR |RS |CS |RST| |SD_SS|SD_DI|SD_DO|SD_SCK|
//STM32 pin |PA7|PA6|PA5|PA4|PA3|PA2|PA1|PA0| |PB0|PB6|PB7|PB8|PB9| |PA15 |PB5  |PB4  |PB3   | **ALT-SPI1**

Or you can use a SPECIAL called: USE_MY_BLUEPILL which has this wiring:

//LCD pins  |D7  |D6  |D5 |D4 |D3 |D2 |D1  |D0 | |RD |WR |RS |CS |RST| |SD_SS|SD_DI|SD_DO|SD_SCK| |SDA|SCL|
//STM32 pin |PA3 |PA2 |PA1|PA0|PB7|PB6|PA10|PA9| |PB1|PB0|PA7|PA6|PA5| |PB12 |PB15 |PB14 |PB13  | |PB9|PB8|

David.

It works like a charm! Thanks so much!

I have a last question: which pins do you use for YP, XM, YM, and XP ?

Which wiring did you choose?

What did the Uno Calibration tell you?

From the Calibration sketch on the GitHub Beta:

// MCUFRIEND UNO shield shares pins with the TFT.
#if defined(ESP32)
int XP = 27, YP = 4, XM = 15, YM = 14;  //most common configuration
#else
//int XP = 6, YP = A1, XM = A2, YM = 7;  //most common configuration
int XP = 7, YP = A2, XM = A1, YM = 6;  //next common configuration
//int XP=PB7,XM=PA6,YP=PA7,YM=PB6; //BLUEPILL must have Analog for YP, XM
#endif

Your Blue 2.8 inch will probably use A2, A3, 8, 9. Just measure the resistance with a DMM and report back.

David.

I used the following wiring:

//LCD pins |D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0 | |RD |WR |RS |CS |RST| |SD_SS|SD_DI|SD_DO|SD_SCK|
//STM32 pin |PA7|PA6|PA5|PA4|PA3|PA2|PA1|PA0| |PB0|PB6|PB7|PB8|PB9| |PA15 |PB5 |PB4 |PB3 | ALT-SPI1

I get the following error when I try to compile touch_shield_new.ino sample with mcufriend 2.9.8, with:
int XP=A2,XM=15,YP=A3,YM=14;

Touch_shield_new:126:13: error: ‘YP’ was not declared in this scope
** pinMode(YP, OUTPUT);**
** ^**
exit status 1
’A2’ was not declared in this scope

And with other values like:
int XP=PB7,XM=PA6,YP=PA7,YM=PB6;

D:\Programmation\Arduino\Sketch\libraries\Touch-Screen-Library-master/TouchScreen.h:52:3: error: ‘RwReg’ does not name a type
** RwReg xp_pin, xm_pin, yp_pin, ym_pin;**

What did the Uno Calibration tell you?

Your Blue 2.8 inch will probably use A2, A3, 8, 9. Just measure the resistance with a DMM and report back.

I don't want to search all your previous posts. It is your job to identify the Touch Pins.

You can always use the sketch from the Beta i.e. MCUFRIEND_kbv/examples/TouchScreen_Calibr_native at master · prenticedavid/MCUFRIEND_kbv · GitHub

David.

Ok, I will try to find the touch Pins with a multimeter because as I said you I can't use A1,A2... because there's always the same compilation error for STM32, even with TouchScreen_Calibr_native:

TouchScreen_Calibr_native:312:35: error: 'YM' was not declared in this scope
** XP, XM - A0, YP - A0, YM, TS_WID, TS_HT, tft.readID());**
** ^**
exit status 1
'A1' was not declared in this scope

Go on. The official STM32 core defines Analog pin numbers A0, A1, ...

The weird RogerClark core does not define Arduino pins.

Sketches with A0, A1, ... will compile on STM32 core but they probably don't make much sense on a BluePill.

David.

I just compiled by defining the constant :slight_smile:

static const uint8_t A0 = 14;
static const uint8_t A1 = 15;
static const uint8_t A2 = 16;
static const uint8_t A3 = 17;
static const uint8_t A4 = 18;
static const uint8_t A5 = 19;
static const uint8_t A6 = 20;
static const uint8_t A7 = 21;

For now, when I touch the "screen to continue", nothing happens.
I'm going to make more tests to find the pins now...