Ah well, the code i postet works, but it's not really useful i think. I'm currently making a daemon that takes position values thru a named pipe. i'll post it as soon as it's finished (should be by the end of next week, else i'm in big trouble:))
if you get the kernel module solution working, you should probably go that way though.. --- In [email protected], Giovanni <[EMAIL PROTECTED]> wrote: > > 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]> 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], "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] >
