[libmaple] FSMC LCD 16bit

Limited support for STM32F4 Discovery, Nucleo and custom F4 boards
stevestrong
Posts: 1823
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: [libmaple] FSMC LCD 16bit

Post by stevestrong » Sat Sep 30, 2017 10:19 am

Because the BIN is not working for you, I assume the pin connections/definitions may be different.
How does it look like in your case?
Btw, 8357 was not tested, only 8341.
Check my graphicstest here: https://github.com/stevstrong/Adafruit_ ... cstest.ino
Gx TFT lib not work with your repo error: 'struct gpio_reg_map' has no member named 'BSRRL'..........in several lines
This is one of the differences between the repositories, in my repo BSRR is defined as 32 bit register.
Are you sure you are using FSMC, or rather bit banging? Because for FSMC this should not be relevant at all...
For using FSMC, you have to respect the FSMC pinning given here: https://github.com/stevstrong/Arduino_S ... fsmc.c#L47
according to schematic: http://wiki.stm32duino.com/images/a/a8/ ... AG-TFT.pdf

vegfokic
Posts: 8
Joined: Sun Sep 03, 2017 9:00 am

Re: [libmaple] FSMC LCD 16bit

Post by vegfokic » Sat Sep 30, 2017 6:24 pm

The pin connection is the same like yours. FSMC data pins are locked. Only some of the control pins are selectable but they are also the same.
I checked the stm32f407vet6 datasheet before made the connections and also checked same fsmc tft lib which pins are connected from the selectable pins. Yes same as in the linnk and also have these pdf datasheet about the pin connections of the board
Attachments
stm_hx8357.jpg
stm_hx8357.jpg (185.51 KiB) Viewed 333 times

stevestrong
Posts: 1823
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: [libmaple] FSMC LCD 16bit

Post by stevestrong » Sat Sep 30, 2017 7:52 pm

I think that by using the GxTFT lib you are using bit-banging, not FSMC.

The clear indication for this is that you get the error warning related to BSRRL (used here: https://github.com/ZinggJM/GxTFT/blob/m ... 16.cpp#L66).
If you would use FSMC, this error should not be there, writing the BSSR register in that case is not needed.

Other indication for this is that your benchmark is much slower than my benchmark with FSMC.

As I could only test my lib with a ILI9341 compatible display, it may happen that the part for ILI8357 does not work correctly.
But I think that the software configured for ILI9341 should also at least show something on ILI8357 LCD other than white screen.

Btw, which GxTFT sketch do you use? Please post it here or give a link to it.
I may try to build it myself for a test.

vegfokic
Posts: 8
Joined: Sun Sep 03, 2017 9:00 am

Re: [libmaple] FSMC LCD 16bit

Post by vegfokic » Sat Sep 30, 2017 8:24 pm

I see but its difficult for me :) So If my working sketch use bitbang instead of real FSMC how can I cahange to use FSMC?
Yes not too fast therefore I want to try other libs like yours which may faster.
ILI9341, ILI9481, HX8357 are similar thereefore the screen not white than shows something. The little differences cause inverted or rotated, mirrorred pics..or maybe color problem.

I have arduino mega and my TFT directly inserted in it. Using of bommer lib the speed almost the same what I wrote benchmark result
https://github.com/Bodmer/TFT_HX8357

Your screen will be faster because of yours is 320x240 and my is 480x320.

Zingg test I think the same like yours just the TFT configuration and board select are different.
https://github.com/ZinggJM/GxTFT/blob/m ... cstest.ino

stevestrong
Posts: 1823
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: [libmaple] FSMC LCD 16bit

Post by stevestrong » Sat Sep 30, 2017 8:57 pm

My LCD is also 320x480 (or 480x320, as you wish), check the benchmark text.

To use FSMC, I think you should include in line 40 of the GxTFT sketch this header:

Code: Select all

#include <GxIO/STM32GENERIC/GxIO_STM32F4_FSMC/GxIO_STM32F4_FSMC.h>
or this one:

Code: Select all

#include <GxIO/STM32DUINO/GxIO_STM32F4_FSMC/GxIO_STM32F4_FSMC.h>
If it does still not work with FSMC, please contact the owner of the GxTFT library for further support.

vegfokic
Posts: 8
Joined: Sun Sep 03, 2017 9:00 am

Re: [libmaple] FSMC LCD 16bit

Post by vegfokic » Sun Oct 01, 2017 6:23 am

Ahh I see. When I have bagan test tried to use those lines but there was no pics just white screen and the only one working line was the

Code: Select all

#include "../GxIO/GxIO_STM32F407V_P16/GxIO_STM32F407V_P16.h"
With this line I got pictures but not fully work there was problem with the inverting, rotating, mirroning or something. This little problem is solved using correct register data. I implemented from https://github.com/Bodmer/TFT_HX8357. Its wery cool using on mega
So if I see well now I have fully working TFT driver using in 16 bit mode connected to fsmc pins.
The connection and tft driver would be suitable for fsmc mode using one of the lines what you say.
I have tried both cases but with same result. After uploading appear a pics just for a moment after that white. But I got the serial data

roger repo & gx tft
generic fsmc

Code: Select all

Benchmark                Time (microseconds)
Screen fill              45835
Text                     12784
Lines                    118872
Horiz/Vert Lines         25071
Rectangles (outline)     10764
Rectangles (filled)      557572
Circles (filled)         116072
Circles (outline)        108114
Triangles (outline)      24392
Triangles (filled)       249248
Rounded rects (outline)  40343
Rounded rects (filled)   674606
roger repo & gx tft
dunio fsmc

Code: Select all

Benchmark                Time (microseconds)
Screen fill              45773
Text                     12916
Lines                    118869
Horiz/Vert Lines         25070
Rectangles (outline)     10764
Rectangles (filled)      557558
Circles (filled)         115981
Circles (outline)        108071
Triangles (outline)      24389
Triangles (filled)       249243
Rounded rects (outline)  40368
Rounded rects (filled)   674594
I think something common problem should be in both cases and also if I use your lib and repo.
Changing of DATAST and ADDSET did not help.

stevestrong
Posts: 1823
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: [libmaple] FSMC LCD 16bit

Post by stevestrong » Sun Oct 01, 2017 7:06 am

vegfokic wrote:
Sun Oct 01, 2017 6:23 am
So if I see well now I have fully working TFT driver using in 16 bit mode connected to fsmc pins.
Yes. Although these benchmarks seem to show 16 bit parallel control wherein each bit is written separately. Pretty inefficient.

However, this is not inline with your previously posted benchmark here: viewtopic.php?f=39&t=2298&p=35090#p35090, which is quite different from these, not sure if it was really showing picture, please check again.

So yes, it seems that you have generally an issue with FSMC, independent on the used repo.
I would still try larger ADDSET and DATAST values, let's say (7, 7) or even (10, 10) or larger, up to (15, 255), see RM0090, pages 1554/1555.
ADDSET gives the clocks between CS falling edge and WR falling edge, DATAST gives the clocks for WR active low period.
These have to be set according to your TFT controller spec.
Usually, ADDSET is much smaller than DATAST.
For my TFT (2, 6) gave the best performance.

BTW, during editing, you can use the tag "</>" to mark parts of the text as code.

vegfokic
Posts: 8
Joined: Sun Sep 03, 2017 9:00 am

Re: [libmaple] FSMC LCD 16bit

Post by vegfokic » Sun Oct 01, 2017 8:07 am

Yes the first result is different from these two. The first is 16bit mode with screen. The latest two in FSMC mode with white screen
I try to check the tft datasheet and playing very big datast and addset values.

User avatar
StrangerM
Posts: 6
Joined: Fri Sep 29, 2017 12:24 pm
Location: St.-Petersburg, Russia

Re: [libmaple] FSMC LCD 16bit

Post by StrangerM » Mon Oct 02, 2017 12:47 pm

Hello all. Thank you, Steve. Thank you, Roger. Cheap and fairly fast tft screen with cheap and rather powerful MC in Arduino IDE is the best idea for amature devices. It can be used for example in a fishfinder etc.
I used: tft https://www.aliexpress.com/item/3-2-inc ... 0.0.bSxwyj & Black F407VET with Arduino IDE 1.8.4. https://yadi.sk/i/jLNOYVcy3NNRSg

Code: Select all

TFT LCD test
TFT size is 320x480
TFT begin done.
rotation: 0, runtime: 5750
rotation: 1, runtime: 5750
rotation: 2, runtime: 5750
rotation: 3, runtime: 5750

Benchmark                Time (microseconds)
Screen fill              48058
Text                     5750
Lines                    88029
Horiz/Vert Lines         4234
Rectangles (outline)     2673
Rectangles (filled)      117146
Circles (filled)         40319
Circles (outline)        37180
Triangles (outline)      16897
Triangles (filled)       50329
Rounded rects (outline)  12594
Rounded rects (filled)   134523
Done!

exider
Posts: 9
Joined: Wed Oct 04, 2017 12:58 pm

Re: [libmaple] FSMC LCD 16bit

Post by exider » Sat Oct 14, 2017 4:17 am

Hi all,

I'am using the exact setup as StrangerM does( STM32F407VE + matching 3.2 ACELEX TFT using 16 bit fsmc) but getting multiple errors when compiling with arduino 1.8.3 and 1.8.5.

I have changed #define USE_FSMC 1 .

First I was getting "fatal error: wiring_private.h: No such file or directory"

Code: Select all

/home/ivan/Arduino/libraries/Adafruit-GFX-Library/Adafruit_SPITFT.cpp:21:31: fatal error: wiring_private.h: No such file or directory
    #include "wiring_private.h"
                               ^
compilation terminated.
Multiple libraries were found for "Adafruit_TFTLCD_16bit_STM32.h"
 Used: /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32
 Not used: /home/ivan/Arduino/libraries/111Adafruit_TFTLCD_16bit_STM32
Multiple libraries were found for "Adafruit_GFX.h"
 Used: /home/ivan/Arduino/libraries/Adafruit-GFX-Library
 Not used: /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit-GFX-Library
 Not used: /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit-GFX-Library
 Not used: /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit-GFX-Library
 Not used: /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit-GFX-Library
Using library Adafruit_TFTLCD_16bit_STM32 at version 1.0.0 in folder: /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32 
Using library Adafruit-GFX-Library at version 1.2.2 in folder: /home/ivan/Arduino/libraries/Adafruit-GFX-Library 
Using library SPI at version 1.0 in folder: /home/ivan/Arduino/hardware/Arduino_STM32/STM32F4/libraries/SPI 
exit status 1
Error compiling for board Generic STM32F407V series.
After copying wiring_private.h I am getting the fallowing error:

Code: Select all

/home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.cpp: In member function 'void Adafruit_TFTLCD_16bit_STM32::reset()':
/home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.cpp:76:16: error: 'TFT_CNTRL_PORT' was not declared in this scope
  ctrl_port = &(TFT_CNTRL_PORT->regs->BSRR);
                ^
/home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.cpp:77:16: error: 'TFT_DATA_PORT' was not declared in this scope
  data_port = &(TFT_DATA_PORT->regs->ODR);
                ^
In file included from /home/ivan/Arduino/hardware/Arduino_STM32/STM32F4/cores/maple/libmaple/libmaple.h:35:0,
                 from /home/ivan/Arduino/hardware/Arduino_STM32/STM32F4/cores/maple/libmaple/gpio_def.h:37,
                 from /home/ivan/Arduino/hardware/Arduino_STM32/STM32F4/cores/maple/wirish_types.h:36,
                 from /home/ivan/Arduino/hardware/Arduino_STM32/STM32F4/cores/maple/boards.h:42,
                 from /home/ivan/Arduino/hardware/Arduino_STM32/STM32F4/cores/maple/wirish.h:40,
Multiple libraries were found for "Adafruit_TFTLCD_16bit_STM32.h"
 Used: /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32
 Not used: /home/ivan/Arduino/libraries/111Adafruit_TFTLCD_16bit_STM32
Multiple libraries were found for "Adafruit_GFX.h"
 Used: /home/ivan/Arduino/libraries/Adafruit-GFX-Library
 Not used: /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit-GFX-Library
 Not used: /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit-GFX-Library
 Not used: /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit-GFX-Library
 Not used: /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit-GFX-Library
                 from /home/ivan/Arduino/hardware/Arduino_STM32/STM32F4/system/libmaple/Arduino.h:31,
                 from /home/ivan/Arduino/libraries/Adafruit-GFX-Library/Adafruit_GFX.h:5,
                 from /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.h:13,
                 from /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_common.h:5,
                 from /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.cpp:7:
/home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.cpp:78:35: error: 'TFT_WR_PIN' was not declared in this scope
  wr_bitmask = digitalPinToBitMask(TFT_WR_PIN);
                                   ^
/home/ivan/Arduino/hardware/Arduino_STM32/STM32F4/cores/maple/libmaple/util.h:47:49: note: in definition of macro 'BIT'
 #define BIT(shift)                     (1UL << (shift))
                                                 ^
/home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.cpp:78:15: note: in expansion of macro 'digitalPinToBitMask'
  wr_bitmask = digitalPinToBitMask(TFT_WR_PIN);
               ^
/home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.cpp:79:35: error: 'TFT_RS_PIN' was not declared in this scope
  rs_bitmask = digitalPinToBitMask(TFT_RS_PIN);
                                   ^
/home/ivan/Arduino/hardware/Arduino_STM32/STM32F4/cores/maple/libmaple/util.h:47:49: note: in definition of macro 'BIT'
 #define BIT(shift)                     (1UL << (shift))
                                                 ^
/home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.cpp:79:15: note: in expansion of macro 'digitalPinToBitMask'
  rs_bitmask = digitalPinToBitMask(TFT_RS_PIN);
               ^
/home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.cpp:80:35: error: 'TFT_CS_PIN' was not declared in this scope
  cs_bitmask = digitalPinToBitMask(TFT_CS_PIN);
                                   ^
/home/ivan/Arduino/hardware/Arduino_STM32/STM32F4/cores/maple/libmaple/util.h:47:49: note: in definition of macro 'BIT'
 #define BIT(shift)                     (1UL << (shift))
                                                 ^
/home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.cpp:80:15: note: in expansion of macro 'digitalPinToBitMask'
  cs_bitmask = digitalPinToBitMask(TFT_CS_PIN);
               ^
/home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.cpp:92:2: error: 'WR_IDLE' was not declared in this scope
  WR_IDLE;
  ^
/home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.cpp:105:14: error: 'setWriteDir' was not declared in this scope
  setWriteDir();
              ^
/home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.cpp: In member function 'void Adafruit_TFTLCD_16bit_STM32::flood(uint16_t, uint32_t)':
/home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32/src/Adafruit_TFTLCD_16bit_STM32.cpp:157:19: error: 'writeData_' was not declared in this scope
   writeData_(color);
                   ^
Using library Adafruit_TFTLCD_16bit_STM32 at version 1.0.0 in folder: /home/ivan/Downloads/Programming/Arduino/arduino-1.8.5/libraries/Adafruit_TFTLCD_16bit_STM32 
Using library Adafruit-GFX-Library at version 1.2.2 in folder: /home/ivan/Arduino/libraries/Adafruit-GFX-Library 
Using library SPI at version 1.0 in folder: /home/ivan/Arduino/hardware/Arduino_STM32/STM32F4/libraries/SPI 
exit status 1
Error compiling for board Generic STM32F407V series.
Any Ideas?
Thanks

Post Reply