General Category > Discussion - MCU

STM32CubeIDE EVE4 Library Integration

(1/3) > >>

kumaichi:
Hello All,

New here, I've been writing Windows based software for longer than I'd like to admit and I'm having the hardest time trying to integrate any of the EVE libraries out on GitHub into an STM32CubeIDE project.  I've tried Riverdi (that's the display I'm trying to get working), Rudolph Riedel's and MatrixOrbital's libraries without much luck.  The steps I've tried:

1. Create a new project in Stm32CubeIDE using the STM32Wb55RG Nucleo board (I'm creating a custom board based off the MCU so bought the Nucleo for prototyping).
2. Dragged the cooresponding .c & .h files from the perspective library into the STM32CubeIDE file tree, .c to Src folder and .h to Inc folder.  Trying to keep it simple instead of creating specific folders like in the libraries for now to try and get something to compile.
3. Copied the contents of the host_layer/Stm32/platform.h and platform.c and copied into my main.h and main.c files.

Then I spend a few hours trying to get it to build.  Fail miserably and moved onto the next library trying the same steps (I am the definition of insanity, lol).  Can anyone provide some guidance to getting one of the libraries to build in an STM32CubeIDE project?

I am very new to hardware and STM32CubeIDE, which is why I think I'm having so much difficulty.

Kindest regards

BRT Community:
Hello,

[edit to add the image]

Welcome to the BRT Community,

We have a couple of examples on our Github which you could look at,

This example supports many different MCUs and we have recently added an STM32 CUBE IDE project, here is the link for the overall repository and a link to the project file.
https://github.com/Bridgetek/EVE-MCU-BRT_AN_025/tree/main
https://github.com/Bridgetek/EVE-MCU-BRT_AN_025/tree/main/examples/simple/STM32CUBE
If you download and unzip the full BRT_AN_025 code from the first link above, you can then open the project by browsing to the folder in the second link above within your download. This has the project file. We used the STM32F0 Discovery board and so some edits may be needed, I'll post an image of the hardware connection but we can also email you a document covering the code (please contact support.emea@brtchip.com)

A second project is our ESD porting guide which uses CUBE IDE, you can find a full document and code at this link on Github
https://github.com/Bridgetek/BRT_AN_073-ESD-exported-Project-Porting-Guide
This is for exporting the EVE Screen Designer project to C code for our FT900 MCUs and then porting to other platforms.

Rudolph also has a comprehensive library and examples for EVE which covers many different MCUs including STM32 and is worth checking out too,

Best Regards, BRT Community







 

kumaichi:
Thank you for your reply, I must have missed the "simple" during my searching.  I opened the project in CUBE IDE and although it successfully builds, when I try to write the firmware to an STM32F03 board I had laying around, it bricks the MCU and can only get it back by resetting it. 

Thanks again, I will continue to try and figure out what is happening.

I couldn't get Rudolph's library to build in my CUBE IDE project.

Kindest regards.

Rudolph:
I am not really working with STM32, but my Workspace in STM32CubeIDE is not empty. :-)
Setting up a project for the STM32Wb55RG revealed that my passwort on www.st.com had expired...
Oh, I also still did not implement DMA suppport.


Anyways, I started a new project with the NUCLEO-WB55RG and configured SPI1:
PA5 = SPI1_SCK
PA6 = SPI1_MISO
PA7 = SPI1_MOSI

And two GPIO-Outputs, PA3 and PA4.
I set the driver for SPI and GPIO to "LL".

I have no idea though to what the clocks are configured.
The SPI needs to be (at least initially) set to 11MHz or less.


The code is generated and the project builds.
Now I opened the project in the file explorer and went into /Core/Src/.
I created a folder "EmbeddedVideoEngine" and copied over the files from my library.
The folder EVE_target only needs to have the file EVE_target_STM32.h .

In the "examples" folder are several copies of "tfc.c", "tft.h", "tft_data.c" and "tft_data.h", for the most part these are all the same but the ones
in the "...PlatformIo" folders do not have the "EmbeddedVideoEngine" in the include for "EVE.h".
So I used the files from examples\EVE_Test_SAMC21_EVE2-50G\ and copied them to /Core/Src/.

Refreshing the project in STM32CubeIDE and the files show up.

Building the project fails however, the first error here is:
../Core/Src/EmbeddedVideoEngine/EVE_commands.c:3037:36: error: unknown type name 'int16_t'
And the reason is, my library does not know what a STM32WB is, yet.

Checking the properties/"C/C++ Build"/Settings/MCU GCC Compiler/Preprocessor, there is the symbol "STM32WB55xx" defined.
So the first thing to do is to add this symbol to EVE_target.h so that EVE_target_STM32.h gets included.

And now EVE_target_STM32.h needs to be expanded to load the correct includes:

--- Code: ---#if defined (STM32WB55xx) /* set with "build_flags = -D STM32WB55xx" in platformio.ini */
#include "stm32wbxx.h"
#include "stm32wbxx_hal.h"
#include "stm32wbxx_ll_spi.h"
#endif

--- End code ---

Building the project again, it still fails, but now the error is:
#error "Please add a define for the desired display to your build-environment, e.g. -DEVE_EVE3_50G"

So there is no display selected.
Back to the properties I added a new symbol: "EVE_EVE3_50G".

-> 18:57:17 Build Finished. 0 errors, 0 warnings. (took 1s.755ms)

In EVE_target_STM32.h also is the configuration for the CS and PD pins as well the SPI to use:

--- Code: ---#if !defined (EVE_CS)
#define EVE_CS_PORT GPIOA
#define EVE_CS GPIO_PIN_4
#endif

#if !defined (EVE_PDN)
#define EVE_PDN_PORT GPIOA
#define EVE_PDN GPIO_PIN_3
#endif

#if !defined (EVE_SPI)
#define EVE_SPI SPI1
#endif

--- End code ---

Nice coincidence, I already setup PA3 and PA4 as outputs and selected SPI1. :-)


And I just uploaded the modified EVE_target.h and EVE_target_STM32.h to Github.


But the project won't display anything so far.
So now main.c needs to be modified:


--- Code: ---/* USER CODE BEGIN Includes */
#include "tft.h"

/* USER CODE END Includes */

--- End code ---


--- Code: ---int main(void)
{
...
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_SPI1_Init();

  /* USER CODE BEGIN 2 */
  TFT_init();

  TFT_display();

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

--- End code ---

This should at least display one frame.
Usually I would put this in the endless loop, together with the TFT_touch() function from the example.
But the default main.c from STM32CubeIDE does not have even a primitive scheduler and while there is a SysTick_Handler(),
I am not sure to what tick it is configured.
Normally I would go for 5ms ticks, execute TFT_display() every 20ms and execute TFT_touch() every 5ms when TFT_display()
is not executed.
But well, my job was done when it compiled. :-)

kumaichi:
Wow!  Thank you so much Rudolph!  I'm a newbie to CUBE IDE and trying to figure all of this out.  Guess I shouldn't have started with a display, LOL.

I have it building without errors or warnings using your very detailed steps, very cool!!!

This is light years ahead of where I've been for the last week.  Thanks again for your time and effort helping a newbie and putting this library together.

Currently stuck inside:

EVE_target_STM32.h->spi_transmit(...)->while (!LL_SPI_IsActiveFlag_RXNE(EVE_SPI)) {}

It never comes out of the while loop and the return always = 0, ugh. 

Kindest regards

Navigation

[0] Message Index

[#] Next page

Go to full version