ts-7000
[Top] [All Lists]

Re: [ts-7000] DIO2 port configuration

To:
Subject: Re: [ts-7000] DIO2 port configuration
From: Jim Jackson <>
Date: Thu, 26 Mar 2009 19:50:43 +0000 (GMT)


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/

<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