STM32F746_Discovery: bug in touch screen library?

Working libraries, libraries being ported and related hardware
Post Reply
Posts: 4
Joined: Thu Jun 18, 2020 2:19 pm

STM32F746_Discovery: bug in touch screen library?

Post by jremington »

The TS library appears to perform unexpected, unauthorized writes to at least two distinct RAM memory locations, when the first call to .getPoint() is executed.

I'm using this branch of the 1.9.0 core: ... TEST_1.9.0

The offending code is the unmodified TS library example, TouchDisplayTemplate. Upon program startup, I consistently observe two white pixels appear, center left on the screen, immediately after the first call to ts.getpoint(). I suspect that the touch routine is writing directly to the screen RAM. Subsequent calls to .getPoint(), following screen erase, do not generate those white pixels.

I've looked through the library source code and can't see how this might be happening. As far as I can tell, the touchscreen driver has no access to display memory. Uninitialized pointer?

Code follows:

Code: Select all

   Touch example for STM32F476 Discvery

   using Adafruit compatible API

   June 2017, ChrisMicro

#include "LTDC_F746_Discovery.h" // TFT
#include "TouchScreen_F7_Discovery.h" // TOUCH

LTDC_F746_Discovery tft;
TouchScreen         ts;

void setup()
  // The buffer is memory mapped
  // You can directly draw on the display by writing to the buffer
  uint16_t *buffer = (uint16_t *)malloc(LTDC_F746_ROKOTECH.width * LTDC_F746_ROKOTECH.height);

  tft.begin((uint16_t *)buffer);
  tft.setCursor(0, 0);
  tft.setTextColor(LTDC_BLUE);  tft.setTextSize(3);
  tft.println("STM32F746 Discovery Touch");

#define CURSOR_SIZE 100

TSPoint OldPoint;

void loop()
    TSPoint p = ts.getPoint();
    if( OldPoint != p )
      tft.fillScreen( LTDC_BLACK );

      tft.setCursor(0, 0);

      tft.print(p.x); tft.print(" , "); tft.print(p.y);
      tft.print(" pressure: "); tft.println( p.z );

      if ( p.z )
        tft.fillRect(p.x - CURSOR_SIZE/2, p.y - CURSOR_SIZE/2, CURSOR_SIZE, CURSOR_SIZE, LTDC_GREEN);


User avatar
Posts: 777
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 30
Location: Le Mans

Re: STM32F746_Discovery: bug in touch screen library?

Post by fpiSTM »

this branch is only for test/example purpose and provided as it is using the LCD and TS libraries from @danieleff and @ChrisMicro.

Your best bet is to try to debug them.

Post Reply

Return to “Libraries & Hardware”