2024-01-03 01:14 AM - edited 2024-01-03 01:50 AM
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:
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?
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:
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:
I appreciate all the help in advance!
Solved! Go to Solution.
2024-01-03 09:22 AM
2024-01-03 10:01 PM - edited 2024-01-03 10:11 PM
First of all, Thank you very much for all the help that you are providing.
I am getting very close but I still have a few things that I am confused about:
1. After importing project as per your initial instructions, I can see that there are many different drivers in the BSP->Components directory:
But when the I look at the project files from the STM32CubeIde I can only see gde021a1.c
Why I cannot see many other directories (such as st7735, Common and others)?
2. Additionally, I am a bit confused about why I can only see gde021a1.c file in my STM32CubeIDE project files (See screenshot above) and I cannot locate gde021a1.h file anywhere. If I look at the project files in the file explorer instead, I will find that gde021a1 directory contains both .c and .h files:
3. I have drag and dropped the gdem0213b74.c to my STM32CubeIDE project:
But I am not sure about this part: link it in the project structure.
And exclude from build the "gde021a1.c" file. Could you provide some instructions how to properly do this as I am getting the error:
make -j16 all
arm-none-eabi-gcc "C:/Users/petrikas.lu/Desktop/WORK/STM32/Demonstrations/Drivers/BSP/Components/gde021a1/gde021a1.c" -mcpu=cortex-m0plus -std=gnu11 -g3 -DUSE_HAL_DRIVER -DSTM32L053xx -DUSE_STM32L0538_DISCO_REV_B03 -c -I../../../Config -I../../../Core/Inc -I../../../Drivers/CMSIS/Device/ST/STM32L0xx/Include -I../../../Drivers/STM32L0xx_HAL_Driver/Inc -I../../../Drivers/BSP/STM32L0538-Discovery -I../../../Middlewares/ST/STM32_USB_Device_Library/Core/Inc -I../../../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Inc -I../../../Middlewares/ST/STM32_TouchSensing_Library/inc -I../../../Drivers/BSP/Components -I../../../Drivers/BSP/Components/Common -I../../../Drivers/CMSIS/Include -Os -ffunction-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/BSP/Compnents/gde021a1.d" -MT"Drivers/BSP/Compnents/gde021a1.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Drivers/BSP/Compnents/gde021a1.o"
arm-none-eabi-gcc "../Drivers/BSP/Compnents/gdem0213b74.c" -mcpu=cortex-m0plus -std=gnu11 -g3 -DUSE_HAL_DRIVER -DSTM32L053xx -DUSE_STM32L0538_DISCO_REV_B03 -c -I../../../Config -I../../../Core/Inc -I../../../Drivers/CMSIS/Device/ST/STM32L0xx/Include -I../../../Drivers/STM32L0xx_HAL_Driver/Inc -I../../../Drivers/BSP/STM32L0538-Discovery -I../../../Middlewares/ST/STM32_USB_Device_Library/Core/Inc -I../../../Middlewares/ST/STM32_USB_Device_Library/Class/HID/Inc -I../../../Middlewares/ST/STM32_TouchSensing_Library/inc -I../../../Drivers/BSP/Components -I../../../Drivers/BSP/Components/Common -I../../../Drivers/CMSIS/Include -Os -ffunction-sections -Wall -fstack-usage -MMD -MP -MF"Drivers/BSP/Compnents/gdem0213b74.d" -MT"Drivers/BSP/Compnents/gdem0213b74.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Drivers/BSP/Compnents/gdem0213b74.o"
../Drivers/BSP/Compnents/gdem0213b74.c:20:10: fatal error: gdem0213b74.h: No such file or directory
20 | #include "gdem0213b74.h"
| ^~~~~~~~~~~~~~~
compilation terminated.
make: *** [Drivers/BSP/Compnents/subdir.mk:24: Drivers/BSP/Compnents/gdem0213b74.o] Error 1
make: *** Waiting for unfinished jobs....
"make -j16 all" terminated with exit code 2. Build might be incomplete.
2024-01-04 12:27 AM
Hello @LPetr.1
Perhaps you should take some time to familiarize yourself with the Eclipse environment and take a look at this link:
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,
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-01-04 01:17 AM - edited 2024-01-04 01:17 AM
I will read up more about this but I have never came across this since I just normally make my projects in STM32CubeIDE and never use linked resources. They seem way too complicated for what they are. Why wont you simply include the files that you need and thats it? This way you can clearly see what files/drivers are being used and can easily see them in the project view. I do not understand why would you ever want to use linked resources and what is the advantage.
Is there a shortcut in the STM32CubeIDE to view the linked resources instead of opening the .project file with the text editor - that would make more sense?
Regardless, I was able to get the display to work but it does not seem to be scaled to size properly:
As you can see text above cannot be fully displayed as it is out of display bounds. Perhaps this is because there are still some code related to the old revision and must be changed by hand for the new revision board? I havent had enough time to look at this but I will try to check why would it behave this way.
Anyways, thank you very much for all the help you provided.
2024-01-04 02:12 AM
> Perhaps this is because there are still some code related to the old revision and must be changed by hand for the new revision board?
Probably yes. Pictures from the thread I've linked above are similar. You've changed only the lowermost layer, i.e. the one which directly stores pixels to the display. The upper layer which actually produces the data does not take into account the changed display size (resolution) properly.
JW
2024-01-04 04:47 AM - edited 2024-01-04 05:02 AM
Is there a documentation anywhere to be found for new revision (B03) of the STM32L0538 Discovery?
I have only managed to find the old version documentation:
https://www.st.com/en/evaluation-tools/32l0538discovery.html
I cannot find any information about the new revision board. In fact, I do not even know the resolution of the E-ink display.
I have configured the Display window size (BSP_EPD_DrawImage) to be 72x172 and trying to Draw "Hello World" at cordinates (x=0, y=0).
BSP_EPD_SetFont(&Font16);
BSP_EPD_DrawImage(0, 0, 72, 172, Background_pic);
BSP_EPD_SetFont(&Font12);
BSP_EPD_DisplayStringAt(0, 0, (uint8_t*)"Hello World", LEFT_MODE);
BSP_EPD_RefreshDisplay();
The result:
But it works without any issues if I offset the text displayed by 10. For example, if I do:
BSP_EPD_DisplayStringAt(10, 0, (uint8_t*)"Hello World", LEFT_MODE);
It will display nicely:
It seems that the display is not capable of displaying close to the edges
2024-01-04 05:50 AM - edited 2024-01-04 05:50 AM
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