1.1k views
in GUI Development by

Hello,

for my application I have a worker and a gui thread. I know EW is not thread safe and I never should call a GUI method from a other thread.

But for my application I need to use a worker thread to initialize some hardware timer, use spi, work with interrupts and a lot of other thinks. But only for a short time. If I want to do this I send my GUIThread to the waiting status.  If I have  collected my values from my ADC, I set osThreadSignal an continue with the GUI Thread. But after the next touch event the Code runs into a exception handler. 

GraphicsCanvas GraphicsCanvas_AttachBitmap( GraphicsCanvas _this, XHandle aBitmap )
{
  XInt32 noOfFrames;
  XPoint frameSize;
  XInt32 frameDelay;

  if ( _this->Super1.bitmap != 0 )
  {
    EwThrow( EwLoadString( &_Const0004 ));
    return 0;
  }

This code is part of the Graphics.c. Here my code ends at the EwThrow.

 

I am not really sure why this exception is triggered.  I  don't use any parts of the GUI. There is no exchange with the GUI at the moment. Or there are some GUI internal timer which creates some problems? Is it not allowed to send the GUI in waiting status at the end of the while loop?

 

Kind regards

Alex

1 Answer

0 votes
by

Hi Alex,

in principle there is no problem to suspend and resume the GUI application. There is no internal timer that could cause the described problems.

Can you ensure that there is no access from the worker thread to memory or objects that belongs to the GUI thread?

Maybe you can check with a terminal, that there are no preceeding error messages.

Best regards,

Manfred.

by

I tried it in different ways. My current state is, that I stay in the GUI Thread. During my measurement I don't access the GUI parts of my GUI main loop. After my measurement I continue with the normal GUI loop. But every time my code runs into the EwPanic. 

That is what I can see at the Call Stack before I run into the EwPanic.

My serial output is like this:

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]
\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\x00FF\xFFFF\x00FF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\x64FF\xFFFF\x00FF\xFFFFo\xFFFF\xFFFF\xFFFF\xFF00\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\x00FF\xFFFF\xFFFF\xFFFF\x00FF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFF00\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFF63\xFFFF\xFFFF\xFFFF\xFF76\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFF79\xFFFF\xFFFF\xFFFF\x00FF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\x00FF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFF00\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFFF\xFFF
PANIC: System halted

I am not really able to interpret this information.

My measurement worked without GUI. Im pretty sure that my function is not accessing any object of the GUI. 

 

Best regards,

Alex

by
Just a short question: How large is the stack of the GUI thread?

Please try to reserve 4...8 kByte in order to be sure that not the stack is overwritting something...

Best regards,

Manfred.
by
It turned out, that one of the GPIO pins is the problem. At my board a lot of GPIO pins have multiple functions. This one is used for the camera and the NOR Flash. After changing the pin, the gui runs without any problems.

 

Best regards and thank you.

Alex

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

...