Hi guys,

I have some questions related to Beaglebone Black. It seems that I don't 
understand something, something is missing. I tried to create a device 
driver for GPIO but I failed at changing pin's value.

Let me put some code... 
I have 4 variables for the addresses of the 4 gpio registers...

volatile u32 gpio_group0_mem_address;
volatile u32 gpio_group1_mem_address;
volatile u32 gpio_group2_mem_address;
volatile u32 gpio_group3_mem_address;


and the value of these variables are returned by ioremap:

gpio_group0_mem_address=(u32)ioremap(GPIO0_START,(GPIO0_END-GPIO0_START));
gpio_group1_mem_address=(u32)ioremap(GPIO1_START,(GPIO1_END-GPIO1_START));
gpio_group2_mem_address=(u32)ioremap(GPIO2_START,(GPIO2_END-GPIO2_START));
gpio_group3_mem_address=(u32)ioremap(GPIO3_START,(GPIO3_END-GPIO3_START));

where GPIO0_START is the start address of GPIO0 and GPIO0_END is the end 
address of GPIO0 took from spruh73m chapter 2 ( memory map).

Now, let's say that I want to write a 1 to P8_7. This pin is mapped 
to gpio2[2], so to write a value to this pin I do the next operations:

volatile u32 *memory_Ptr=NULL;
memory_Ptr=(u32*)(gpio_group2_mem_address|GPIO_DATAOUT);//GPIO_DATAOUT have 
the value:0x13C
 *memory_Ptr=(1<<2);
 wmb(); 

To me, those pieces of code looks correct and I expect 3.3V on P8_7 but it 
seems it doesn't work. Can someone help me, just to tell me where I'm wrong 
cause it seems I miss something.

Thanks!

Best Regards,
Mihai Seba

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to