Skip to main content
Graduate II
January 3, 2024
Solved

Running STM32L0538-DISCO sample project

  • January 3, 2024
  • 5 replies
  • 5372 views

Hello. I have recently purchased STM32L0538-DISCO board and I want to play a bit with the E-paper display. After struggling for a couple of hours trying to find some sample code or projects to run on STM32CubeIDE, I have found somewhat relevant thread here:

https://community.st.com/t5/stm32-mcus-touch-gfx-and-gui/problem-with-stm32l0538-disco-e-paper/td-p/230661

 

I have located STM32_Cube_FW_L0_V1.12.2 on my PC and tried to follow the migration guide UM2579.

Unfortunately, I have not been able to migrate the project to STM32CubeIDE as I think the instructions are not fully clear.

 

My questions regarding migrating the project:

1. The first step in the guide mentions that I need to make a copy of the project and copy that inside the workspace currently being used in STM32CubeIDE. I cannot understand how to properly do that. First of all, when it refers to "make a copy of the project" which directory does it refer to exactly?

LPetr1_0-1704273030053.png

 

Does it refer to whole Demonstrations directory? 

 

 

 

 

 

C:\Users\petrikas.lu\STM32Cube\Repository\STM32Cube_FW_L0_V1.12.2\Projects\32L0538DISCOVERY\Demonstrations\SW4STM32\STM32L0538-Discovery

 

 

 

 

 

 

Does it refer to SW4STM32 directory?

 

 

 

 

 

C:\Users\petrikas.lu\STM32Cube\Repository\STM32Cube_FW_L0_V1.12.2\Projects\32L0538DISCOVERY\Demonstrations\SW4STM32

 

 

 

 

 

 

Or STM32L0538-Discovery directory?

 

 

 

 

 

C:\Users\petrikas.lu\STM32Cube\Repository\STM32Cube_FW_L0_V1.12.2\Projects\32L0538DISCOVERY\Demonstrations\SW4STM32\STM32L0538-Discovery

 

 

 

 

 

 

Additionally, which files exactly do I need to copy?

 

2. It also mentions that I need to copy those files to already open workspace. Does it mean that I need to create a blank project for the STM32L053? I do not get how can I have workspace already open prior to creating a project?

 

3. Perhaps there is an easier way to get the most basic E-Paper example running on STM32L0538-Discovery board? I am not interested in the touch bar or anything else. I just want to display some text on the e-paper  for example "Hello World"  before moving to more complex tasks.

 

I have tried to simply create a blank project for the STM32L0538 and download the following:

https://www.st.com/en/embedded-software/stsw-stm32152.html

 

I simply pasted the BSP directory from the 

 

C:\Users\petrikas.lu\Downloads\en.stsw-stm32152\Drivers\BSP

 

to my project directory. that BSP directory contains gde021a1 and files for stm32l0538_discovery board:

LPetr1_0-1704274883646.png

However, since I created a blank project using stm32CubeMX, I cannot build the project perhaps I am missing some configuration:

 

 

make -j16 all 
arm-none-eabi-gcc "../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.c" -mcpu=cortex-m0plus -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32L053xx -c -I../Core/Inc -I../Drivers/STM32L0xx_HAL_Driver/Inc -I../Drivers/STM32L0xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L0xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.d" -MT"Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.o"
In file included from ../Core/Inc/stm32l0xx_hal_conf.h:188,
 from ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal.h:29,
 from ../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.h:48,
 from ../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.c:40:
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.c: In function 'BSP_LED_Init':
../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_rcc.h:724:40: error: expected expression before 'do'
 724 | #define __HAL_RCC_GPIOB_CLK_ENABLE() do { \
 | ^~
../Drivers/STM32L0xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h:2829:28: note: in expansion of macro '__HAL_RCC_GPIOB_CLK_ENABLE'
 2829 | #define __GPIOB_CLK_ENABLE __HAL_RCC_GPIOB_CLK_ENABLE
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.h:104:49: note: in expansion of macro '__GPIOB_CLK_ENABLE'
 104 | #define LED3_GPIO_CLK_ENABLE() __GPIOB_CLK_ENABLE()
 | ^~~~~~~~~~~~~~~~~~
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.h:112:71: note: in expansion of macro 'LED3_GPIO_CLK_ENABLE'
 112 | #define LEDx_GPIO_CLK_ENABLE(__INDEX__) (((__INDEX__) == 0) ? LED3_GPIO_CLK_ENABLE() : LED4_GPIO_CLK_ENABLE())
 | ^~~~~~~~~~~~~~~~~~~~
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.c:154:3: note: in expansion of macro 'LEDx_GPIO_CLK_ENABLE'
 154 | LEDx_GPIO_CLK_ENABLE(Led);
 | ^~~~~~~~~~~~~~~~~~~~
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.c: In function 'BSP_PB_Init':
../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_rcc.h:716:40: error: expected expression before 'do'
 716 | #define __HAL_RCC_GPIOA_CLK_ENABLE() do { \
 | ^~
../Drivers/STM32L0xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h:2823:28: note: in expansion of macro '__HAL_RCC_GPIOA_CLK_ENABLE'
 2823 | #define __GPIOA_CLK_ENABLE __HAL_RCC_GPIOA_CLK_ENABLE
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.h:128:49: note: in expansion of macro '__GPIOA_CLK_ENABLE'
 128 | #define KEY_BUTTON_GPIO_CLK_ENABLE() __GPIOA_CLK_ENABLE()
 | ^~~~~~~~~~~~~~~~~~
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.h:133:50: note: in expansion of macro 'KEY_BUTTON_GPIO_CLK_ENABLE'
 133 | #define BUTTONx_GPIO_CLK_ENABLE(__INDEX__) (KEY_BUTTON_GPIO_CLK_ENABLE())
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~
../Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.c:222:3: note: in expansion of macro 'BUTTONx_GPIO_CLK_ENABLE'
 222 | BUTTONx_GPIO_CLK_ENABLE(Button);
 | ^~~~~~~~~~~~~~~~~~~~~~~
make: *** [Drivers/BSP/STM32L0538-Discovery/subdir.mk:34: Drivers/BSP/STM32L0538-Discovery/stm32l0538_discovery.o] Error 1
"make -j16 all" terminated with exit code 2. Build might be incomplete.

11:42:20 Build Failed. 3 errors, 0 warnings. (took 362ms)

 

 

It is quite strange why I am getting errors such as this after adding BSP inside my Drivers folder:

LPetr1_0-1704275435893.png

 

 

 

 

I appreciate all the help in advance! 

 

 

 

 

 

 

    This topic has been closed for replies.
    Best answer by RomainR.

    Hello @LPetr.1 

    Perhaps you should take some time to familiarize yourself with the Eclipse environment and take a look at this link:

    https://help.eclipse.org/latest/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fconcepts-13.htm

    Regarding your first two questions, what you see in the STM32CubeIDE Project Explorer does not correspond to the physical structure of directories. In the Eclipse environment, there is a notion of Linked Resource for directories or files. As the demonstration project was converted from SW4STM32 to STM32CubeIDE, you can see the list of these Linked Resources in the following file:

    "C:\Users\yourname\STM32Cube\Repository\STM32Cube_FW_L0_V1.12.2\Projects\32L0538DISCOVERY\Demonstrations\SW4STM32\STM32L0538-Discovery\.project"

    You can read with your preffered advanced text editor (such as Notepad++ or SublimeText) and found all the source file (.c) linked with this project. 

    <linkedResources>
    ...
    <link>
    <name>Drivers/BSP/Compnents/gde021a1.c</name>
    <type>1</type>
    <location>PARENT-5-PROJECT_LOC/Drivers/BSP/Components/gde021a1/gde021a1.c</location>
    </link>
    ....
    These lines are specific for gde021a1.c but all c files of the project are listed. This is because the project was initially designed in this way.

    For your third point, when you dragged and dropped the file gdem0213b74.c into the corresponding directory, Eclipse must have prompted you to either copy or link it. This is where you choose link it (and you should see a the file with an arrow icon in this case)

    Finally, to exclude the other file gde021a1.c, you simply right-click on it, then select properties, C/C++ Build and check Exclude from build. This file will not be compiled.

    Let me know if my guideline helps you.

    Best regards,
    romain,

     

     

    5 replies

    ST Employee
    January 3, 2024

    Hello @LPetr.1 

    I suggest you to import 32L0538-Discovery Demonstration in this way:

    1°) Start from STM32CubeIDE, and in Project Explorer select Import projects...

    RomainR_0-1704276956898.png

    2°) In import Wizard choose STM32Cube Example, and click Next.  

    RomainR_1-1704277014729.png

    3°) In the example selector, set the Board filter to STM32L0538-DISCO, the search in the project list Demonstration project. Then click Next and Finish to copy the full project and libraries in your STM32CubeIDE workspace. The folder SW4STM32 will be migrated to STM32CubeIDE.

    RomainR_2-1704277236393.png

    4)) After that, you can edit, compile and debug the Demonstration project with STM32CubeIDE. 

    if you check Project Properties, in Resource, Linked Resources, you will find the Path variables PROJECT_LOC is located in your workspace.

    RomainR_3-1704277627865.png

    Let me know if it help you?

    Best regards.

    Romain

    LPetr.1Author
    Graduate II
    January 3, 2024

    Yes I am able to compile and flash the device using the methods you have suggested above! Thank you very much. This is much easier than what is explained in the Migration guide document.

    Super User
    January 3, 2024

    AFAIK there are two different versions of the 'L0 Disco board, with different e-paper display. And old demo won't properly support the newer version.

    Check the Disco's user manual, schematics, compare to the code you have.

    JW

    [EDIT] https://community.st.com/t5/stm32-mcus-embedded-software/stm32l0538-disco-demo-program/m-p/82762

    Super User
    January 3, 2024

    These steps match the description from thread I linked above.

    @RomainR.could the resulting project be published somewhere (here for example?) together with appropriate description, as it appears to be a recurring and, frankly, a quite legitimate request.

    JW

    ST Employee
    January 3, 2024

     @waclawek.jan you are absolutely right. Ok, I have taken this action internally. We will see how we can improve this in the future version of Cube L0.
    Best regards,
    Romain

     

    Super User
    January 3, 2024

    Thanks, Romain.

    Jan

    @RomainR. 

    Super User
    January 4, 2024

    See schematics under "CAD Resources". Comparing them you should find out what the differences are.

    The User Manual should say this, too; I did not check. I am not ST.

    Unfortunately, the documentation of displays themselves and their on-board control chips is hard to obtain; again, this is something ST should make efforts to publish (I understand all e-inks and most LCD displays are far-eastern products with sub-par documentation, if any at all; it is what it is) otherwise we're left with whatever errors ST introduced in their software.

    It's for a very long discussion what ST could make better with their demos.

    > It seems that the display is not capable of displaying close to the edges

    I doubt that; it will be consequence of how functions you are using are written. Cube/HAL is open source, you can have a look yourself.

    JW