Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
krassor
PostPosted: Jun 15, 2012 - 06:52 AM
Newbie


Joined: Jun 15, 2012
Posts: 3


Hi to everybody! Sorry for my English, but i have a problem.

I have board ATSTK1002 with Linux on flash.
So I use GPIO(via portB) in my programs.
That time I turn on it the following:
Code:

# cd /config/gpio/
/config/gpio # mkdir my_gpio
/config/gpio # cd my_gpio/
/config/gpio/my_gpio # ls
enabled   gpio_id   oe_mask   pin_mask
/config/gpio/my_gpio # echo 1 > gpio_id
/config/gpio/my_gpio # echo 0x00000001 > pin_mask
/config/gpio/my_gpio # echo 0x00000000 > oe_mask
/config/gpio/my_gpio # echo 1 > enabled
/config/gpio/my_gpio # ls /dev/
audio               mmcblk0p1           random
console             mtd0                root
core                mtd0ro              rtc0
cpu_dma_latency     mtd1                shm
dsp                 mtd1ro              snd
fb0                 mtd2                stderr
fd                  mtd2ro              stdin
full                mtdblock0           stdout
gpio0               mtdblock1           tty
kmem                mtdblock2           ttyS0
kmsg                network_latency     ttyS2
log                 network_throughput  ttygserial
mem                 null                urandom
mixer               ptmx                watchdog
mmcblk0             pts                 zero


So, it works fine. As you can see, I get "gpio0" and i can work with it in my program.
But if i work with GPIO via PortC the same way, i have a problem - i couldn't turn it on:
Code:

# cd /config/gpio/
/config/gpio # mkdir my_gpio
/config/gpio # cd my_gpio/
/config/gpio/my_gpio # ls
enabled   gpio_id   oe_mask   pin_mask
/config/gpio/my_gpio # echo 2 > gpio_id
/config/gpio/my_gpio # echo 0x00000001 > pin_mask
/config/gpio/my_gpio # echo 0x00000000 > oe_mask
/config/gpio/my_gpio # echo 1 > enabled
/config/gpio/my_gpio # tail enabled
0
/config/gpio/my_gpio # ls /dev/
audio               mtd0                root
console             mtd0ro              rtc0
core                mtd1                shm
cpu_dma_latency     mtd1ro              snd
dsp                 mtd2                stderr
fb0                 mtd2ro              stdin
fd                  mtdblock0           stdout
full                mtdblock1           tty
kmem                mtdblock2           ttyS0
kmsg                network_latency     ttyS2
log                 network_throughput  ttygserial
mem                 null                urandom
mixer               ptmx                watchdog
mmcblk0             pts                 zero
mmcblk0p1           random


As you can see, gpio device was not created and the value of "enabled" was not changed. I have that result with any values of "pin_mask" and "oe_mask".

The switches "SW6" and "SW4" on board are in "gpio" states.

Would you be so kind to explain me, what's can be wrong?

Thanks.
--
Best regards, Dmitriy.
 
 View user's profile Send private message  
Reply with quote Back to top
hce
PostPosted: Jun 15, 2012 - 07:53 AM
Raving lunatic


Joined: Jan 07, 2003
Posts: 4580
Location: Oslo, Norway

The I/O line is already in use by the kernel for something else?
 
 View user's profile Send private message  
Reply with quote Back to top
krassor
PostPosted: Jun 15, 2012 - 10:46 AM
Newbie


Joined: Jun 15, 2012
Posts: 3


I read documentation. Ex.:
ftp://ftp.efo.ru/pub/efo-ftp/TMP/pub/atmel/_AVR32_MCUs_32bit/AVR32_Technical_Library/software/wiki_html/ap7000_port_c.html (it's copy from altera wiki).
In my opinion PortC[0..15] can be both "GPIO" or "MACB0" states. The switches "SW6" and "SW4" on board are in "gpio" states.

Also I check all bits separately in "pin_mask". So it's impossible that all bits are used by the kernel. Some of them should be free for using via GPIO.

hce, can you advice me how to check are the PortC bits free from using by the kernel other way?
 
 View user's profile Send private message  
Reply with quote Back to top
hce
PostPosted: Jun 15, 2012 - 11:03 AM
Raving lunatic


Joined: Jan 07, 2003
Posts: 4580
Location: Oslo, Norway

You have to look at your board code, and see what you have done with regards to setting up the various GPIOs to different functions. My guess is that you have enabled the MACB0 platform device, and thus, locked out the possibility to do GPIO on the same lines. This is all software, so you have misconfigured something if you expect it to behave otherwise.
 
 View user's profile Send private message  
Reply with quote Back to top
krassor
PostPosted: Jun 15, 2012 - 12:14 PM
Newbie


Joined: Jun 15, 2012
Posts: 3


Ok, i will check it ASAP.
Takket forbindelsen =)
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits