On Thu, 26 Mar 2009, lazo93600 wrote:
> Good morning,
>
> We're developping a robot and we use a TS7260 to control it. We have a
> problem : we would like to use the DIO2 port like a simple input / output
> port. We don't manage to configure the "MODE 0" on the fpga, even by
> using function provided by the card documentation.
>
> This a code we used to set the mode 0 :
Have you looked at any other code that accesses io ports and similar?
There is code source available in the files section of this group, or on my
site (see below)
Before I offer help to students, I like to see evidence they have done some
research first :-)
> int main(void)
> {
> unsigned char *start;
missing volatile
> int i;
> fd = open("/dev/mem", O_RDWR|O_SYNC);
> start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd,
> 0x12C00000);
> BASE0 = (unsigned char *)(start + 0x00); //port BASE0;
> BASE1 = (unsigned char *)(start + 0x01); // port BASE1;
> BASE2 = (unsigned char *)(start + 0x02); // port BASE2;
> BASE3 = (unsigned char *)(start + 0x03); // port BASE3;
you don't show the declaration of BASE{0,1,2,3}? It always helps to show
ALL relevant info.
> *BASE0 = 0x0f; // or 0x3f should be enough ?
"or 0x3f should be good enough" for what? What do you think you are trying
to do?
> printf("%x\n",*BASE0);
> printf("%x\n",*BASE1);
> printf("%x\n",*BASE2);
> printf("%x\n",*BASE3);
>
> return 0;
>
> }
>
Generally with bidirectional ports you first have to set the DDR port, to
set the relevant bits of the port as output/input pins - the default will
be all are set as input.
Once you have set the bits you require as output you can then write to the
actual port to set the state of the outputs.
>
> We have an other question :
>
> We tried to get the value in the base0 register and base2 register. Each
> time we executed the code, these two value changed (0xFF or 0xBF). It
> would be nice if you could give us a reason.
Jim
----------------------------------------------------------------------------
HomePage: http://www.comp.leeds.ac.uk/jj
TS7200 Page: http://www.comp.leeds.ac.uk/jj/linux/arm-sbc.html
------------------------------------
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/
|