ts-7000
[Top] [All Lists]

Re: [ts-7000] Re: TS-7260 Application

To:
Subject: Re: [ts-7000] Re: TS-7260 Application
From: Jim Jackson <>
Date: Tue, 3 Jul 2007 11:17:42 +0100 (BST)


On Mon, 2 Jul 2007, kurmannthomas wrote:

> ............... Another thing...speed
> issue, im not getting more than 100 Samples per second out of the TS-
> 7260, even with USB turned of etc..im using the #include <sys/time.h>
> with a timer interval of 5000 uSec which should be 200 Sps..but
> somehow its not running faster...is this board just so slow (which is
> hard to believe with 200 Mhz)..see my code attached :)

Don't need it. This is a FAQ.

The system timer resolution is 10msec (HZ=100)

You can recompile your kernel with a higher HZ value to improve the
timer resolution. This is standard linux - google is your friend.

Alternatively you could use a kernel driver that does its own timer
interrupts.

Phillip McCarley wrote a driver for reading samples from the MAX179 ADC
but it could be adapted. The source code used to be on the Yahoo group
"files" section for this list. If not yell on list and if Phil isn't
around I'll send you the version I have.

>
> Thanks alot
>
>
>
> **********************************************************************
> #include <signal.h>
> #include <stdio.h>
> #include <string.h>
> #include <sys/time.h>
> #include <sys/socket.h>
> #include <sys/types.h>
> #include <arpa/inet.h>
> #include <netinet/in.h>
> #include <usb.h>
> #include <unistd.h>
>
> void timer_handler (int signum);
> int create_socket;
> char return_buf[3];
> char message[3];
> struct usb_dev_handle* usb_handle;
> int count;
> char count2[1];
>
>
>
>
>
>
> void open_socket()
> {
>    struct sockaddr_in address;
>
>    if((create_socket = socket(AF_INET,SOCK_STREAM,0)) > 0)
>
>    setsockopt(create_socket,0,SO_KEEPALIVE,0,1);
>    address.sin_family = AF_INET;
>    address.sin_port = htons(15000);
>
>    inet_aton("192.168.0.100", &address.sin_addr);
>
>    if(connect (create_socket,(struct sockaddr *) &address, sizeof
> (address) ) ==0);
> }
>
>
>
>
>
>
> void timer_handler (int signum)
> {
>
> count++;
> int state;
> message[0] = 0xCF;
> long int i;
>
>
> state = usb_bulk_write(usb_handle,0x01,message,1,1);
>  printf("Bytes transfered %i \n",state);
>
> state = usb_bulk_read(usb_handle,0x01,return_buf,10,1);
> printf("%i %i\n",return_buf[1], return_buf[2]);
>
>  count2[0] = count;
> // send(create_socket,count2,1,MSG_NOSIGNAL);
> printf("%i\n",count);
>
>
>
>
>
> }
>
> void Init_Timer()
> {
>
> struct sigaction sa;
>  struct itimerval timer;
>
>  /* Install timer_handler as the signal handler for SIGVTALRM. */
>  memset (&sa, 0, sizeof (sa));
>  sa.sa_handler = &timer_handler;
>  sigaction (SIGVTALRM, &sa, NULL);
>
>  /* Configure the timer to expire after 250 msec... */
>  timer.it_value.tv_sec = 0;
>  timer.it_value.tv_usec = 1;
>  /* ... and every 250 msec after that. */
>  timer.it_interval.tv_sec = 0;
>  timer.it_interval.tv_usec = 5000;
>  /* Start a virtual timer. It counts down whenever this process is
>   executing. */
>  setitimer (ITIMER_VIRTUAL, &timer, NULL);
>
>
> }
>
>
> void Set_Up_USB()
> {
>
>
>   struct usb_bus *busses;
>   struct usb_bus *bus;
>   int i;
>
>   usb_init();
>
>   usb_find_busses();
>
>   usb_find_devices();
>
>   busses = usb_get_busses();
>
>   char buf[64];
>
>   for(i=0;i<64;i++)
>   buf[i] = i;
>   for (bus = busses; bus; bus = bus->next)
>
>   {
>     struct usb_device *dev;
>
>     for (dev = bus->devices; dev; dev = dev->next)
>
>     {
>
>       if (dev->descriptor.idVendor == 0x04d8)
>
>       {
>
>         int stat;
>
>         printf("vendor: %i\n",dev->descriptor.idVendor);
>
>
>       usb_handle = usb_open
>
>
>         stat = usb_set_configuration (usb_handle,dev->config
> [0].bConfigurationValue);
>
>
>
>         printf ("stat:%d from usb_set_config to %x\n",stat,dev->config
> [0].bConfigurationValue);
>
>       stat = usb_claim_interface(usb_handle, 0);
>
>
>         printf ("stat:%d from claim\n",stat);
>       }
>      }
>    }
> }
>
>
>
>
> int main ()
> {
>   Set_Up_USB();
>
>   Init_Timer();
>
>
>   open_socket();
>
>
>
>
>
>  /* Do busy work. */
>  while (1);
>  close(create_socket);
>  return 0;
> }
> ********************************************************************
>
>


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU