emwin - GUI_LANG_LoadCSVEx loading different CSV files

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • emwin - GUI_LANG_LoadCSVEx loading different CSV files

      Hi,
      As noted in the emwin manual, when calling GUI_LANG_LoadCSVEx it deletes the old resources and loads the new one.
      The scenario in my code is:
      1. Load CSV1 -> read values
      2. Load CSV2 -> read values
      3. Load CSV3 -> read values
      So far no issues, works perfectly.
      4. Load CSV1 again -> Fails (GUI_LANG_LoadCSVEx return 0).
      Note: if I reload CSV2 or CSV3 Again, it does not fail.
      Also if I load CSV1 twice in a raw (only for debug), it fails
      1. Load CSV1 -> read
      2. Load CSV1 again -> Failes.
      Note: CSV1 size is 60K. But I believe that emwin does not load the CSV to the RAM, it only loads the specific text to RAM when calling GUI_LANG_GetTextBufferedEx function.

      How can I spot the cause of this issue or is it a known issue for big CSV files. ?(
    • Hi Sysmop226,

      I've tried to reproduce your error, but it worked fine for me. And yes, file size shouldn't matter with GUI_LANG_LoadCSVEx() as this function only gets size and file offset of the text locations.
      Have you checked if the file handle you pass to GUI_LANG_LoadCSVEx() is still valid?

      Best regards,

      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi Florian,
      Thanks for the reply.
      I can reproduce the issue only with big CSV files.

      Source Code

      1. // Set access to CSV file
      2. int test1 = GUI_LANG_LoadCSVEx(_GetData, (void *)_acLanguageParam_V1);
      3. int test2 = GUI_LANG_LoadCSVEx(_GetData, (void *)_acLanguageParam_V1);
      in test1 I get the number of languages in the file.
      in test2 I get 0 -> Failure.

      The CSV file (Array) is Valid, its a const array located on the External Flash:

      Source Code

      1. __root const unsigned char _acLanguageParam_V1[56700UL + 1] @ 0x90081000
      As I mentioned earlier, when applying the same scenario with a smaller CSV (20K) for example, it works fine.
    • Hi Sysmop226,

      I have tried to reproduce this with an array like you said, with an even bigger file and less target memory than the file size, but it still worked fine. Even with an older version (5.48) from before something in the GUI_LANG module was changed, everything worked fine.
      Can you tell me which emWin version you are using?

      Best regards,

      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi,

      could you tell me which emWin version that is? The version number is located in the file GUI_Version.h.
      And could you also send me your application and the CSV files, as well as the files GUI_Conf.c and LCD_Conf.c so I can accurately try to reproduce your error?

      Thanks and best regards,

      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi,
      This is the version.

      Source Code

      1. #define GUI_VERSION 54401

      I'm afraid I cannot send the application and the CSV files.
      But I started to suspect that the library does not clean the resources.
      Test scenario 1: I have a big CSV file (60k) when trying to load it twice it fails on the second one.
      Test scenario 2: I have another CSV file (20k) I load it 4 times, the fourth fails :!: .
      I can attach the conf files.
      Please find attached.
      Files
      • Config.7z

        (6.9 kB, downloaded 413 times, last: )
    • Hi,

      I couldn't reproduce the error with this version either. Based on how your test went, it sounds like a memory issue. But in my test, emWin didn't run out of memory.

      You could still check if you run out of memory by watching the variable "GUI_ALLOC__Context", there's an element called "NumFreeBytes". If you do, that's your error, emWin needs more memory.

      If that still didn't solve it, I'm afraid I can't help you out any further, unless you send me a sample that I can run to reproduce your error.

      Best regards,

      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi,
      How could it be a memory issue? your manual says that the emwin releases the resources when loading a new CSV/Text file.
      Is there a way to release the resources manually?
      See the following numbers:
      Num of free bytes before calling the Load function is: 199,252
      Num of free bytes after calling the load Function for the first time: 59,844 :!: :!: :!:
      Of course there will be no space for extra load if the load function does not release the resource!
      My GUI_NUMBYTES is 256K

      Source Code

      1. #define GUI_NUMBYTES (250) * 1024
      Senario for GUI bytes:

      Source Code

      1. int freeBytes1 = GUI_ALLOC_GetNumFreeBytes();
      2. int test1 = GUI_LANG_LoadCSVEx(_GetData, (void *)_acLanguageParam_V1);
      3. int freeBytes2 = GUI_ALLOC_GetNumFreeBytes();
      4. int test2 = GUI_LANG_LoadCSVEx(_GetData, (void *)_acLanguageParam_V1);
      5. int freeBytes3 = GUI_ALLOC_GetNumFreeBytes();
      6. int test3 = GUI_LANG_LoadCSVEx(_GetData, (void *)_acLanguageParam_V1);
      freeeBytes1 = 199,252
      test1 = 6
      freeBytes2 = 59,844
      test2 = 0
      freeBytes3 = 118,972
      test3 -> Hardfault :!: --> GUI_ALLOC_Free Failed

      All the scenarios that I have ran leads for one conclusion: the library does not free resources as it says in the manual.
    • Hi there,

      I've tried again with what you said, but I couldn't reproduce such a behavior regarding the memory. Before my first call of GUI_LANG_LoadCSVEx(), there are 253,020 free bytes, after the first call it's 214,024 bytes. And no matter how often I call GUI_LANG_LoadCSVEx() with the same array pointer as parameter, the number of free bytes stays the same.

      There is a function to free the memory, but it got added with emWin V5.50. By the way, when you're already using an emWin library by a vendor like ST, you get a discount of up to 50% when you purchase the emWin source upgrade (more info here: segger.com/products/user-inter…win/emwin-source-upgrade/).

      Best regards,

      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi,

      yes, I tested it several times with the exact version you are using. Currently, emWin V5.50 is the latest version.

      Best regards,

      Florian
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi again Florian,
      I Still could not solve the issue.
      I would like to send a test application for you.
      Its really a blocker for us.
      I cannot attach the file here since its larger than the max allowed.
      Is there an email that I can send to?
      Thanks.
    • Hi,

      try calling GUI_LANG_SetMaxNumLang() before loading the CSV file.

      Regards,
      Sven
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.