Spark Logic

[SOLVED] Adafruit_ILI9341_STM – hardware scrolling broken

ILI9341 MSP3223 · 14-contact header Pinout

Hello,
I don’t know much about the changes in this library for ~ 2 years, but sadly hardware scrolling is totally broken:

It was easy to set it up with:

//new scroll commands
#define ILI9341_VSCRDEF 0x33
#define ILI9341_VSCRSADD 0x37
void scrollAddress(uint16_t VSP) {
tft.writecommand(ILI9341_VSCRSADD); // Vertical scrolling start address
tft.writedata(VSP >> 8);
tft.writedata(VSP);
}
void setupScrollArea(uint16_t TFA, uint16_t BFA) {
tft.writecommand(ILI9341_VSCRDEF); // Vertical scroll definition
tft.writedata(TFA >> 8);
tft.writedata(TFA);
tft.writedata((320 - TFA - BFA) >> 8);
tft.writedata(320 - TFA - BFA);
tft.writedata(BFA >> 8);
tft.writedata(BFA);
}

Replies17

Fri Mar 23, 2018 9:24 pm

hi Matthias

FYI

There are some open PRs and discussions about bringing the graphics library up to date, which may partially fix this.

And there is also a discussion on GitHub about the problems with the graphics library functions leaving the SPI bus in 16 bit mode, which may also be the cause of this problem.

I think everyone is happy with the solution to update the graphics library and keep backwards compatibility, but there is not a consensus on leaving SPI in 8 bit mode, as this slows down the graphics library if it has to switch to 16 bit and then back to 8 bit for a lot of the functions

Also people are not convinced that 8 bit should be the default mode for SPI, but I have compatibility problems with libraries which assume AVRAVRMicrocontrollers and processors…Arduino\libraries\U8glib\U8glib.cpp, C:\Program Files (x86)\Arduino\hardware\arduino\ avr \cores\arduino\HardwareSerial.h, C:\Program Files (x86)\Arduino/Blink3.ino, D:\Users\me\A…View in hardware catalog style SPI which AFIK does not have a 16 bit mode

Fri Mar 23, 2018 9:35 pm

Hi Roger!

Ok, it was also my fault, because I didn’t implement the HW-scrolling functions in the library in the past. So I still think these functions got lost (and/or forgotten).
—> Solution next post, thanks for the right hint, Roger!

Fri Mar 23, 2018 9:45 pm

Ok, this was just easy, solved!

New code:

void scrollAddress(uint16_t VSP) {
tft.writecommand(ILI9341_VSCRSADD); // Vertical scrolling start address
tft.spiwrite(VSP);
}

void setupScrollArea(uint16_t TFA, uint16_t BFA) {
tft.writecommand(ILI9341_VSCRDEF); // Vertical scroll definition
tft.spiwrite(TFA);
tft.spiwrite(320 - TFA - BFA);
tft.spiwrite(BFA);
}

Fri Mar 23, 2018 10:29 pm

Well, you see @madias, 16 bit mode has its advantages ;), everything is much more simple to code…

Fri Mar 23, 2018 10:48 pm

[stevestrong – Fri Mar 23, 2018 10:29 pm] –
Well, you see @madias, 16 bit mode has its advantages ;), everything is much more simple to code…

I see it, steve :)
Just gossip: Now I can remember, why I (and everyone) didn’t work with HW scrolling:
First: The function is quiet useless, because moving the area is “relative”, so you won’t be able to scroll 1px left and put the new output to x=319, because the most right position is now “0” – so it’s not “fire and forget”.
Second: HW Scrolling is very ugly, because of the display refresh latency.

Gossip #2:
I now have found the perfect code/library for the XPT2046XPT2046Displays, touch panels and LEDs… pm Go on. I would guess you have a Red SPI ILI9341 3.3V display. With or without an XPT2046 touch controller. These boards must have the RST pin pulled high or under program cont…View in hardware catalog touch-display-driver:
https://github.com/PaulStoffregen/XPT2046_Touchscreen
It works with IRQ and pressure measuring so you can easily set an offset and no more interpolations (getting at least 10-20 samples without too much errors) are needed.
https://github.com/PaulStoffregen/XPT2046_Touchscreen
Works out of the box.

Fri Mar 23, 2018 10:54 pm

[madias – Fri Mar 23, 2018 10:48 pm] –
I now have found the perfect code/library for the XPT2046XPT2046Displays, touch panels and LEDs… pm Go on. I would guess you have a Red SPI ILI9341 3.3V display. With or without an XPT2046 touch controller. These boards must have the RST pin pulled high or under program cont…View in hardware catalog touch-display-driver:
https://github.com/PaulStoffregen/XPT2046_Touchscreen
It works with IRQ and pressure measuring so you can easily set an offset and no more interpolations (getting at least 10-20 samples without too much errors) are needed.
Works out of the box.

Thanks for letting us know.
I’ll try it when I have some spare time.

Fri Mar 23, 2018 11:03 pm

with this library start with this code:
 if (ts.tirqTouched()) {
if (ts.touched()) {
TS_Point p = ts.getPoint();
xaxis =   map(p.x, 251, 3731, 0, 320);
yaxis =    map(p.y, 257, 3803, 0, 240);
if (p.z > 1200) < do something > (...) 

Fri Mar 23, 2018 11:05 pm

I had no problem accessing the SD card in the on-board slot of LCD.
Can you post a picture of your LCD board? Maybe is different from my one.

Fri Mar 23, 2018 11:18 pm

The SD-Card resistor R1-R3 are 102, so 1k.

Sat Mar 24, 2018 8:53 am

I just checked my board, it seems that i have replaced those resistors with wires and it works 8-).

Sat Mar 24, 2018 11:14 pm

You hit the point, Steve!
I bridged all SD card resistors and the onboard 3.3V regulator and it worked!
The circuit is really weird, not really 5V (because of 3.3V only TFT data inputs) and too much circuit for 3.3V. Only the “designer” know the secret about that….
Now I’m testing all devices (TFT, SD-Card, XPT2046XPT2046Displays, touch panels and LEDs… pm Go on. I would guess you have a Red SPI ILI9341 3.3V display. With or without an XPT2046 touch controller. These boards must have the RST pin pulled high or under program cont…View in hardware catalog ) on one SPI port. It’s really nasty adding all those extra lines you posted in another thread:
[stevestrong – Fri Mar 23, 2018 10:50 pm] –
There is a PR on GitHub about the problems with the graphics library functions leaving the SPI bus in 16 bit mode, which is most probably the cause of this problem.
You can try to execute
SPI.beginTransaction(SPISettings(18000000, MSBFIRST, SPI_MODE0, DATA_SIZE_8BIT));

Sun Mar 25, 2018 9:11 am

[madias – Sat Mar 24, 2018 11:14 pm] –
It’s really nasty adding all those extra lines you posted in another thread…

Well, if you group the LCD related routines in one function, you call one beginTransaction() at the beginning and the other at the end of that function. Is that really sooo nasty? :?

Sun Mar 25, 2018 9:00 pm

Guys

I did the same thing with the SD card interface, unsoldered the resistors and replaced by small pieces of wire.

Also supplied 3.3V to the output of the regulator ( I think ) . Or I may have ended up feeding the board with 5v as I used a Blue PillBlue PillDevelopment and computing boards…as become my new favorite board. I am calling it “blue pad” and it is kind of super “ blue pill ”. Pito Thu Jul 27, 2017 8:53 pm [victor_pv – Thu Jul 27, 2017 3:58 pm] – Just for…View in hardware catalog , and reconfigured it to use the regulator on the display board.

I would need to check the hardware I made for the OV7670OV7670Sensors, encoders and cameras…ip seems to work OK for me, but I’m not using any callbacks. I used the code with my OV7670 camera testbed and it was fine. But it doesnt include the dmaSendAsync I can manually m…View in hardware catalog camera module, as I used the SD to save images from the OV7670OV7670Sensors, encoders and cameras…ip seems to work OK for me, but I’m not using any callbacks. I used the code with my OV7670 camera testbed and it was fine. But it doesnt include the dmaSendAsync I can manually m…View in hardware catalog

Sun Mar 25, 2018 10:18 pm

Here is the circuit draw of the MCU-Friend ILI9341ILI9341Displays, touch panels and LEDs… shows on my screen. I have used and programmed a few different types of SPI screens( ili9341 , st7735) using Python very successfully and these parallel screens have many of the…View in hardware catalog :
https://drive.google.com/file/d/1AsquTx … sp=sharing

It’s also totally unclear if we need a small resistor for the LED-backlight. For my logic I would say we need one because it’s not in the schematic, but even with low resistance (~40) the display is too dark.

Mon Mar 26, 2018 2:42 pm

I suspect these boards were constructed (designed is too nice of a term) during the old days of Arduino when 5.0 Volts was the defacto standard. The old AVRAVRMicrocontrollers and processors…Arduino\libraries\U8glib\U8glib.cpp, C:\Program Files (x86)\Arduino\hardware\arduino\ avr \cores\arduino\HardwareSerial.h, C:\Program Files (x86)\Arduino/Blink3.ino, D:\Users\me\A…View in hardware catalog chips could sink and source significantly more current so the series resistors and stray capacitance did not significantly screw with the waveforms. That is not true of uC’s that are 3.3V by design.

When I salvage old logic boards and scrap them, I use my hot-air station to recover 0 Ohm SMT resistors. While little nips of wire work, the short-resistors look far better… if that matters! :lol:

Ray

Mon Mar 26, 2018 4:00 pm

The SPI ILI9341ILI9341Displays, touch panels and LEDs… shows on my screen. I have used and programmed a few different types of SPI screens( ili9341 , st7735) using Python very successfully and these parallel screens have many of the…View in hardware catalog LCD that I have doesn’t work with Arduino at 5V (they are all white) but works with STM32STM32Microcontrollers and processors…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…View in hardware catalog at 3.3V despite that they were announced as Arduino compatible. I never tested the SD card adapter but I believe that I have the resistor too.

Post a reply

Optional · up to 10 MiB