View: 7866|Reply: 1

data / control register (example onboard switch) OK

[Copy link]

12

threads

30

posts

150

credits

Registered member

Rank: 2

credits
150
Published in 2016-1-15 18:57:11 | Show all floors |Read mode
I found a usefull script on http://docs.cubieboard.org/tutorials/common/gpio_on_lubuntu

I did consult the Allwinner H3 datasheet.
On page 316  you'll find the exact offsets for each port : PL_DAT 0x24+0x10
For example port A : PAxx  the offset = 0x10
*(unsigned int *)(ptr+0x10) = data; (adapt cubieboard example)
This way you can read and write ports that are not listed in wiringOP

Port L is something special because it starts at a different address  
(page 345) port L
0x01F02C00

In order to read to onboard switch PL03, you have to switch the bits in the controlregister for this port to 0 (=input)
(script write_controller_register)

Then you can read out the port using the script (read_test_switch)

compile : gcc script.c -o readswitch  

This thread contains more resources

You need to Log in to download or view,No account?    Register

x

0

threads

1

posts

12

credits

Novice

Rank: 1

credits
12
Published in 2016-4-5 03:14:43 | Show all floors
Thank you for your very usefull zip
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list