Jump to content

STR7xx UGFX port


Lukman

Recommended Posts

Hi ugfx forum,

I am curious about ugfx and for two weeks now tried to port it to one str710 based board that has ssd1963 with xpt2046 chips and see if it will work. using Keil v5 compiler, i setup my project to include ugfx trees and config files as prescribed, all is fine, everything compile (though lots warning occurs). fyi, first i tried to compile in Arm mode, then tried Thumb mode with interwork. The result at first is weird. If i compile in arm mode, no interwork, all my files compiled through and when the apps execute, I cannot see anything at all. (except white screen) no button etc.

So next I tried to compile with Thumb mode, all files, no interwork and voila! I see it work. But the execution is awfully slow. SO i decided to interwork between arm and thumb. for ugfx I compiled with thumb mode and my apps with arm. so the result is interworked ugfx ( at least, i assume this is). execution is fast and touchscreen worked fine along with driver for xpt2046. I got through with Callibrating screen and see buttons according to my design layout. This is where my real problem comes in and had me scratching my head for a couple of days now.

After getting through the calibrating screen, which I believe validates my driver is all working ok...There is no mouse event happened. I cannot seem to see where the fault is. I do not want to bored anybody with redundancy...so here goes the code.

GFXCONF: just some tweak, the rest is standard ugfx studio generated.

#define GFX_USE_OS_RAW32                             TRUE
#define GFX_COMPILER                             GFX_COMPILER_KEIL
#define GFX_OS_HEAP_SIZE                         40260                                    // Somehow dynamic memory is just not running at all. so for now I need to enable static
#define GINPUT_TOUCH_STARTRAW                        FALSE
//#define GDISP_INCLUDE_FONT_UI2            TRUE
//#define GWIN_NEED_CONSOLE        TRUE
#define GFX_EMULATE_MALLOC                      TRUE
#define GDISP_SSD1963_NO_INIT                                     TRUE          // using init for SSD1963 does not work in both arm and thumb mode. have to init manually
#define GINPUT_MOUSE_POLL_PERIOD                25

systicks is generated by TIMER0 Compare function of str710 fired every 1ms, along with my short main. basically it runs to while loop standard and gfxsleep every 100ms.

int main (void) {
         /*
        UWORD8 i = 0;
        WORD32 n = 0;
    //    UWORD8 msby, lsby,msbx,lsbx;
    
    */
    
     BOOL exitThread = FALSE;
    GSourceHandle            gs;
    GEventMouse                *pem;
    GMouse *                m;
    GMouseVMT *                vmt;
    
    target_init();
        app_init();

    

        gfxInit();
        gdispClear(White);
    //    exitThread = TRUE;
     gdispSetBacklight(0xF0);
        gdispSetContrast(40);
    guiCreate();

        geventListenerInit(&gl);

    gs = ginputGetMouse(GMOUSE_ALL_INSTANCES);
    geventAttachSource(&gl, gs,GLISTEN_TOUCHDOWNMOVES);

    gwinAttachListener(&gl);
gfxThreadCreate(NULL, 2042, NORMAL_PRIORITY, threadfunction, (void*)&exitThread);         // somehow I managed another thread blinking led as run status. It worked!!

while(1)
    {

 gfxSleepMilliseconds(100);

// Do nothing

}

 

Link to comment
Share on other sites

i guess that the gtimer for polling the mouse is dead somehow. I checked with a scope looking at the interrupt line, it turns out it is active when pressed. but there is no data exchanged between the board and touchscreen. this lets me to believe the listener is not listening..can someone tell me how to activate the touch event in ugfx..

Link to comment
Share on other sites

Hello and welcome to the community!

There are a couple of different tools that you can find in the /demos/tools directory that will help you to troubleshoot your touchscreen issues. I'd recommend running them to pin-point the exact problem.
Regarding the GTIMER thread: Make sure that the stack size (GTIMER_THREAD_WORKING_SIZE) is big enough. However, the default setting of 2048 bytes should be more than enough unless you are running other GTIMER jobs that require a log of stack. You can find more information about that here: http://wiki.ugfx.org/index.php/GTIMER

Also note that you don't have to use any of the GINPUT API functions inside your application code unless you want to manually add some devices. The touchscreen handling is totally automated for you in the GWIN module.

Link to comment
Share on other sites

Hi Joel,

Thank you for the quick response. I really appreciate it.

I took your advice and tried the console for touchscreen driver test in tools. you are correct that it worked well without additional tweaks to the listeners. Though I found out later, by testing the tools provided, I thought I found some big problems for me. With consoles, I did not enable Containers and Widgets, etc. so the gfxconf is light..as per example in the tools folder. This worked fine. On to the containers and widgets and windows manager, basically the ugfx studio generated config, I found that the Containers and Window Manager is causing this. One test, I presumed, without calling guiEventLoop() in the while, the entire board just reset it self....as if someone push reset button...it will restart itself. Many time over...The Symptoms is that during starting up, I guess MousePoll initiated by GTIMER fire correctly and get the mouse read, after it starts the gui's pages and containers, driver communication to the touch chip ends...It may get bog down by window manager whilst send event is pumping its messages to the widgets...perhaps

Thus, I looked at the code for gwin and container etc, cannot pin point where the mouse event took lead. everything looks fine code wise...this is weird.

I will try again later to debug and see what I find. Any help with the window manager and containers code is a plus for me. 

 

Link to comment
Share on other sites

One thing for sure the Gtimer is not running at all after gfxinit is called...

 

GTimer gt1;


void callback1(void*arg) {
        (void)arg;
    
            led_show_data(0x01);
                gfxSleepMilliseconds(1000);
            led_show_data(0x00);
    
    
}

int main () {
         /*
        UWORD8 i = 0;
        WORD32 n = 0;
    //    UWORD8 msby, lsby,msbx,lsbx;
    
    */
    
    GSourceHandle            gs;
    GEventMouse                *pem;
    
    
    target_init();
    app_init();
    
    gfxInit();
    
    gtimerInit(&gt1);
    gtimerStart(&gt1,callback1,NULL,TRUE,10);      // Note on the time is 10, first I put 1000 for 1sec triggering....
    
        gdispSetBacklight(10);
    gdispSetContrast(40);

    geventListenerInit(&gl);
    
    gwinAttachListener(&gl);

    guiCreate();

The callback is to light led 1 on the board. nothing happened. Also I  noticed that gfxSleepMilliseconds is stuck at gfxYield()....removing gfxYield returns it to normal....I wonder Why...

Link to comment
Share on other sites

sorry to reply so late...:)

It took me a while to investigate the thread that was pointed out to me earlier, regarding how keil messes up on the setjmp implementation.

Well looking at their setjmp functions it turns out that the thread for processing the heap actually gotten locked by other thread earlier before the main thread with higher prio finish its exec..or so I believe this was my case...i can back this up for I have tried using gcc compiler to compile within keil and my problems indeed went away.

So to confirm...gcc is the way to go with this...but, there is something that comes to light. regarding evrything it works..mouse, display and all...just could not get around the refresh rate of the page transitions. its quite slow to jump to other window though. My question now is how to speed the gui operation faster.

it seems like I am asking too much of the STR710 processor.. it only runs at 68M...can I still reach 60hz refresh rate ?? 

I will post my code soon enough once i get everything going as my contribution to the ugfx project...cheers.....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...