2.6k views
in System Integration by

I have a working RTOS application on stm32fx device, and now I'd like to add UI created by EmWi.

I'm not sure which one is better ?

1. Add RTOS to IAR project that generated from EmWi

2. Include EmWi generated code into my exist IAR project

I had tried the first one. Modified from the FreeRTOS version generted by EmWi, and I replaced all of codes according to the EW_USE_FREE_RTOS define

But the screen didn't show correctly, it looks much bigger and repeatly, here is an picture for PaperCutter example:

Did anyone have experience to integrate other RTOS besides FreeRTOS? Any suggestions will be appreciated, Thanks!

2 Answers

0 votes
by
Hi,

the doubled content on the screen is not related to the operating system. I assume that the display initialization / display timing is not correctly.

Did you use the same system clock settings and the same display settings (ew_bsp_display.c) as in case of FreeRTOS?

What kind of display are you using and how is it connected? What type of STM32Fx are you using?

Best regards,

Manfred.
by

I am using STM32F469 and on board screen (MIPI display serial interface).

I didn't change system clock settings and only modified the semaphore mechanism(in ew_bsp_display.c, ew_bsp_graphics.c and ew_bsp_event.c) to adapt my RTOS.

And one more thing, I do the same following code as in case of FreeRTOS that I don't really know why need to change priority.

#if USE_RTOS == 1
void HAL_DSI_MspInit(DSI_HandleTypeDef* hdsi)
{
  HAL_NVIC_SetPriority(DSI_IRQn, 8, 0);
}
#endif

 

by
Maybe you can try the following:

1.) Use a more simple application, e.g. HelloWorld

2.) Set the flag EW_USE_DOUBLE_BUFFER=0 within your makefile/toolchain. Then the synchronization / semaphore is more simple.

3.) Connect a serial terminal - maybe we get some useful message....
by
Thanks, I'll try it later !

BTW, did you think the method that I replaced all of codes in EW_USE_FREE_RTOS define is a corret way to integrate other RTOS with EmWi?
by
Yes in principal this should be a good approach.

Let us know the results of the above steps.

The interesting part: Is the destroyed display content just what you see while the application hangs - or is the application still running?

Btw: How many stack do you reserve for the UI application?
by

My result is almost the same as Toxic's. 

Here are messages from serial:

Create UI thread...                          [OK]
Initialize Display...                        [OK]
Initialize Touch Driver...                   [OK]
Initialize Memory Manager...                 [OK]
MemoryPool at address 0xC00BB800 size 0x00744800
Initialize Graphics Engine...                [OK]
Create Embedded Wizard Root Object...        [OK]
Create Embedded Wizard Viewport...           [OK]

And the stack size is config as 128 bytes, but nothing different when I changed the size to 512 bytes.

For the UI, it's still running and touch event works as normal situation. (the coordinate is right!)

by
In any case, the stack size is too small. Please reserve a stack of 4...8kBytes. But I assume this is not the root cause for the described problem.

Can you check the interrupt configuration for LTDC and DSI - especially if the HAL_DSI_TearingEffectCallback() and HAL_DSI_EndOfRefreshCallback() are called? I think these are not active / the callbacks are never called.
by

OK, I changed the stack size and I put EwPrint() function inside HAL_DSI_TearingEffectCallback() and HAL_DSI_EndOfRefreshCallback().

I can see both callback was called after boot and each time screen touched!

BTW, I tested if only change EW_USE_FREE_RTOS region in ew_bsp_event.c and leave other file (graphic, display) using non-OS function, It's works fine!

by

Can you try the same steps as Toxic: 

I configuered the ew_bsp_display, ew_bsp_ event and ew_bsp_graphics like I have no OS.

by

I just edited the previous commit =>  I tested if only change EW_USE_FREE_RTOS region in ew_bsp_event.c and leave other file (graphic, display) using non-OS function, It's works fine!

In this case, EmWiMainLoop is running in my OS thread and I also put my OS SysTick handler in stm32f4xx_it.c file. Also the picture will follow my touch as well.

 

 

0 votes
by
Hi,

I have the same problem. I use the STM32F769I-Eval and Keil RTX. I started with the template of EW and integrated my code. I changed the freeRTOS to RTX.

After starting, the GUI is displayed correct. If I touch the display, I can see the absolute same problem like you.

If I use the semaphore for ew_bsp_graphics too, its totally messed up. The text will not showing correctly. So it seems that is a problem with the semaphore, but I don't know to debug.

So I am very intresed how you can fix this and I hope it works for me too.

 

Best regards,

Alex
by
There is no need to use a semaphore - in principle you can work with the flag.

The idea of the current implementation is: When using a service of the operating system, it can use the CPU time for other tasks instead of waiting for the flag. That's all.
by
Thanks to HsinHan, I can see maybe a big problem for me. I can't put the systick_handler in the stm32f4xx_it.c because it is already defined in the cm4.lib from RTX. I can't override this function. Is there a way to work around this problem?
by

Hi Toxic, I don't know how RTX system tick working, just refer to this page: http://www.keil.com/support/man/docs/rlarm/rlarm_ar_alt_ticktim.htm

To configure an alternate peripheral timer as system tick timer, you have to:

  1. implement the os_tick_init() and os_tick_irqack() functions in the RTX_Config.c configuration file.
  2. replace the alternate timer interrupt vector with the OS_Tick_Handler in the Interrupt Vector Table in startup file.

My idea is do not replace the interrupt vector in startup_stm32f4xx.s file. Then put OS_Tick_Handler into SysTick_Handler() function in the stm32f4xx_it.c

Maybe like this:

void SysTick_Handler(void)
{
  HAL_IncTick();
  EwBspSystemTickIncrement();

  #if USE_RTX == 1
    OS_Tick_Handler ();
  #endif
}

 

by

I found a good way for me to solve that problem. 

I changed  the EwGetTicks() function. Now use directly des os_Time instead of the EmWiSystemTicks. os_Time is also increased every 1ms.

unsigned long EwGetTicks( void )
{
  /* It is assumed that the extern EmWiSystemTicks variable is incremented every
     millisecond by a timer driven interrupt service routine. */
  return HAL_GetTick();
}

But then I had the problem that my screen freezed after some touch events and the systems runs in a hardfault. I figuered out, that there is a problem with the RGB888. If I use RGB8888 or RGB565 every thing works perfect.

Thank you guys for your great help.

by
Hi Toxic,

thanks for the feedback - just to understand the hardfault: What compiler are you using?

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...