please choosego to mobile | Continue to access the PC version
View: 18798|Reply: 23

I have a love hate relationship going with OP PC

[Copy link]

3

threads

44

posts

1211

credits

Gold member

Rank: 6Rank: 6

credits
1211
Published in 2015-12-22 03:24:22 | Show all floors |Read mode
I have found that OP PC is easy to get up and running with Linux , everything else is hard. It is a piece of cake to get Linux (Debian 8, thank you loboris) running and connected to WiFi. And then everything else gets tough to impossible to do. I have spent days reading the OP forum trying to get OP PI to work with any OP or RPI program examples. I loaded Sunxi, wiringpi, and on and on and all I can do is light a couple of LEDS , and then only from the command line. The program examples anywhere in the forum do not seem to work and I am beginning to suspect that the OP PC IO pinout is very different and works differently from anything suggested in the OP ( and RPI) forums. I managed to figure out by cross referencing between RPI and OP some of the GPIO but I am not expert enough to repair the code or the cross reference the IO or recognize all that is missing. A lot of what I did was trial and error. In essence, until someone experienced in PI interfacing decodes how OP IO really maps to RPI and test, or writes new, the wiringpi examples then OP will likely hit a dead end. Its a really nice board but because it does not have basic support it is not useful to the hobbyist community (hacker, modder , experimenter, maker, ...)
Please don't suggest I search the OP forum. I have been days paging through hundreds of posts in both OP and RPI forums. The OP info is missing, or incorrect, or vague, or disguised. :-)
I am sure some of the experts have gotten some of the GPIO to work in their code but none of their work seems to have made it onto this forum. I have successfully run example programs on ESP8266, RPI, and Arduino. I just can't get the OP to sing.

Someone please, show me I am wrong.

1

threads

28

posts

136

credits

Registered member

Rank: 2

credits
136
Published in 2016-1-2 16:03:22 | Show all floors
Nope, you're right.  I've got a love-hate relationship with the thing, too.  Probably just going to need to hang onto the thing till it is fully mainlined, or.... write all the needed kernel code yourself!  (I kid, I kid...)

3

threads

44

posts

1211

credits

Gold member

Rank: 6Rank: 6

credits
1211
 Author| Published in 2016-1-4 22:06:20 | Show all floors
Have you tried any of the RPI examples on OPI or do you know of anyone who has?

12

threads

30

posts

150

credits

Registered member

Rank: 2

credits
150
Published in 2016-1-5 20:15:32 | Show all floors
phreon replied at 2016-1-4 22:06
Have you tried any of the RPI examples on OPI or do you know of anyone who has?

I recently documented a few working interfaces, program's included. (have a look under item interfaces)

I use an orange pi PC, with the loboris 3.4 kernel.
(I own a raspberry 2 as well)

I'm confused as well on the pin-definitions.
The same pin gets like 5 definitions.
(but then again - same thing on the rpi)

I had some good results using the PA_XX definitions from the manual.
eg PA6 -- here you use number 6 (and ignore the gpio stuff in script.bin)


3

threads

44

posts

1211

credits

Gold member

Rank: 6Rank: 6

credits
1211
 Author| Published in 2016-1-6 00:16:12 | Show all floors
Thanks snowbody,
I have spent many hours over several days trying to figure out how to translate the gpio RPI to OPI. I am not a programmer but I do want to begin using the OPI for experiments in IOT and embedded systems. Can you explain how you translated the OPI PAxx numbers to the correct physical pin. In other words, how did you figure out that when you wrote your "Temperature Controlled Fan" program that digitalWrite (VENTI, HIGH); would turn on pin 16?
Published in 2016-1-6 01:05:30 | Show all floors
Edited by bronco at 2016-1-6 01:08

This is the best starting point regarding correct Pin assignments: https://github.com/loboris/OrangePi-BuildLinux/blob/master/orange/OPI_GPIO.txt (the first 2 GPIO entries are for the 2 LEDs -- these can be defined in another way so they're useable as normal LEDs: https://groups.google.com/d/msg/ ... It3GsA/2KDRe_8IAQAJ

This here maybe helps understanding how the SoC's pin names (eg. PA12) are mapped and how to access them from kernel 3.4 sysfs: http://linux-sunxi.org/GPIO#Accessing_the_GPIO_pins_through_sysfs_on_sunxi-3.4

Please keep in mind that these assignments still have nothing to do with the physical pin mappings (positions) on the 40 pin connector. Next step (voluntary work!) would be to start with a nice image like this one http://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/ and to fill in the informations gathered from the above:



We can assume that Xunlong tried to be as compatible as possible to the RPi GPIO header (TBC) and we can combine this with other already known informations like "It is also possible to power the device via GPIO pin header: connect +5V to either pin 2 or 4 (both are connected to DCIN test point) and GND to pin 6." (quoted from here)

For example: According to loboris' list above the following entry would match with pin 19 on the header (TBC):
  1. gpio_pin_14       PC00           64             SPI0-MOSI
Copy code
Next step would be to verify all the assignments (not possible without measuring and testing) and then in a last step again use loboris' list to compare with Banana Pi M3. Why? Since they use nearly the same kernel and already ported WiringPi for the M3. All you've to do is to grab their source code, lookup how their pin mappings are defined in https://github.com/BPI-SINOVOIP/ ... fig.fex#L1352-L1382 and adjust the stuff in the WiringPi source accordingly.

The physical to WiringPi mapping can be seen here: https://github.com/BPI-SINOVOIP/ ... /readall.c#L85-L113

And of course it's a better idea to start a new thread collecting the necessary informations, doing some work non-coders can do and search for someone also interested in porting WiringPi but being able to do so. But the hardest part would be to confirm whether the mappings we currently have to rely on (based on the fex file's contents from Xunlong) are ok or not.



3

threads

44

posts

1211

credits

Gold member

Rank: 6Rank: 6

credits
1211
 Author| Published in 2016-1-6 01:56:05 | Show all floors
Wow bronco!
That post was so helpful. I will spend some time mapping the OPI PC pins and post my results. I will also try to correct some of the wiringpi examples with the correct gpio for the OPI and post it if it works.
Thanks so much!
P

5

threads

354

posts

2708

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
2708
Published in 2016-1-6 02:30:59 | Show all floors
Boards:
orangepi plus, olinuxino A20, cubieboard A10, mele A2000 .....

3

threads

44

posts

1211

credits

Gold member

Rank: 6Rank: 6

credits
1211
 Author| Published in 2016-1-6 03:19:14 | Show all floors
Edited by phreon at 2016-1-7 04:24

Thanks fritz,
I had read them several times over the last few weeks.

As bronco suggested I dove into trying to figure out the gpio mapping. I looked in /sys/class/gpio and empirically mapped each of the the links to a phisical pin by wiring a LED to every pin and turning it on and off from the command line. I then converted script.bin to a fex file and looked at the gpio map to Pxxx port and found that it matched. The mapping is below. I then modified wiringpi example blink.c to blink a LED on physical pin 11.

I used:

>gpio readall

and that output gave me some of the wPi associations but there are still 15 IO pins that are unmapped.
I am still not clear on how to figure out what pin maps to what wPi. Can anyone point me to it?

-----------------------------------------

#include <stdio.h>
#include <wiringPi.h>

#define    LED 1

int main (void)
{
  printf ("Raspberry Pi blink\n") ;

  wiringPiSetup () ;
  pinMode (LED, OUTPUT) ;

  for (;;)
  {
    digitalWrite (LED, HIGH) ;    // On
    delay (500) ;        // mS
    digitalWrite (LED, LOW) ;    // Off
    delay (500) ;
  }
  return 0 ;
}

------------------------------------------------------------------------------------
gpio map for WiringOP-h3

GPIO                     Port          Physical Pin/wPi
+gpio_pin_0 = port: PL10 = PWR-LED         
+gpio_pin_1 = port: PA15 = Status-LED
+gpio_pin_2 = port: PA12 = 3
+gpio_pin_3 = port: PA11 = 5
+gpio_pin_4 = port: PA06 = 7/6                    
+gpio_pin_5 = port: PA13 = 8
+gpio_pin_6 = port: PA14 = 10
+gpio_pin_7 = port: PA01 = 11
+gpio_pin_8 = port: PD14 = 12/1
+gpio_pin_9 = port: PA00 = 13
+gpio_pin_10 = port: PA03 = 15
+gpio_pin_11 = port: PC04 = 16 /4
+gpio_pin_12 = port: PC07 = 18 /5
+gpio_pin_13 = port: PC00 = 19
+gpio_pin_14 = port: PC01 = 21
+gpio_pin_15 = port: PA02 = 22
+gpio_pin_16 = port: PC02 = 23
+gpio_pin_17 = port: PC03 = 24
+gpio_pin_18 = port: PA21 = 26
+gpio_pin_29 = port: PA19 = 27
+gpio_pin_20 = port: PA18 = 28
+gpio_pin_21 = port: PA07 = 29/7
+gpio_pin_22 = port: PA08 = 31/8
+gpio_pin_23 = port: PG08 = 32/9
+gpio_pin_24 = port: PA09 = 33/10
+gpio_pin_25 = port: PA10 = 35/12
+gpio_pin_26 = port: PG09 = 36/13
+gpio_pin_27 = port: PA20 = 37/14
+gpio_pin_28 = port: PG06 = 38 /15
+gpio_pin_29 = port: PG07 = 40/16

Pin 2 & 4 = 5V; Pin 1 & 17 = 3.3V;  Pin 9,14,20,25,30,34, & 39 = GND


12

threads

30

posts

150

credits

Registered member

Rank: 2

credits
150
Published in 2016-1-7 00:34:13 | Show all floors
I used the GPIO in two ways.

-Directly from the kernel (here I used the numbering from the manual PA_16 is port 16 etc)
-trough wiringpi (here I executed "gpio readall" and used the wiring pi port numbers)
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list