Thanks Luigi ! That helped me so much. It's a great clue!

On Thursday, June 13, 2013 at 1:12:36 PM UTC+4:30, Luigi Rinaldi wrote:
>
> I had the same problem, I resolved it exporting at least one pin for each 
> GPIO. After that I can access GPIO0, GPIO2 and GPIO3 with mmap.
> It's not about pinmux, maybe the problem is the clock.
> Try to do this:
> # echo 5 > /sys/class/gpio/export
> # echo 65 > /sys/class/gpio/export
> # echo 105 > /sys/class/gpio/export
> You can do it also in C++ or Python.
>
> Luigi Rinaldi.
>
> Il giorno mercoledì 12 giugno 2013 04:41:10 UTC+2, Jacek Radzikowski ha 
> scritto:
>>
>> Hello, 
>>
>> I'm getting bus errors whenever my program tries to access registers 
>> controlling pins on GPIOs 0,2 or 3. I'm not trying to set pinmuxing, I 
>> try to write to registers controlling the pins. 
>> GPIO1 works fine and I can enable outputs by writing to the OE 
>> register and change the values on the pins by writing to the OUT 
>> register. 
>>
>> Here are some details of my simple test program: 
>> The base addresses for the GPIO blocks are defined as follows: 
>>         const uint32_t gpioAddrs[] = 
>>                 { 0x44E07000, 0x4804C000, 0x481AC000, 0x481AE000 }; 
>>
>> The memory blocks are mapped to process address space with the following 
>> mmap: 
>>         gpios[i] = (uint32_t *) mmap(NULL, 0xfff, 
>>                  PROT_READ | PROT_WRITE, MAP_SHARED, gpioFd, 
>> gpioAddrs[i]); 
>>
>> Printing values from OE, IN and OUT registers: 
>>         printf("i=%i\n",i); 
>>         printf("OUT[%i]=0x%08x\n",i,gpios[i][DATA_OUT_REG/4]); 
>>         printf("IN[%i]=0x%08x\n",i,gpios[i][DATA_IN_REG/4]); 
>>         printf("OE[%i]=0x%08x\n",i,gpios[i][GPIO_OE_REG/4]); 
>>
>> The full source is on gist: 
>> https://gist.github.com/piranha32/4fd285cc8333eeb4ec39 
>>
>> Program works fine when 'i' is set to 1, crashes for 'i' set to 0,2 or 3. 
>> Am I missing something obvious, or is this an overzealous memory 
>> protection? 
>>
>> Board: BBBlack 
>> Kernel: Linux beaglebone 3.8.13 #1 SMP Fri Jun 7 09:49:12 CEST 2013 
>> armv7l GNU/Linux 
>>
>> thx, 
>> j. 
>>
>>
>> -- 
>> Given a choice between two theories, take the one which is funnier 
>>
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/d7f3577d-1316-49ed-afc4-9e30bbb8dbfe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to