[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wrong read : readbits



Johan Adolfsson wrote:

>----- Original Message ----- 
>From: "Sébastien LICHT" <s.licht@xxxxxxx.fr>
>To: <dev-etrax@xxxxxxx.com>
>Sent: Thursday, July 22, 2004 4:59 PM
>Subject: wrong read : readbits
>
>
>  
>
>>hello
>>
>>
>>after setting some bits with
>>
>>    ioctl(fd, _IO(ETRAXGPIO_IOCTYPE, IO_CLRBITS ), 1 << bit);
>>or
>>    ioctl(fd, _IO(ETRAXGPIO_IOCTYPE, IO_SETBITS ), 1 << bit);
>>
>>(where "bit" is 1,2,3,4 or 5) ,
>>
>>
>>the "readbits" command seems to be locked  : "0" bits can change to "1"
>>but never return to "0" (i forced the pins to GND but no effects)
>>
>>after reset , the command seems to rework  perfectly
>>    
>>
>
>Not sure what you are trying to do.
>Please not that bit 1,2,3,4 and 5 on gpiog are both input and output at
>the same time but on different pins.
>You control the output with IO_SETBITS and IO_CLRBITS but that doesn't
>effect the result when reading the pins (unless you connect them together)
>
>  
>
>>I don't understand, because i have used only the IO_CLRBITS or IO_SETBITS
>>with 1 to 5 for writting
>>
>>and i looked for bits 8-15  , i don't touch them
>>
>>i've also tried to place :
>>
>>data = mask = 0xFF << 8;
>>  ioctl(fd, _IO(ETRAXGPIO_IOCTYPE, IO_SETGET_INPUT), &mask);
>>
>>but nothing
>>    
>>
>
>Noting what?
>That command sets G8-15 to input and updates mask with all bits that
>can be used as inputs.
>
>
>  
>
>>thanks for help
>>    
>>
>
>Best regards
>/Johan
>
>
>  
>

to simplify,
my aim is to control 3 or 4 bits on output ( to control a demutiplexer , 
and address 8 or 16 chips )
AND to read 8 other bits for data acquisition  (the chips are  A/N 
converters with 3 state bus )

but when I wrote on GPIO G port to control these chips, i can't read 
other bits anymore...

if anyone had simple source code to wrote on gpio without readbits 
command problems  ....


thanks everybody

Seb.