/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / circle os 3.9

Username:     
Password:     
             

Forum

# 1   2010-01-24 10:42:46 circle os 3.9

mdvtec
New member
From: Malaysia
Registered: 2009-12-23
Posts: 2

circle os 3.9

Is there any idea on developing circle os 3.9, is there any development in progress?version 3.8 hasn't fully solved the touch screen calibration. i think the touch screeninterface needs lots of improvements  if yes when will it be released?

Offline

 

# 2   2010-01-25 08:16:19 circle os 3.9

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: circle os 3.9

Hi,

I'm sorry, but no release is forseen soon.
The touch screen calibration problem is due to non linear behaviour of the screen (hardware characteristics).
We are opened up on any suggestion to improve the CircleOS.

Yves

Offline

 

# 3   2010-01-25 22:13:20 circle os 3.9

ntrf.zns
Member
From: Belgorod, Russia
Registered: 2009-11-01
Posts: 134

Re: circle os 3.9

I have a suggestion: make the response linear.

It not a joke. There is a software error in touchscreen.c!

I fixed it in my unit and now it works with only linear compensation (no calibration coefficients applied). Jitter with steady stylus is about 2px wide.

But...
There is a problem remaining: each time i turn on my unit touchscreen has random (at least it looks like random) shift in horisontal direction. The point on screen is ? pixels to the left or to the right. Amount of this shift changes if audio is used (i started a topic on this forum but nobody responded).

So i didn't found the perfect solution. Maybe Raisonance will.

Offline

 

# 4   2010-01-26 07:16:15 circle os 3.9

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: circle os 3.9

Hi,
Could you please send your fix ?
Your remark about audio is interesting. We have to experiment it to see.
Thanks.

Offline

 

# 5   2010-01-26 10:01:48 circle os 3.9

ntrf.zns
Member
From: Belgorod, Russia
Registered: 2009-11-01
Posts: 134

Re: circle os 3.9

Here it is. I'm posting the whole function because i cant remember what exactly i fixed.

One aditional variable "vZ" is measurement of TOUCH_R - sometimes it other than 0. This will reqire modification in adc.c. But if you remove it as if vZ always 0 it will still work.
"vs32" = "volatile s32" is there only for ease of debuging.

Code:

/*******************************************************************************
*
*                                TOUCHSCR_Handler
*
*******************************************************************************/
/**
*
*  Called by the CircleOS scheduler to manage the touchscreen.
*
*  @attention  This function must <b>NOT</b> be called by the user.
*
**/
/******************************************************************************/
void TOUCHSCR_Handler()
    {
    static s32 divider_coord = 0;
    s32 i;
    vs32 vX = 0;
    vs32 vY = 0;
    vs32 vT = 0;
    vs32 vZ = 0;
    vs32 vRef = 0;
    vs32 X, Y, T, q;

    // Don't execute, if it's not time
    if ( ( divider_coord++ % Max_cnt_ts) != 0 )
        return;

    // Mean value out of ADC_NB_SAMPLES samples 
    for (i = 0; i < ADC_NB_SAMPLES; i++)
        {
        vRef += (u32)(ADC_ConvertedValue[2 + i*ADC_NB_CHANNELS]);
        vX += (u32)(ADC_ConvertedValue[OFS_CHANNEL_TS + 0 + i*ADC_NB_CHANNELS]);
        vT += (u32)(ADC_ConvertedValue[OFS_CHANNEL_TS + 1 + i*ADC_NB_CHANNELS]);
        vY += (u32)(ADC_ConvertedValue[OFS_CHANNEL_TS + 2 + i*ADC_NB_CHANNELS]);
        vZ += (u32)(ADC_ConvertedValue[OFS_CHANNEL_TS + 3 + i*ADC_NB_CHANNELS]);
        }    
    vRef /= ADC_NB_SAMPLES;
    vX = vX / ADC_NB_SAMPLES;
    vT = vT / ADC_NB_SAMPLES;
    vY = vY / ADC_NB_SAMPLES;
    vZ = vZ / ADC_NB_SAMPLES;

    // Conversion voltage => points
    q =    (4096-vT);
    X =    (4000*(vX-vZ)) /q;
    Y =    (4000*(vT-vY)) /q;
    T =    (4000*(vT-vX)) /q;

    // See if touch press
    TOUCHSCR_Info.TouchPress = ( vT < TS_Sensibility );
    if ( TOUCHSCR_Info.TouchPress )
    {

        TOUCHSCR_Info.xRaw = X; 
        TOUCHSCR_Info.yRaw = Y;

        // Correction
        Y = ( (  8583 * Y) - (   147 * X ) - 1088093 ) / 100000;
        X = ( ( 10960 * X)                 -  821752 ) / 100000;

        if ( X < 0 ) X = 0;
        if ( Y < 0 ) Y = 0;

        // Adapt coordinates versus screen position
        s32 x2=0, y2=0;
        switch ( LCD_GetScreenOrientation() )
        {
        case V12:           
            x2 = X;
            y2 = Y;
            break;
        case V9:
            x2 = (160-Y) - 32;
            y2 = X;
            break;
        case V3:
            x2 = Y ;
            y2 = 128 - X;
            break;
        case V6:
            x2 = (128 - X);
            y2 = (160 - Y) - 32;
            break;
        }

        // Update global structure for diffusion 
        TOUCHSCR_Info.xAbsPos = X;
        TOUCHSCR_Info.yAbsPos = Y;
        TOUCHSCR_Info.xPos = x2;
        TOUCHSCR_Info.yPos = y2;
        
        // Reset stanby time-out 
        PWR_RESET_TIME();
        PWR_SET_TIME();

    }
    else
    {
        TOUCHSCR_Info.xAbsPos = -1;
        TOUCHSCR_Info.yAbsPos = -1;
        TOUCHSCR_Info.xPos = -1;
        TOUCHSCR_Info.yPos = -1;

    } // End if touchpress


    switch( TOUCHSCR_Info.Mode )
    {
    case TS_CALIBRATION: 
        TOUCHSCREEN_Calibration();
        break;
    case TS_DRAWING: 
        if ( Y < 132 )  // Discard buttons
            TOUCHSCREEN_Drawing();
        break;
    case TS_NORMAL:
    default:
        break;
    }
    
} // End of touchscreen handler

As for audio - read my post named "pointer jumping in test mode ...". I hope you can find the reason of that behaviour. It also appears in factory CircleOS so it's not because of my fix.

This was intended to be part of "Circle+" - the extended version of CircleOS supporting only Primer2 and it's touchscreen. I hope anyone can find the solution to audio problem.

Good luck.

Offline

 

# 6   2010-01-30 12:54:15 circle os 3.9

mdvtec
New member
From: Malaysia
Registered: 2009-12-23
Posts: 2

Re: circle os 3.9

ntrf.zns Thanks your great

Offline

 

# 7   2010-01-30 21:47:08 circle os 3.9

ntrf.zns
Member
From: Belgorod, Russia
Registered: 2009-11-01
Posts: 134

Re: circle os 3.9

mdvtec, did it work for you as-is? I expected the linear correction coefficients should be different for anyone else.

Plus i forgot to remove those two lines:
        TOUCHSCR_Info.xRaw = X;
        TOUCHSCR_Info.yRaw = Y;
No such fields exist in TOUCHSCR_Info structure. I only used them for debug, so i can monitor the calculaded coordinates for last stage.

Anyway i'd like to hear opinions about my code. Especialy about including it in any other projects wink

Offline

 

# 8   2010-02-01 07:42:29 circle os 3.9

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: circle os 3.9

Hi ntrf.zns,

I'm very surprised that you do not use calibration coefficients in your code. Your handler seems like old versions. From which CircleOS version did you start ?

Offline

 

# 9   2010-02-01 14:31:12 circle os 3.9

ntrf.zns
Member
From: Belgorod, Russia
Registered: 2009-11-01
Posts: 134

Re: circle os 3.9

Hello, yrt.

I've started from CircleOS 3.8. I also read migration guide for CircleOS 3, so i had a small understanding about how evrything is implemented. Altough Primer's touchscreen connection is somthing you never see in any article about touchscreen i managed to understand it. As i compared my formulas to CircleOS code i noticed wrong order of variables usage. After trying my own math i suddenly got linear response (i used rawX and rawY fields + UWindows custom calibration to check it).

All calibration-related ifs were erased as a proof of concept - it can have linear response.
Actualy i spent some time to get coefficients for this two lines:

Code:

        Y = ( (  8583 * Y) - (   147 * X ) - 1088093 ) / 100000;
        X = ( ( 10960 * X)                 -  821752 ) / 100000;

and i DON'T expect those to work for everyone else.

That's why i'm asking everyone: did it work for you?

Offline

 

# 10   2010-02-02 08:34:07 circle os 3.9

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: circle os 3.9

Hi ntrf.zns,

I quickly tried your code on 2 Primer2.

For the first one I just modified the Y coeff like that :
        Y = ( (  7583 * Y) - (   147 * X ) - 1088093 ) / 100000;
        X = ( ( 10960 * X)                     -  821752 ) / 100000;

And for the second one, your coeff was fine.

For your information, the used method for Primer touchscreen is inspired from AN2173 Cypress application note, and was easier to implement that classical method.

Thanks for your work !

Yves

Last edited by yrt (2010-02-02 08:39:17)

Offline

 

# 11   2010-02-02 20:51:17 circle os 3.9

ntrf.zns
Member
From: Belgorod, Russia
Registered: 2009-11-01
Posts: 134

Re: circle os 3.9

I agree. It's simplier to implement this than two-stage method.

I've compared my code with AN2173. Seems like my vT and vY coefficients swaped and T calculation is comletely wrong.

Code:

    q =    (4096-vT);
    X =    (4000*(vX-vZ)) /q;
    Y =    (4000*(vT-vY)) /q;
    T =    (4000*(vT-vX)) /q;

Comparing with CircleOS 3.8:

Code:

    q =    (4095-vY);
    X =    (1000*   vX )  /q;
    Y =  - (1000*(vY-vT)) /q;
    T =    (1000*(vT-vX)) /q;

1) In appnote X is LEFT, Y is TOP, T BOTTOM
2) In Primer itself X is LEFT(dma 2), Y is BOTTOM (dma 3), T is TOP (dma 4)

So this is where this bug is coming from. I guess a real fix should look like:

Code:

    for (i = 0; i < ADC_NB_SAMPLES; i++)
        {
        vX += ADC_ConvertedValue[OFS_CHANNEL_TS + 0 + i*ADC_NB_CHANNELS];
        vY += ADC_ConvertedValue[OFS_CHANNEL_TS + 1 + i*ADC_NB_CHANNELS];
        vT += ADC_ConvertedValue[OFS_CHANNEL_TS + 2 + i*ADC_NB_CHANNELS];
        }

About Y coefficient: the calculated value for my unit was 7951, but in practice i had to increase this value. It seams that calibration is useful after all.

P.S. We probably need some kind of RFI (request for implementation) for next CircleOS. There is a lot of small things need to be fixed or implemented.

Last edited by ntrf.zns (2010-02-02 21:11:28)

Offline

 

# 12   2010-02-03 07:30:38 circle os 3.9

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: circle os 3.9

OK ntrf.zns,

I will try to fix it, and to implement a more classical calibration inspired from the application note.
But not yet, because I'm a little busy now !

Yves

Offline

 

# 13   2010-02-03 09:46:12 circle os 3.9

ntrf.zns
Member
From: Belgorod, Russia
Registered: 2009-11-01
Posts: 134

Re: circle os 3.9

I've checked calibration formula in appnote. Calculation of coefficient (10) is correct, but their application in (11) is wrong. The correct would be:

Code:

Xd = (A*Xt + B*Yt + C);
Yd = (D*Xt + E*Yt + F);

UWindows uses the same code for calibration calculation.

P.S.: Take your time. Maybe i'll find some more bugs before you implement it.

Last edited by ntrf.zns (2010-02-03 13:21:20)

Offline

 

Board footer