Search

Technical Discussion Group Forum

This forum is provided for user discussion. While Beacon EmbeddedWorks support staff and engineers participate, Beacon EmbeddedWorks does not guarantee the accuracy of all information within in the Technical Discussion Group (TDG).

The "Articles" forums provide brief Articles written by Beacon EmbeddedWorks engineers that address the most frequently asked technical questions.

To receive email notifications when updates are posted for a Beacon EmbeddedWorks product download, please subscribe to the TDG Forum of interest.

TDG Forum

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 11 Aug 2007 06:05 AM by  sygi@canbus.pl
5329EVB LogicPD 6.4 touchscreen and nano-X (microwindows)
 18 Replies
Sort:
You are not authorized to post a reply.
Author Messages
dwilson
New Member
New Member
Posts:


--
18 Dec 2006 03:08 PM
    Has anyone had any success with the LogicPD 6.4" Sharp touchscreen and uClinux 7843 touchscreen driver? I have added a bunch of printk statements to the driver so I can see on the serial terminal output that I am getting values when touching the touchscreen. My values were very sporadic so I modified the driver to drop the three least significant bits and created a rolling average. It is better, but I do not get any reponse from nano-X using the nxcal program or any of the sample programs.

    Thanks for any information.

    Don
    dwilson
    New Member
    New Member
    Posts:


    --
    19 Dec 2006 03:41 PM
    I think I have found the problem that the Nano-X executable that is in the root filesystem is not configured for any mouse, touch screen input, or keyboard input. There is a "config" file to specify the input options for Nano-X when it is compiled.

    I have made several attempts to rebuild the Nano-X executables. The LTIB utility does not appear to be setup to rebuild nano-X. I have placed the nano-X source in a folder and applied the patches to it. I get a successful build with just the “make” command line, but obviously this is an MMU build so when I try to run this on the 5329 I get a BINFMT error. I tried “make ARCH=m68knommu” and this will compile several of the modules but gives an error srvmain.c:(.text_0x3b9): undefined reference to ‘GsSelect’. I find a precompiler condition is preventing this function from existing. By added “#define UNIX 1” to the top of srvmain.c I can get past this. However, then I run into libmengine.a(devfont.o): In function ‘GdCreateFont’:devfont.c undefined reference to ‘strcmpi’. I am struggling with this now. Any help in how to setup my environment to build Nano-X for the 5329 would be appreciated.
    ashwinb@logicpd.com
    New Member
    New Member
    Posts:


    --
    21 Dec 2006 08:33 AM
    I think you will get a lot more informative answers from the Nano-X mailing list located at: http://www.linuxhacker.org/nanogui/

    Regards
    harpercn
    New Member
    New Member
    Posts:


    --
    10 Jan 2007 09:28 AM
    Don,

    You can modify the nano-X source files using the ltib prep, scbuild, scdeploy cycle


    ./ltib -p microwindows -m prep
    (makes a copy of the source files in rpm/BUILD/microwindows/src edit the config file here)

    ./ltib -p microwindows -m scbuild
    ./ltib -p microwindows -m scdeploy
    (compiles and deploys into the rootfs)

    In this case microwindows is the same things as nano-X. Originally there was microwindows and nano-X, but Microsoft wasn't too keen on someone using microwindows. Now everything is nano-X, but there is still some legacy naming around.


    I've seen the same trouble with the touch screen driver reporting coordinates incorrectly. I would love to see your modified touch screen driver code if possible.

    Best Regards,
    Caleb
    dwilson
    New Member
    New Member
    Posts:


    --
    22 Jan 2007 03:35 PM
    Hi,

    I did finally get this to work, though accuracy is still not very good. Using ltib to build and deploy the package is much smoother than what I was doing before.

    The biggest problem I had with nano-X was that when I changed the config file to enable mouse or touchscreen and rebuilt it is was still not linking in the appropriate driver. I finally found that libmwengine.a was not getting rebuilt for some reason. After deleting this file and rebuilding it is working.

    I modified the ads7843.c from the board support package. In the ads7843_rx function I added:

    static int xhist[20] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    static int yhist[20] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    static int nhistpos = 0, xwnd = 0, ywnd = 0;
    static int nhistcnt = 0;
    long xtot, ytot;
    static int x_avg, y_avg;
    int ntmp, ntmppos;
    static int prev_down = 0;


    Because my numbers were so jumpy I decided to cut off the two least significant bits:

    ts->tc.x = (ts->received_xa[1]<<8) + (ts->received_xa[2] & 0xE0);
    ts->tc.y = (ts->received_ya[1]<<8) + (ts->received_ya[2] & 0xE0);


    x = be16_to_cpu(ts->tc.x) >> 3;
    y = be16_to_cpu(ts->tc.y) >> 3;

    if(ts->pendown)
    {
    xhist[nhistpos] = x;
    yhist[nhistpos] = y;
    if(nhistcnt < 20)
    nhistcnt++;
    ntmppos = nhistpos;
    xtot = 0L;
    ytot = 0L;
    for(ntmp = 0; ntmp < nhistcnt; ntmp++)
    {
    xtot += xhist[ntmppos];
    ytot += yhist[ntmppos];
    if(ntmppos == 0)
    ntmppos = 19;
    else
    ntmppos--;
    }

    if(nhistpos == 19)
    nhistpos = 0;
    else
    nhistpos++;

    x_avg = xtot / nhistcnt;
    y_avg = ytot / nhistcnt;
    }
    else
    {
    nhistpos = 0;
    nhistcnt = 0;
    }


    This got me to the point of moving the cursor around. The BTN_TOUCH doesn't seem to do any thing in my configuration so I modified to this:

    if (!Rt && ts->pendown)
    {

    // input_report_key(input_dev, BTN_TOUCH, 1); // DW 2007-01-11
    if(nhistcnt >= 10)
    {

    if(prev_down == 0)
    {
    printk("** DW ** input_report_key BTN_LEFT %d\n", 1);

    input_report_key(input_dev, BTN_LEFT, 1);
    input_report_key(input_dev, BTN_RIGHT, 0);
    input_report_key(input_dev, BTN_MIDDLE, 0);
    input_report_key(input_dev, 275, 0);

    prev_down = 1;
    }

    input_report_abs(input_dev, ABS_X, 4400 - ((y_avg * 16) / 13)); // DW
    input_report_abs(input_dev, ABS_Y, ((x_avg * 11) / 9) - 450);

    input_report_key(input_dev, BTN_TOUCH, 100); // DW 2007-01-11

    sync = 1;
    }

    // sync = 1;
    }
    else
    {
    if(prev_down == 1)
    {
    prev_down = 0;

    printk("** DW ** input_report_key BTN_LEFT %d\n", 0);

    input_report_key(input_dev, BTN_LEFT, 0);
    input_report_key(input_dev, BTN_RIGHT, 0);
    input_report_key(input_dev, BTN_MIDDLE, 0);

    input_report_key(input_dev, 275, 0);

    input_report_abs(input_dev, ABS_X, 4400 - ((y_avg * 16) / 13)); // DW
    input_report_abs(input_dev, ABS_Y, ((x_avg * 11) / 9) - 450);

    input_report_key(input_dev, BTN_TOUCH, 0); // DW 2007-01-11

    sync = 1;
    }
    }


    if (sync)
    input_sync(input_dev);


    Now it basically acts like a lift click and release. This is working now so that Nano-X applications that show buttons operate by finger pretty well which is what we are going for. If I try a demo like landmine with the stylus it is difficult to always hit the correct cell.

    I will still be looking to improve this. I'm interested in anyone else's experiences. We may have some hardware issues causing the poor response, but it is the standard 5329EVB and LogicPD 6.4 Sharp display touchscreen.

    Don
    harpercn
    New Member
    New Member
    Posts:


    --
    23 Jan 2007 09:39 AM
    Don,

    I found an application note published by TI called 'Touch Screen Controller Tips' http://focus.ti.com/gener...abstractName=sbaa036

    They have a couple of strategies for improving touch screen accuracy, and I'm going to try them when I have a chance. I also noticed 10 nf caps on all of the touch screen lines, and I'm not sure there is currently adequate settling time for the touchscreen

    I've written a couple of simple char device drivers, but I'm having trouble understanding the spi driver they use for the ads7843. Do you have any reccomendations for resouces that might help?

    Also, which driver did you enable in the nano-X config file, and how is the information passed between the driver and nano-X?

    Thanks for your help and best regards,
    Caleb
    dwilson
    New Member
    New Member
    Posts:


    --
    25 Jan 2007 03:35 PM
    Caleb,

    Thanks for the information. I'm new at this. I don't really understand the SPI driver. I just started by finding the 7843 driver and adding printk statements to see what values were showing up. It seems that uClinux initializes this driver as a pointing device such as a mouse /dev/psaux. I found that when I set the config file for nano-X to just enable mouse SERMOUSE, and not enable touchscreen, the touchscreen still works. In fact I can plug in a USB mouse and either can be used to move the cursor around. I tried the config file option for ADS7846MOUSE and looking at the nano-X driver for this it tries to open /dev/innovator_ts which fails on my system. I am still looking into this because I cannot get the nxcal calibrator to work. To get reasonable accuracy for my testing I altered the values being based from the 7843 driver with input_report_abs:

    input_report_abs(input_dev, ABS_X, 4400 - ((y_avg * 16) / 13)); // DW
    input_report_abs(input_dev, ABS_Y, ((x_avg * 11) / 9) - 450);

    The multiplication and division is to scale the values avoiding floating point.

    I bought the book "Embedded Linux Primer" by Christopher Hallinan. I am learning from it, although it has no content on uClinux, it seems to be oriented to ARM and other architectures with MMUs. I found the downloadable book "Linux Device Drivers 2nd Edition", but I can't recall now where I found that. There is also so information on http://www.timesys.com that I found helpful. I believe they provide a login for free access to some of the content for a limited time.
    will_synchro
    New Member
    New Member
    Posts:


    --
    22 Feb 2007 10:10 AM
    Hi,

    I'm new working with the M5329EVB and I have a Sharp LCD-3.5-QVGA-20 Display. I've enabled microwindows in the LTIB menu and I've run some demo but the picture is not very good. I would like to know where did you find the nano-X sources so that I could try to modify it. I only see .sh file and I saw that you are programming in C.

    I'll appreciate your help.
    Best regards,

    William
    harpercn
    New Member
    New Member
    Posts:


    --
    22 Feb 2007 03:03 PM
    William,

    The image was initially very bad on my LCD as well. I've only used the 6.4 inch logic display, but I can tell you what I did to make it work with uCLinux.

    First, I had to modify the frame buffer driver. The HSYNC and VSYNC signals needed tweeked. You can find the proper values for these on the data sheet for the 3.5 LCD.

    Next, I modified the nano-X configuration file. The 6.4 LCD used 18 bits per pixel color encoding, but nano-X was configured for 32 bits per pixel. With these changes, the screen looked pretty good.

    To modify the source files, use the ltib prep, build, deploy sequence I posted about earlier in this thread. to modify the frame buffer driver, use

    -p kernel-2.6.16.1-uc0 instead of -p microwindows


    Good Luck,
    Caleb
    will_synchro
    New Member
    New Member
    Posts:


    --
    23 Feb 2007 07:16 AM
    Hi Caleb,

    Yes, but where did you find the frame buffer driver and I don't see what you mean by "HSYNC and VSYNC signals needed tweeked".

    Best regards,
    William
    harpercn
    New Member
    New Member
    Posts:


    --
    23 Feb 2007 08:27 AM
    ./ltib -p kernel-2.6.16.1-uc0 -m prep
    This makes a working copy of the kernel source files.

    <ltib>/rpm/BUILD/linux-2.6.16/drivers/video/m532xfb.c
    This is the frame buffer source file. I had to modify fb_wait_params for the LCD. This array contains the HSYNC, VSYNC, and their respective wait timing settings. These values were wrong for my LCD and I set them using the LCD data sheet. These values, combined with Pix_Clk_Div set the refresh rate of the screen. The refresh rate on my screen was too slow, so I made PiX_Clk_Div smaller.

    ./ltib -p kernel-2.6.16.1-uc0 -m scbuild

    ./ltib -p kernel-2.6.16.1-uc0 -m scdeploy

    Boot your fresh kernel and take a gander. Keep modifying m532xfb.c and using scbuild and scdeploy until the screen looks good, then use

    ./ltib -p kernel-2.6.16.1-uc0 -m patchmerge
    to commit your changes
    will_synchro
    New Member
    New Member
    Posts:


    --
    26 Feb 2007 03:47 AM
    Caleb,

    I'm sorry but it doesn't work.
    The first command : ./ltib -p kernel-2.6.16.1-uc0 -m prep is not working.
    I have the following error:

    Cannot find spec file that contains the package name kernel-2.6.16.1-uc0
    ...
    Exiting on error or interrupt



    Besides, I also have a new version of kernel : kernel-2.6.17.7-uc1 and I still have the error :

    Cannot find spec file that contains the package name kernel-2.6.17.7-uc1
    ...
    Exiting on error or interrupt



    Best regards,
    William
    dwilson
    New Member
    New Member
    Posts:


    --
    05 Mar 2007 07:57 AM
    I just use -p kernel and it seems to work for me.

    Initially:

    ./ltib -m prep -p kernel

    After changing the source:

    ./ltib -m scbuild -p kernel

    ./ltib -m scdeploy -p kernel

    Don
    will_synchro
    New Member
    New Member
    Posts:


    --
    10 Apr 2007 10:21 AM
    Hi,


    I'm still working with the MCF5329EVB and a Sharp LCD display 3.5
    I've succeeded in displaying a picture with nano-X, but now I would like to use the touchscreen controller. I saw that the ads7843.c is used... but it doesn't seem to be used by the BSP... For instance, I tried to run the demo landmine but nothing happens when I hit the screen.

    In the kernel configuration, I've enabled the touchscreen device and chose ADS 7843 based touchscreen

    In tera term, at the prompt(#) I do :

    #/usr/nanox/bin/nano-X &
    #/usr/nanox/bin/npanel &
    #/usr/nanox/bin/landmine

    The demo is running, but the touch screen doesn't work. I may forget something... I don't know.
    I'll appreciate your help

    Best regards,
    William
    harpercn
    New Member
    New Member
    Posts:


    --
    10 Apr 2007 11:31 AM
    William,

    In my kernel configuration, I have the the following checked:

    Mouse interface
    Provide legacy /dev/psaux device
    Touchscreen interface
    ADS 7843 based touchscreen

    It might not be necessary to have all of these, I don't know. With these settings, the touchscreen information comes through the /dev/psaux driver. If things are setup correctly, you should be able to type 'cat /dev/psaux' touch the screen, and see some gibberish come out on the Linux terminal.

    From here, I set 'SERMOUSE = Y' in the nano-x config file. If a mouse isn't set, there won't be a cursor displayed in nano-X. This allowed me to move the mouse around in nano-X. The accuracy was terrible and I had to rework the ads7843.c file, but you might have better luck. I can clean my code up and post it if you would like.

    I have a feeling there are better ways to do it, but this way has worked well for me.

    Good Luck,
    Caleb
    will_synchro
    New Member
    New Member
    Posts:


    --
    18 Apr 2007 03:45 AM
    Caleb,

    I see that you are using a mouse with the touchscreen controller. In my application, I won't be needing to use a mouse. The touchscreen will be the only input device. I did the same thing except enabling the mouse interface.

    So the touchscreen information comes through the /dev/event0 driver and when I type 'cat /dev/event0' and touch the screen, I see other kind of gibberish on the linux terminal but still gibberish.

    Anyway, did you try to run a demo using the touchscreen controller ?
    like /usr/nanox/bin/nxkbd for example.
    I have the following error:
    nxclient: no shared memory support on server
    I'm trying to find a way to correct that

    You told me that you had reworked the ads7843.c file, yes I would love to see it. It could help me.

    Best regards,
    William
    will_synchro
    New Member
    New Member
    Posts:


    --
    19 Apr 2007 04:25 AM
    Caleb,

    Something I forgot to ask. How did you install microwindows ? Did you just check microwindows in the package list that is the ltib config menu ? Or did you take it from internet ?
    Because me, I checked it in the package list but I don't have any microwindows directory in ltib/rpm/BUILD so I cannot modify the nano-X config file.

    Best regards,
    William
    will_synchro
    New Member
    New Member
    Posts:


    --
    19 Apr 2007 07:06 AM
    Hi,

    I found why I didn't have microwindows in rpm/BUILD directory. I did not install it correctly because I kept using the first syntax that you post before that is :
    ./ltib -m microwindows -p prep
    this was wrong

    It is:
    ./ltib -m prep -p microwindows

    I see that you've corrected after but I didn't notice it.
    Let me know if you have any news about the touchscreen controller.

    Best regards,
    William
    sygi@canbus.pl
    New Member
    New Member
    Posts:


    --
    11 Aug 2007 06:05 AM
    Hi All. I have strange problem with ADS7843 and my TS (AMPIRE-AM320240) on uClinux. TS is working but cursor is moving on diagonal path (approximately) when I move my finger in X or Y axis. I checked values returned by TS driver at corners, and those coordinates does not represent square (much like triangle or trapeze).

    What can I do with this ??. Any sugesstions ??
    You are not authorized to post a reply.