Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - how to set Pinmux for GPIO pins with BeagleBone Black: (3 Items)
   
how to set Pinmux for GPIO pins with BeagleBone Black  
Hi QNX,

QNX Momentics IDE 6.5 SP1
beaglebone black BSP: bsp-nto650-ti-beaglebone-sp1-trunk-201209071340.zip

I am confused on the default GPIO setup of BBB. The output voltage of various GPIO pins are apparently different, for 
example, P9_15 (GPIO1_16) is 1.65v, while P9_12 (GPIO1_28) is 3.10v and P8_12 (GPIO1_12) is grounded.

/bsp-ti-beaglebone-src/src/hardware/startup/boards/beaglebone/init_pinmux.c only setups LEDs with mode(7). no other GPIO
 pins have been populated.

I saw other colleague was trying to setup more gpio properties, such as in
http://community.qnx.com/sf/discussion/do/listPosts/projects.core_os/discussion.newcode.topc24286

        // The register that I want to use as gpio (conf_gpmc_ad12) is located at the address 0x0830, 
        // so I will map the memory from AM335X_CTRL_BASE addresss to AM335X_CTRL_BASE+0x0840
   	ptr = (uintptr_t)mmap_device_memory(0, AM335X_CTRL_BASE+0x0840, PROT_READ | PROT_WRITE | PROT_NOCACHE,  0, 
AM335X_CTRL_BASE);

        // I set conf_gpmc_ad12 in MODE 7 to enable the pin as GPIO1_12
	out32(ptr + conf_gpmc_ad12, MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE | SLEWCTRL);

Below are  questions I really do not understand:
1. why conf_gpmc_ad12 address 0x0830, but mmap_device_memory to AM335X_CTRL_BASE+0x0840?
2. is it necessary to indicate extra properties (such as PULLUDEN | PULLUP_EN | RXACTIVE | SLEWCTRL etc), since LEDs in 
 init_pinmux.c were only named MODE(7).
3. is it the right way to configure gpio pin properties in the application program? Though I am more prefer to modify 
the init_pinmux.c in the BSP fold.

Please advise, thanks in advance.

Mike
Re: how to set Pinmux for GPIO pins with BeagleBone Black  
I am not deeply inside the AM335x processor, that's why I cannot answer question 1. It might be a bug which just doesn't
 incur any erroneous behaviour due to the 4K alignment of all mappings that the kernel is enforcing. It might be 
something totally different, though.

Q2: It depends on the electrical properties of the device that you want to connect. These settings allow you to have a 
better match between the external component and the I/O cell.

Q3: It is a question of software architecture and philosophy. Technically both is possible. In the development phase it 
is quite natural to do it in user mode using a pinmux tool because it's more flexible. Towards production, we tend to 
move this type of configuration to startup so you can be sure pinmux and electrical properties are setup correctly 
before any software accesses these ports.

Regards,
Albrecht
Re: how to set Pinmux for GPIO pins with BeagleBone Black  
Dear Albrecht,

Thank you so much to answer my questions, which really helps.

About the question 1, I believe the extra 0x10 offset was a mistake. Inside init_pinmux.c, there is no such offset, and 
all the out32() writes to (AM335X_CTRL_BASE+address) directly.

Best

Mike