cancel
Showing results for 
Search instead for 
Did you mean: 

QR code generation from URL.

SC9
Associate II

Hello,

I am using touchGFX4.16 designer, in windows 10.I want to display dynamic QR code generated from URL. I've tried to look for solutions like

1) Generating QR code from external library & then displaying it on display.

2)QR code widget is there in touchgfx4.24.Is it possible to migrate touchGFX4.16 project to touchGFX4.24. to achieve the above.

Can any one please help?

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @SC9,

Yes, you should be able to update your project from TouchGFX 4.16.0 to 4.24.0. Please create a backup of your project before updating it to the latest version of TouchGFX.

If you don't want to migrate to TouchGFX 4.24.0, there is a custom container available for QR Code that you can access from here. To be honest, I haven't tested it with TouchGFX 4.16.0, but, there shouldn't be anything special about it that causes trouble.

In order to update your project to TouchGFX 4.24.0, first you need to open your TouchGFX project with 4.24.0, then generate code. Finally, you need to open your STM32CubeMX (.ioc) project and generate code from there as well (probably, you will be prompted to install X-CUBE-TOUCHGFX 4.24.0). And now, you should have your project ready. 

I hope this helps you. Don't hesitate to ask more questions!

 

Mohammad MORADI
ST Software Developer | TouchGFX

View solution in original post

8 REPLIES 8

Hello @SC9,

Yes, you should be able to update your project from TouchGFX 4.16.0 to 4.24.0. Please create a backup of your project before updating it to the latest version of TouchGFX.

If you don't want to migrate to TouchGFX 4.24.0, there is a custom container available for QR Code that you can access from here. To be honest, I haven't tested it with TouchGFX 4.16.0, but, there shouldn't be anything special about it that causes trouble.

In order to update your project to TouchGFX 4.24.0, first you need to open your TouchGFX project with 4.24.0, then generate code. Finally, you need to open your STM32CubeMX (.ioc) project and generate code from there as well (probably, you will be prompted to install X-CUBE-TOUCHGFX 4.24.0). And now, you should have your project ready. 

I hope this helps you. Don't hesitate to ask more questions!

 

Mohammad MORADI
ST Software Developer | TouchGFX
SC9
Associate II

Thank you for your reply. It is working fine with TouchGFX 4.16.

 

Great to hear!
Good luck!

Mohammad MORADI
ST Software Developer | TouchGFX
SC9
Associate II

Hello @Mohammad MORADI ESFAHANIASL 

My program runs on simulator but does not show any QR code on screen. I tried to debug the code. it hangs in exit().

SC9_1-1723616086178.png

 

 

 

Hello @SC9,

I tried your example and it worked fine on the simulator.

Simulator showing the QR CodeSimulator showing the QR Code

However, when you try to run the code on the target, for some reason the new command causes trouble. If you try to rewrite the code in a manner that avoids new, you should be able to run it on your board.

//Change in QRCodeWidget.hpp
uint8_t qrCodeData [qrcodegen_BUFFER_LEN_MAX];

//Change in QRCodeWidget.cpp
QRCodeWidget::QRCodeWidget(): qrCodeVersion(1),
                              sizeOfQRCodeSymbol(25),
                              scale(1),
                              errorCorectionLvl(qrcodegen_Ecc_LOW)
{}
//Remove
    delete qrCodeData;  //SN_CHANGE
   qrCodeData = new uint8_t[qrcodegen_BUFFER_LEN_FOR_VERSION(qrCodeVersion)];


//Change in Screen1View.hpp
QRCodeWidget QRCode;

//Change in Screen1View.cpp
void Screen1View::setupScreen()
{
    Screen1ViewBase::setupScreen();

    QRCode.setScale(2);
    QRCode.setQRCodeVersion(15);
    QRCode.setErrorCorrectionLevel(qrcodegen_Ecc::qrcodegen_Ecc_LOW);
    QRCode.convertStringToQRCode("https://project-chip.github.io/connectedhomeip/qrcode.html?data=MT:QTS00A1U149AC.5TJ00");
    resizeTheContainer();
    QRCode.setXY(38, 38);
    add(QRCode);
}

void Screen1View::resizeTheContainer()
{
    uint16_t newHeight = QRCode.getHeight()+10;
    uint16_t newWidth = QRCode.getWidth()+10;
    background.setWidthHeight(newWidth,newHeight);
    background.setXY(33, 33);
}

 

Project running on STM32F429I-DiscoProject running on STM32F429I-Disco

 

Mohammad MORADI
ST Software Developer | TouchGFX
SC9
Associate II

Above changes did not work for me. I did some changes by studying QRcode-widget in TouchGFX Designer4.24. I am changing URL string using uart. But it still hangs in exit()./ gets stuck in HardFault or MemManage Handler.

To be honest, I am not sure why those changes did not fix your project. Is it possible to migrate to the latest versions of the tools that you are using (TouchGFX, STM32CubeMX, and STM32CubeIDE)? 

Mohammad MORADI
ST Software Developer | TouchGFX

 

1)For the changes you suggested- Qr code is displayed on board but to generate QR Code dynamically             

  • I am sending String via UART. For that I am getting below error

undefined reference to `HAL_UART_Init

undefined reference to `HAL_UART_IRQHandler'

  • I also tried using GPIO interrupt. It is also not working

 

2)And for the project I created by studying Touchgf4.24 QRCode widget - It hangs in exit() after one QR.

  • It is not possible to migrate to any other version of touchgfx than 4.16.