In your post, you spoke about "the fast timer api". As i'm looking for information about Timers, this message seems to be good for me. What is the Fast Timer? Where can i find information about this? Thanks J.M.
--- In [email protected], "Ernst Mayerhofer" <[EMAIL PROTECTED]> wrote: > > if you want to make something which works really well, you have to do it in > the kernel ;-) > > I made a kernel module once. As I modified it now for you and didn't test it > on the foxboard, there might be a problem, so feel free to ask me if there > is some problem. > > just compile the servo.c attached with the also attached makefile. you have > to change the path of AXIS_TOP_DIR in the Makefile. > > once you have compiled it, transfer it to the foxboard and type: > $ insmod servo.o > if you want to see the kernel log messages, type > $ dmesg > then you can make a new device node , eg > $ mknod c /etc/servo c 249 0 > and, if you want to set the servo to a specific position, write the value of > T_on in us to /etc/servo: > $ echo 500 > /etc/servo > > it should work! > notice that if you want to use it, you have to enable the fast timer api. > > greets and pardon for my bad english, > > ernst mayerhofer > > > 2007/2/2, Giovanni <[EMAIL PROTECTED]>: > > > > This solution sounds cool. > > > > Did you try it with a real case ? > > > > I would like to run some real working code based on this idea. If you have > > some code ready to run, can you post it ? Otherwise we can collaborate to > > develop some working code and test it. > > > > Best regards, > > Giovanni > > > > spargelzack <[EMAIL PROTECTED] <spargelzack%40yahoo.com>> wrote: > > (sorry if this shows up twice, i'm not familiar with the yahoo groups > > > > interface yet) > > > > Hi Everybody > > > > I found a cheap + fast solution for using servos with the foxboard. > > > > First, there is a way to use the i/o lines not described on the > > acmesystems website (it's well known on the axis developer website > > though). You can use write() on Ports A+B after proper initialization. > > > > The Clock interval is around 5 us, so you have to pass about 4000 > > values for a full 2ms period. > > > > But as i found out, the 20ms interval isn't all that important. What > > matters is the length of the pulse. > > > > So, here's my code: > > > > -- > > #include <stdio.h> > > #include "stdlib.h" > > #include "unistd.h" > > #include "sys/ioctl.h" > > #include "fcntl.h" > > #include <sys/time.h> > > #include <asm/etraxgpio.h> > > > > int main(int argc, char **argv){ > > int fd; > > int i; > > int pos; > > unsigned char mask; > > unsigned char period[4000]; > > > > if(argc > 1) > > pos = atoi(argv[1]); > > else > > pos = 100; > > > > // better use memset() here, but this is proof-of-concept code > > for(i=0; i<pos+1; i++){ > > if(pos > i) > > period[i] = 0xFF; > > else > > period[i] = 0; > > } > > > > fd = open("/dev/gpiob", O_RDWR); > > > > if(!fd){ > > printf("open error\n"); > > exit(-1); > > } > > > > mask = 1<<6 | 1<<7; // use pins PB6 and PB7 according to the > > fox pinout > > > > // prepare for write() > > if(ioctl(fd, _IO(ETRAXGPIO_IOCTYPE, IO_CFG_WRITE_MODE), > > IO_CFG_WRITE_MODE_VALUE(1, mask, 1<<1))){ > > perror("ioctl error"); > > exit(-1); > > } > > > > for(;;){ > > write(fd, &period, pos+1); // write the pulse, > > followed by a zero to set the output > > usleep(5000); // let the CPU breathe a bit.. > > } > > } > > -- > > > > This only works with ports A and B, not with the G line. > > > > Supply any value between 100 and 400 as first argument to set the > > position of two servos connected to PB6 and PB7. > > > > example: > > > > ./motor 180 > > > > This uses LESS THAN 1% CPU when running. > > > > This is proof of concept code, so it's UGLY AND NOT USEFUL OUT OF THE > > BOX. Also, my english sucks a bit. > > > > --- In [email protected] <foxboard%40yahoogroups.com>, "zooltheno1" > > <zooltheno1@> wrote: > > > > > > Hi > > > I want to use RC-Servos with the Foxboard, the normal interfall is > > > 1-2ms and 20ms pause. > > > I tried to use udelay for the delay, put the minimum is 40ms, > > > which is far to slow, even normal AC is faster. > > > How could I get the nesasery delay without 100% CPU load ? > > > > > > Bye > > > Ralph > > > > > > > > > > > > > > > ------------------------------------------------ > > Resources are limited, Imagination is unlimited. > > > > --------------------------------- > > Want to start your own business? Learn how on Yahoo! Small Business. > > > > [Non-text portions of this message have been removed] > > > > > > > > > [Non-text portions of this message have been removed] >
