Showing results for 
Search instead for 
Did you mean: 

Qrcode is not interpretable

Senior II

Hi everybody,

I'm trying to implement into a custom board, the dynamic Qrcode generation algorithm.

I'm using touchgfx 4.23.0, an SPI display with partial buffer strategy.

I would like to draw the string "" . Display seem to draw it correctly but when I'm try to read it using my phone, this one is not readle. it seems not valid..

I'm using the following initialization sequence:




void Screen_QrCodeView::setupScreen()

QR *code;

sprintf( string, "");
code = new QR( string );




display screendisplay screenQrcode detailQrcode detail

I don't understand the reason. If I change the size of QrCode using qrCode.setScale the result is the same.

Is it possibile to change the resoltuion of the QrCode? Is the QrCode resolution too poor respect the modern APP algorithm?

Does someone ahs the same issue? Please, Can someone try to draw the string and share the picture for a comparison, ?

What can I check in the project?


Thanks to all



Accepted Solutions
ST Employee

Hello @MPast.1 


Please find attached a custom container of a QrCode generator that I have made.
Note that the QrCode uses the Nayuki library in C++ (quite big) with MIT license.


We are working on making a QrCode using the C version of the library in the near future.


From your last post, it seem like your board works fine with no tearing. Somehow the tearing only happens with the QrCode which is unfortunate but indicates that it could be an issue with the QrCode generation rather than tearing.
Does the tearing happens with scaling of 1?


To make the QrCode works even with the tearing you could try to increase the correction level (from what I know there is 4 levels of correction [this is different from the version number, the version number defines the number of dots]).


Finally, 2 QrCode displaying the same data could look different just because their version is not the same.
Here is mine running on TouchGFX simulator with quartile (3rd highest) level of correction (also works on board):



Gaetan Godart
Software engineer at ST (TouchGFX)

View solution in original post

Pavel A.
Evangelist III



Why your Qrcode is so different?

Can you share your sources files, you use in the project?



Andrew Neil
Evangelist III

@MPast.1 wrote:

Display seem to draw it correctly

What makes you say that?

It's drawn something - but, clearly, what it's drawn is not correct!

There's a lot of "tearing" in your image:


Can you correctly draw any other text as a QR code?


sprintf( string, "");
code = new QR( string );

You haven't shown the definition of string

What if you just do

code = new QR( "" );


@MPast.1 wrote:

Why your Qrcode is so different?

Indeed it's very different:


Apart from the "tearing", yours seems to be missing a lot of points

I know that is present a little tearing on Qrcode: i saw it and and I'm trying to understand if is QrCode sources files can be the cause.

At the moment I dont think its a big problem because Qrcode is technology has bits corrections so a little noise on the picture should not be a problem. (you imaging if a qrcode printed on a metalized label could be a little bit scratched. Your App always read it without "any" problem). The real problem is that Qrcode has a lot of missing dots.

I'm working without any optimization on code, but I don't think this is the problem

all the images and texts I'm using are drawn correctly

@MPast.1 wrote:

I dont think its a big problem because Qrcode is technology has bits corrections so a little noise on the picture should not be a problemtly

Exactly. So this shows that there's not just a small error in your QR code display - it is very wrong!

Probably it's a symptom of what's going wrong in creating the QR code - rather than the cause of not reading it?


  • Can you correctly draw any other text as a QR code?
    • other URLs ?
    • things that aren't URLs?

  • Have you checked the definition of string
  • Have you tried specifying the string as a literal directly in the constructor?


Andrew Neil
Evangelist III

This site gives what looks like the same result as @Pavel A. 



@MPast.1 sorry cannot provide source. Just used a QR utility on my phone and checked that generated picture is recognized.

main screenmain screen

As you can see an example of correct scren with buttons, text and images.

String as decalred like "char"

QRCodeWidget qrCode;
char string[50];


Can be depend by display orientation?