for 6410 gui

r@wboom
hello there,
i want to know how to make gui in mini6410 board.
can anybody help me in this.
i am totally new on this board.
i installed the toolchain and compiled and run some programme like adc ,i2c
all that but want to make gui for this.
so anybody help me how to start on this,which environment.
a little help give to mode to step ahead.
thanks

davef
Google search <mini2440vietnam> <qtcreator> and on this site <Qt>.

r@wboom
hello davef,
i want to know about the mini6410.i worked on mini2440 and gui is made by
trolltek.
but in mini6410....i don't know about it.
please can you help me.

davef
I would have thought that the process would be very similar for both
platforms.

http://www.sereno-labs.com/Qt_4.8.3_installation_procedure_FriendlyARM_m...

Google <tutorial mini6410 Qt>

r@wboom
@davef
very thankful to you
actually on this fourm i felt very less reply or conversation by others..
but i am very oblige you to reply ,me.
please stay touch and suggest me how to conversation with others so that i
receive more reply to my answer like raspberry pi fourm.

davef
r@wboom,

The mini2440 was quite popular 3-4 years ago but other units have come
along.  The RaspberryPi and Odroid forums have a strong user base.

The mini2440 works well for the type of work I do, but the other units have
more "up to-date" capabilities that I am not interested in.

How to get better replies?  Try to have to an interesting and specific
subject line is the only way to get attention.

Good luck

r@wboom
hello davef,
i go through the mini2440 vietnam and read the procedure...
i have a problem in this******************************
 Okay, on screen of Qt creator, choose "Tools" -> "Options". In "Options"
window, click to "Qt4" -> "Qt Version", on the right part you will see
"Auto-detected" and "Manual". Click on "Manual" and then choose plus (+)
button located on the top right, in section "Version Name" you could let
down what name you like (I typed "mini2440"). In section "QMake Location",
click on "Browse..." and you should indicate Qt creator know where the
directory of qmake is. For what i did, I choose /usr/local/Qt/bin/qmake
(That directory is generated by cross-compiled Qt4.6.2, if possible, you
can have a look cross-compiling Qt4.6.2 here). Okay, if there is no fault,
you will see a noted line of "Found Qt version 4.6.2, using mkspec
/usr/local/Qt/mkspecs/qws/linux-arm-g++" under "Debugging Helper". Click
"Ok" to complete this mission.
}}}
*********************************
i didn't found the path and qmake anywhere but my toolchain arm-linux-gcc
is installed when i see it by 
arm-linux-gcc -v command.

r@wboom
hey..
sorry i got it.
now i make a programme in this and make gui...
now how to compile this and how to dump the programme in mini6410 or
mini2440 machine....
i am using qt 4.6.2

r@wboom
davef,,,http://www.sereno-labs.com/Qt_4.8.3_installation_procedure_FriendlyARM_m...
i go to this site .....and clicked on this 


http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.....
but after that which version i have to download i didn't understand 
please help sir.

davef
Try (official releases)

qt-everywhere-opensource-src-4.8.6.tar.gz

There was a location for other older archived files if you really want
4.8.3.  You would have to search for it as I haven't used Qt for 1-2 years.

r@wboom
now i am trying to install tslib but error occurs
ceeri@ubuntu:/usr/local$ git clone https://github.com/kergoth/tslib
fatal: could not create work tree dir 'tslib'.: Permission denied
how can i solve it.

davef
Have you used git before?

If not there is something you have to download:

  sudo apt-get install git

Tutorial:

https://www.digitalocean.com/community/tutorials/how-to-install-git-on-u...

davef
Or maybe:

sudo git clone https://github.com/kergoth/tslib

r@wboom
yes sir,
i got the tslib in my download folder by using sudo git clone
https://github.com/kergoth/tslib
now how can i install it....
because in i already install git

r@wboom
and i doing the step scp -r linux-arm/ eclipse@192.168.0.50:/usr/local/
what is this address because my ip is 192.168.4.49 and proxy is 192.168.3.5
which one i put into...

http://www.simiolabs.com/developer/wiki/index.php?title=Cross-compiling_......
this is the guide which i am following

davef
> Moving the library to the SBC 

I doubt if these instructions are useful to you.

No idea of what scp  and eclipse:eclipse means.

I suggest step 3 :
http://mini2440vietnam.blogspot.co.nz/2011/04/upgrade-qt462-in-mini2440....

Was there some reason for NOT following this tutorial?

r@wboom
hey davef,
i solved it.....thanks very much for helping me...
i asked a question to you in i2c fourm about the interfacing pcf8591 adc ic
to mini6410 or mini2440...
when i see it on command line and did like it
i2cset -y 0 0x48 0x00
i2cget -y 0 0x48
when reference volt is 5v and channel votage is 5 volt it reads 0xff which
is alright 
but when i did things in the code it sees me garbage...
here is the code
***************************************************************************
#include <errno.h>
#include <linux/i2c-dev.h>
#include <string.h>            
#include <stdio.h>              
#include <stdlib.h>           
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/fs.h>
#include <errno.h>
#include <stdint.h>
#include <getopt.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/spi/spidev.h>
# include <termio.h>
# include <time.h>
# include <string.h>
# include <sys/time.h>
extern int errno;
int main(void)
{
fprintf(stderr,"ctrl-Z to stop\n");

int fd=open("/dev/i2c/0",O_RDWR);
if(fd<0)
{
printf("not working\n");
}
else 
printf("I2C working\n");

int buf[10];
int buff[100];
int read1,i,value,io,wbyte;
int errnum;
float temp;
buf[0]=0x48;            //adc write mode.
buf[1]=0X00;           //adc channel selected(control byte)
buf[2]=0x90;           //
errnum=errno;
io=ioctl(fd,I2C_SLAVE,0x48);    //check i2c status.
if(io<0)
{
printf("error ioctl\n");
}
else
{
wbyte=write(fd,buf,3); 
}          
if(wbyte!=3)
{
fprintf(stderr,"value of errno %d\n",errno);
printf("error write:%d\n",wbyte);
perror("write\n");
fprintf(stderr, "Error opening file: %s\n", strerror( errnum ));

}             // write all three control word to arm 
usleep(1*1000);

read1=read(fd,buff,10);
usleep(1*1000);
for(i=0;i<=9;i++)
{
//value=(buff[i]*5)/255;
//temp=(value*1000)/10;
//printf("value in volts=%d\n",value);
printf("buffer value=%d\n",buff[i]);
}
close(fd);
return 1;
}
********************************************************************************
**********************************************************************
please help why it is happening.??

davef
> but when i did things in the code it sees me garbage...

Doesn't make much sense to me.  Did what things?

> when reference volt is 5v and channel votage is 5 volt it reads 0xff
> which is alright

By channel voltage do you mean the input voltage, ie the voltage you are
trying to measure?

Maybe if you show us the "garbage".

r@wboom
the channel voltage mean pcf8591 input voltage at channel 0.
which i gave it to 5v.
here is command linbe o/p 

[root@FriendlyARM /]# ./i2cset -y 0 0x48 0x00
[root@FriendlyARM /]# ./i2cget -y 0 0x48
0xff
[root@FriendlyARM /]# ./i2cget -y 0 0x48
0xff
[root@FriendlyARM /]# ./i2cget -y 0 0x48
0xff
[root@FriendlyARM /]# ./i2cget -y 0 0x48
0xff

and here is the code output when i run the above code.

[root@FriendlyARM /]# ./adc
ctrl-Z to stop
I2C working
buffer value=-1
buffer value=-1
buffer value=65535
buffer value=0
buffer value=0
buffer value=1074454528
buffer value=-512
buffer value=-188
buffer value=1074454016
buffer value=33235

which is unexpacted...
please suggest what should i do...

davef
So, for a constant 5V on the input you get different values every how many
seconds?

I suggest that you are not reading the ADC but some ADC input port that is
"floating", ie does not have a constant voltage on it.

r@wboom
@davef,
thank you davef...
i got the o/p because i took the buffers as int type that was the problem.
but when i gave it 1.8 volt the o/p is 1.00000 not accurate...why??
second thing which is adc0 pin in mini6410 board..i seen in the mini6410
pdf but no descreption about that...
so can you please tell me.

r@wboom
and if you know about how to insatll kernel qtopia on mini6410 because i
work on default when i bought it

r@wboom
hello davef,
i have the o/p like this...

 I2C IS WORKING 
buff len 0buff value 201
ADC VALUE: 3.000000
buff value 201
ADC VALUE: 3.000000
buff value 201
ADC VALUE: 3.000000
buff value 201
ADC VALUE: 3.000000
buff value 201
ADC VALUE: 3.000000
buff value 201
ADC VALUE: 3.000000

when value is 3.5 volt.
and here is the code
********************************************************************************
**********************************************************************
//************************************************INCLUDING
HEADERS****************************************************************//
#include <errno.h>
#include <linux/i2c-dev.h>
#include <string.h>            
#include <stdio.h>              
#include <stdlib.h>           
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/fs.h>
#include <errno.h>
#include <stdint.h>
#include <getopt.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/spi/spidev.h>
# include <termio.h>
# include <time.h>
# include <string.h>
# include <sys/time.h>
//*******************************************STARTING THE MAIN
FUNCTION**********************************************//
int main()
{
int fd=open("/dev/i2c/0",O_RDWR);
if (fd<0)
{
printf("\n NOT ABLE TO OPEN THE DRIVER \n");
}
else
{
printf("\n I2C IS WORKING \n");
}
char buf[100];                                         // BUFFER used for
adc control word 
char buff[100];                                        // BUFFER used for
adc read 
float valuee,m1;                                      // variable used for
data transfer from subroutine to main
int i=0;
int  io, wbyte,rbyte;
//********************************************************I2C DETECT AND
I2C READ****************************************************//
buf[0]=0x48;                                   // sending control word to
adc for write mode in ch=0
buf[1]=0x00;                                   // I2C adress for arm on
which adc connected                                 
buf[2]=0x91;                                   // control word for adc set
in to read mode
io=ioctl(fd,0x703,0x48);                       // adress for arm for i2c
communication
if(io<0)
{
printf("error ioctl\n");
}
else
{
wbyte=write(fd,buf,3);                        // write all three control
word to arm 
usleep(1*1000);
if(wbyte!=3)
{
printf("error write:%d\n",wbyte);
}
rbyte=read(fd,buff,10);
printf("buff len %d",buff[rbyte]);                      // read 10 bytes
from adc 
usleep(10*1000);
for(i=0;i<=5;i++)
{                                            // average and conversion in
to voltage
valuee=(buff[i]*5)/255;
m1=m1+valuee;
printf("buff value %d\n",buff[i]);
printf("ADC VALUE: %f\n",valuee);
}
m1=m1/5;
close(fd);
return 1;
}
}
//******************************************************************************
*******************************************************************//
why it is not read 3.457 like this??
where is the problem.

davef
FYI, I have never worked with the mini6410.

> why it is not read 3.457 like this??

Maybe, because the scaling is not correct or you are not using the same
reference voltage.

1.8V reads 1.0V
3.457 reads 3.0V

seems close

Try some other voltages to see how it tracks.

r@wboom
Attachment: hello.cpp (1.24 KB)
hello again davef,
i am building a code for adc gui n here is the code i do....
**********************************************************************#include
"hello.h"
#include <qlabel.h>
#include <qpushbutton.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <linux/fs.h>
#include <errno.h>
#include <string.h>
#include <qobject.h>
#include <fstream>
char buffer[30];
HelloForm::HelloForm( QWidget* parent, const char* name, WFlags fl)
                    :HelloBaseForm(parent, name, fl)
{
connect(PushButton1,SIGNAL(clicked()),this,SLOT(startadc()));
connect(PushButton2,SIGNAL(clicked()),this,SLOT(stopadc()));
}
HelloForm::~HelloForm()
{
}
//code for getting the adc//
int HelloForm::getadc()
{
int value=-1;
int n=0;
int a;
int fd=open("/dev/adc",0);
if(fd<0)
{
Message->setText("error file");
}
int len = read(fd, buffer, sizeof buffer -1);

if (len > 0 ) 

{
  buffer[len] = '\0';
        
  
sscanf(buffer, "%d", &value);
a=(3.3*value)/1024;
n=a;
}
return(value);
}
//Button code for Adc start//

void HelloForm::startadc()
{
char conv_buffer0[10];
int i = 0;
float adc_val_ch0=0;
for (i =0;i <5;i++)
{
adc_val_ch0 = getadc();
snprintf(conv_buffer0,10,"%f",adc_val_ch0);
  ADC_0->setText(conv_buffer0);
}
}
void HelloForm::stopadc()
{
  //int a = 0;
  Message->setText("Stopped");
ADC_0->setText(" ");
}
********************************************************************************
**********************************************************************
and the ui file i atteched to you..but when i run the gui it shows me only
0.000000 value why???

davef
****
a=(3.3*value)/1024;
n=a;
}
return(value);
}
****

This function will always return -1.  Don't you want it to return a ?

n=a;  Do you use n somewhere?

r@wboom
opps!!!
i did it as you told me...
but still it display me 0.0000.

davef
Next I would display the value the ADC is returning directly from /dev

Are you sure it is /dev/adc ?  I would have thought there would be a
following number, ie /dev/adc4 or ?

What do you see if you do:

  ls /dev/adc*

When you find the right ADC then do:

 cat /dev/adcx (x being the number you want to display)

davef
Which touchscreen are you using?  The mini2440 earlier variants used adc0,
adc1, adc2 and adc3 for the touchscreen.

r@wboom
hello davef,
i am using a70 with it..
it is working fine but when i start adc and twist the port i doesn't change
the value
but when i press stop button and again press start button it shows the
actual value.....
mean to say it doesn't change the value with twisting the pot.

davef
So, the A70 is a resistive touchscreen not a 1-wire touchscreen?

> but when i press stop button and again press start button it shows the
> actual value..... 

Do you mean if you set the pot, say 1/2 way and press stop and again press
start it will read a certain value?  Then if you move the pot to another
position and press stop and again press start it will read another value?

If that what is happening then perhaps the code is written to only read the
ADC value when you press the start button.  Sounds reasonable to me.

If you want it to continuously update the value, say every second, then you
will need a loop to tell your program that "you have pressed the start
button".  You might need to handle a "stop the ADC" condition as  well.

r@wboom
hi davef,
thanks for it...
i did as you told me here is the code which i have use the loop
**************************************************************************vvoid
HelloForm::startadc()
{
while(1)
{
char conv_buffer0[10];
int i = 0;
float adc_val_ch0=0;
for (i =0;i <5;i++)
{
adc_val_ch0 = getadc();
snprintf(conv_buffer0,10,"%f",adc_val_ch0);
  ADC_0->setText(conv_buffer0);
}
}
void HelloForm::stopadc()
{
  //int a = 0;
  Message->setText("Stopped");
ADC_0->setText(" ");
}
*************************************************************************
but the programme hangs out in gui when press the start button.......
so plzz give me any idea...

davef
First let's clean up the formatting ...


HelloForm::startadc()
{
   while(1)
   {
      char conv_buffer0[10];
      int i = 0;
      float adc_val_ch0 = 0;

      for (i = 0;i < 5;i++)
      {
         adc_val_ch0 = getadc();
         snprintf(conv_buffer0, 10, "%f", adc_val_ch0);
         ADC_0 -> setText(conv_buffer0);
      }
   }
}

oops, I had to add another closing brace!

Did the program compile correctly?
Did you see anything displayed?

r@wboom
yes!!!
this compile successfully without any error and warning.
but when i push the start button it goes hang....mean no value..and no
button works.

davef
A helpful debugging technique for people without proper debug tools goes
like this:

sprinkle print statements through the code to determine how far you get
before it "falls-over".  Flashing a LED is a common technique when working
on a microprocessor.

The fact that you could get it to display one value by pressing stop and
then start seems to indicate that something was almost working.  Make sure
it behaves like this when you take the loop back out.

Good luck!