PSoC 6 (CY8CKIT-062-BLE): cannot display QRCode on the screen

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
FaSa_4703936
Level 1
Level 1

I am using the CE223727 (EmWin_EInk_Display) example project. The objective is display some info on the screen and a QRCode.

I am using the following 2 functions: GUI_QR_Create and GUI_QR_Draw from the library emWin. When i 'Build' the project I have no problem at all, but when I 'Debug' it stops into the function GUI_QR_Create and it goes to an error handler.

Here's a snippet of the code I use:

   /*QRCode*/

    GUI_HMEM qrCode = GUI_QR_Create("Display Something", 33*33, GUI_QR_ECLEVEL_H,0); //UTF-8 text to be used for the QR-code

   

    GUI_QR_Draw( qrCode, 15*8, 95);  //Handle of the QR-code to be drawn.

    /* Send the display buffer data to display*/

    UpdateDisplay(CY_EINK_FULL_4STAGE, true);

And as soon as I do Step into after the first line it falls into __WEAK void Cy_SysLib_ProcessingFault.

Do you know what causes this behavior and how can I solve this issue?

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

FaSa,

I have modified your modified version of the CE223727 example program if you're interested to check it out.

It's somewhat simplified and commented a little better.

Len

PS:  I'm planning on creating a KBA for everyone (if Cypress will allow me) on how to use the EmWin QR creation function calls.  It will include what we found out as well as help info about the effects of the different QR code creation settings.  I'll provide an example project with different screens using the QR codes under different QR settings.

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

17 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

fasa,

Can you upload your project to the forum?

I'd like to try to reproduce your results.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Hi LePo,

thanks fro your answer and sorry for my late reply. I have attached the example project.

The project displays the following screens in a loop

* 1. A screen showing various text alignments, styles and modes

* 2. A screen showing normal fonts

* 3. A screen showing bold fonts

* 4. A screen showing 2D graphics with horizontal lines, vertical lines

* arcs and filled rounded rectangle

* 5. A screen showing 2D graphics with concentric circles and ellipses

* 6. A screen showing a text box with wrapped text

I have just gone into the main_cm4.c file, I kept only the first 2 screens (over 6) and I have changed them in order to display some info (of a random product in a supermarket) and a QRCode in the right corner at the the bottom.

Athough in the library GUI.h, there are instructions to create and draw a QRCode, I didn't manage to display the QRCode on the screen.

Thanks in advance for your help.

0 Likes

FaSa,

Just to let you know the attached file you uploaded has no files.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Hi LePo,

I am very sorry for my mistake. It should be correctnow. Thanks

0 Likes

FaSa,

Got it.  I'll look into as soon as I can.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Very grateful for the interest. Thanks.

0 Likes

FaSa,

I got the same results you receive.  When it tries to execute the GUI_QR_Create(), it hangs with a syslib Fault Handler.

I even added more STACK and HEAP RAM.   No improvement.

There is no example project using the QRCode generation.

The closest example I found was QR Code (Sample) - SEGGER Wiki

I've tried different changes to the input vars of GUI_QR_Create().  No improvements.

I think either there's a bug in the code or something needs a different configuration value.

Len

Len
"Engineering is an Art. The Art of Compromise."

Yes I agree with you, I was even asking myself that maybe the screen cannot display QRcodes.

I will try to fin a solution because i didn't even manage to display a bitmap image (converting  QRcode into bitmap).

The only pic it displays in the example is the one in the first page (with cypress logo) but even in that case it created the pic with several "minus" and "underscore".

0 Likes

FaSa,

I suggest contacting Segger (the creator of emWin).   Maybe they have a QRCode example for the PSoC or know of an issue that prevents this library code from working.

As I indicated, I used the only example provided by Segger for QRCode generation and it gave me the SAME results as your code.

Len

PS:  Maybe Seggar would be willing to share the source for the QRCode generation functions.  It we could get it, we could more easily debug (and fix) what is causing the issue.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Hi LePo,

I believed to have found a solution:

1)I have downloaded Bitmap Converter from Segger

2)I have converted the pic of my QRcode into a c file and add it in the project (in Images folder where the is also the Cypress Logo Full Color_PNG_1bpp.c). At the end of this file there is  the bitmap picture that it generates:

GUI_CONST_STORAGE GUI_BITMAP bmNAMEOFFILE

(Assuming that the cfile is called NAMEOFFILE.c)

3)Now we have just to create a reference to this bitmap image in the main_cm4.c, like in the following line:

extern GUI_CONST_STORAGE GUI_BITMAP bmNAMEOFFILE;

4) Finally we can draw this bitmap picture on the screen with the following fuction:

GUI_DrawBitmap(&bmNAMEOFFILE, x, y)

Unfortunately my screen (CY8CKIT-028-EPD) is broken and I am waiting for a new one to test it (crazy ahha).

Thanks again for your interest.

Maybe you can try in the meantime.

0 Likes

FaSa,

Yes a bitmap of the QRCode is a bit "old school" but should generally work.

I contacted someone at Segger and let them know about the issue.   A tech support person named Sven at Segger has contacted me and I have provide him with the project and some Disassembly and register data at the point where the "train goes off the track".

I'll work with him.  Hopefully he can find the issue and provide a solution.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
lock attach
Attachments are accessible only for community members.

FaSa,

GOOD NEWS!

The issue has been solved!

Sven from Segger (Bravo to Segger for great support!) provided the answer.

The issue is that the QRCode generation function GUI_QR_Create() requires more GUI scratchpad memory than what was allocated.

Sven's recommendation was to make the following change in GUIConfig.c:

#define GUI_NUMBYTES  0x0100

to

#define GUI_NUMBYTES  0x010000

I made the change and the code no longer faults out and the QRCode displays.

I should note your assignment of 33*33 for the pixel_size is TOO big.  This value is the number of pixels if the minimum QRCode element.

Therefore setting the value to 3, will allocate a 3x3 QRCode element.  This is basically a scaling effect for the entire QRCode.

I made changes to your project to use a 3 QRCode element size and repositioned the QRCode.  Try it out.  It should be much easier than creating the QRCode and taking a bitmap image.  Using this method also reduces FLAH requirements since you don't have to include the bitmap for each display.  The QRCode can be programmatically generated for each page and can be programmatically generated for future updates as needed.

Len

Len
"Engineering is an Art. The Art of Compromise."

HI Len,

This is a GREAT news and I am very thankful to you.

Cypress shipped me the display on Friday and It would arrive next week so i will be able to check in some days.

Thanks again for your time, patience, interest and efficiency.

Regards

0 Likes

FaSa,

You should be able to run my modified project in debug mode without the display connected.

Set the breakpoint to main_cm4.c line 268 which is right after the GUI_QR_Create()  function that failed in the past.

If running in debug mode and this line breaks, then the GUI_QR_Create() is now solved.

Len

Len
"Engineering is an Art. The Art of Compromise."
lock attach
Attachments are accessible only for community members.

FaSa,

I have modified your modified version of the CE223727 example program if you're interested to check it out.

It's somewhat simplified and commented a little better.

Len

PS:  I'm planning on creating a KBA for everyone (if Cypress will allow me) on how to use the EmWin QR creation function calls.  It will include what we found out as well as help info about the effects of the different QR code creation settings.  I'll provide an example project with different screens using the QR codes under different QR settings.

Len
"Engineering is an Art. The Art of Compromise."

Thank you very much,

Sorry for my late reply. I have checked the last project and it goes perfectly (the only problem is the directory cy_eink_fonts.h was missing).

Thanks again for the support and the interest you showed.

0 Likes

FaSa,

We finally have a KBA for this issue.    Using emWin's QR-Code functions – KBA231613

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes