0
moonki123

I2C - Orangepi Zero Plus H5

Recommended Posts

Hello Today i download Orangepi Zero Plus H5 Armbian OS

then i tried gpio - i2c test

but it's not work ...

 

I did like this

sudo apt-get install python-dev

sudo apt-get install python-smbus

sudo apt-get install i2c-tools

sudo apt-get install libi2c-dev

 

sudo nano /etc/modules -> add - i2c-dev, i2c-bcm2708

 

and i refer https://github.com/longsleep/linux-pine64/pull/17/commits/d915860a9c57a9a3ab3df7775c942ca205c8e16d this site

i think adding I2C configs is not problem 

so give me some advice

Share this post


Link to post
Share on other sites
36 minutes ago, moonki123 said:

sudo nano /etc/modules -> add - i2c-dev, i2c-bcm2708

 

and i refer https://github.com/longsleep/linux-pine64/pull/17/commits/d915860a9c57a9a3ab3df7775c942ca205c8e16d this site

 

Wrong, this way:

 

1. I2C, SPI, UART -> https://docs.armbian.com/User-Guide_Allwinner_overlays/ (I only test enabling UARTS)

2. Images are experimental. We put them out because basic things work, you at least have connectivity ... This is checked, the rest ... no idea.

Share this post


Link to post
Share on other sites

i'm not well in armbian knowledge

so.. just wait to stable becoming Images?

Afterwards Other developers make enabling I2C?

 

Share this post


Link to post
Share on other sites

I2c works in theory. Just follow documentation and try. Procedure will be the same in stable builds.

Wrote on mobile

Share this post


Link to post
Share on other sites

Those two chips are similar, document is correct and approach universal.

 

On H5 board this part of /boot/armbianEnv.txt

overlay_prefix=sun8i-h3

is different, the rest is the same

overlay_prefix=sun50i-h5

 

Unfortunately it's not working out of the box. I try to add few and some fixing (wrong directory name - overlay vs overlays) is needed, but overlays exits:

Spoiler

** File not found /boot/dtb/allwinner/overlay/sun50i-h5-w1-gpio.dtbo **
** File not found /boot/dtb/allwinner/overlay/sun50i-h5-uart1.dtbo **
** File not found /boot/dtb/allwinner/overlay/sun50i-h5-i2c0.dtbo **
** File not found /boot/dtb/allwinner/overlay/sun50i-h5-fixup.scr **

 

Spoiler

root@orangepizeroplus2:/boot/dtb/allwinner/overlays# ls -l
total 40
-rw-r--r-- 1 root root 374 May 16 14:53 sun50i-h5-i2c0.dtbo
-rw-r--r-- 1 root root 374 May 16 14:53 sun50i-h5-i2c1.dtbo
-rw-r--r-- 1 root root 374 May 16 14:53 sun50i-h5-i2c2.dtbo
-rw-r--r-- 1 root root 837 May 16 14:53 sun50i-h5-spi0-jedec-nor.dtbo
-rw-r--r-- 1 root root 527 May 16 14:53 sun50i-h5-spi0-spidev.dtbo
-rw-r--r-- 1 root root 837 May 16 14:53 sun50i-h5-spi1-jedec-nor.dtbo
-rw-r--r-- 1 root root 527 May 16 14:53 sun50i-h5-spi1-spidev.dtbo
-rw-r--r-- 1 root root 506 May 16 14:53 sun50i-h5-uart1.dtbo
-rw-r--r-- 1 root root 506 May 16 14:53 sun50i-h5-uart2.dtbo
-rw-r--r-- 1 root root 506 May 16 14:53 sun50i-h5-uart3.dtbo

 

 

Share this post


Link to post
Share on other sites

Hi Igor~ i success connect i2c pin !

just add overlays=i2c0 i2c1 like this ... in cd /boot -> armbianEnv.txt

but! now i can't connect to uart pin...

i tried to add -> overlays=uart1 like this and

param_uart1_rtscts=1

but it wasn't work

i check dmesg | grep ttyS then

 

[    1.635332] console [ttyS0] disabled
[    1.655531] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 27, base_baud = 15                                                                                                                          00000) is a U6_16550A
[    1.655587] console [ttyS0] enabled
[    1.676199] 1c28400.serial: ttyS1 at MMIO 0x1c28400 (irq = 28, base_baud = 15                                                                                                                          00000) is a U6_16550A
[    1.696663] 1c28c00.serial: ttyS2 at MMIO 0x1c28c00 (irq = 29, base_baud = 15                                                                                                                          00000) is a U6_16550A

 

so what should i do?

cd /dev/ -> in there i have tty0 to ttyS0~ttyS3

 

Share this post


Link to post
Share on other sites

Then, it should work !

Probably your wiring ...

Are you sure you need rtscts ? maybe the problem is there ...

You can try a loopback wire without rtscts, then use picocom or other terminal to test the echo.

 

 

Share this post


Link to post
Share on other sites

I erase param_uart1_rtscts=1 and i test serialRead.c  

I'm use example - serialRead.c -> gcc -o test serialRead.c -lwiringPi -lpthread
sudo ./test
-> nothing to receive ... (I tried GPS(TX) - OrangepiZeroPlusH5(RX) - (RXD3, RxD2, RxD1 - I tried all pin) 

 

my source is just put out receive data when data is received  

 

#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <wiringSerial.h>

 

int main ()
{
  static int lsize = 0;
  int fd ;
  int rdata = 0;

  if ((fd = serialOpen ("/dev/ttyS3", 9600)) < 0) // i tried all ttyS1, ttyS2, ttyS3
  {
    fprintf (stderr, "Unable to open serial device: %s\n", strerror (errno)) ;
    return 1 ;
  }

 

  for (;;)
  {
   rdata = serialGetchar(fd);
   if(rdata>=0)
        putchar(rdata);

   fflush(stdout);
  }
}

 

> gpio readall

my orangepi zero Plus H5 - GPIO here

 +-----+-----+----------+------+---+-Orange Pi+---+---+------+---------+-----+--+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 |       |       |         3.3v |             |    |  1 |  | 2   |    |          | 5v       |         |       |
 |  12 |    8 |      SDA.0 |    ALT5 | 0 |  3 |  | 4   |    |          | 5V       |         |       |
 |  11 |    9 |       SCL.0 |    ALT5 | 0 |  5 |  | 6   |    |          | 0v       |         |       |
 |    6 |    7 |     GPIO.7 |    ALT3 | 0 |  7 |  | 8   | 0 | ALT3 | TxD3  | 15    | 13  |
 |       |       |            0v |             |    |   9 | | 10 | 0 | ALT3 | RxD3   | 16   | 14  |
 |    1 |    0 |       RxD2 |    ALT3 | 0 | 11 | | 12 | 0 | ALT3 | GPIO.1 | 1    | 110 |
 |    0 |    2 |       TxD2 |    ALT3 | 0 | 13 | | 14 |    |           | 0v        |       |        |
 |    3 |    3 |       CTS2 |    ALT3 | 0 | 15 | | 16 | 0 | ALT3  | GPIO.4 |  4   |  68  |
 |       |       |         3.3v |             |    | 17 | | 18 | 0 | ALT3  | GPIO.5 |  5   |  71  |
 |  64 |  12 |       MOSI |    ALT4 | 0 | 19 | | 20 |    |           | 0v        |       |        |
 |  65 |  13 |       MISO |    ALT4 | 0 | 21 | | 22 | 0 | ALT3  | RTS2   |  6   |   2   |
 |  66 |  14 |       SCLK |    ALT4 | 0 | 23 | | 24 | 0 | ALT4  | CE0      | 10  |  67  |
 |       |       |            0v |             |    | 25 | | 26 | 0 | ALT3  | GPIO.11| 11  |  21  |
 |  19 |  30 |      SDA.1 |    ALT4 | 0 | 27 | | 28 | 0 | ALT4  | SCL.1    | 31  |  18  |
 |    7 |  21 |  GPIO.21 |     ALT3 | 0 | 29 | | 30 |    |           | 0v         |       |        |
 |    8 |  22 |  GPIO.22 |     ALT3 | 0 | 31 | | 32 | 0 | ALT3  | RTS1    | 26  | 200 |
 |    9 |  23 |  GPIO.23 |      OUT | 1 | 33 | | 34 |    |            | 0v        |       |        |
 |  10 |  24 |  GPIO.24 |     ALT3 | 0 | 35 | | 36 | 0 | ALT3   | CTS1   | 27  | 201 |
 |  20 |  25 |  GPIO.25 |      OUT | 0 | 37 | | 38 | 0 | ALT5   | TxD1   | 28  | 198 |
 |       |       |           0v |               |    | 39 | | 40 | 0 | ALT5  | RxD1    | 29  | 199 |
 +-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
 | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
 +-----+-----+----------+------+---+-Orange Pi+---+------+----------+-----+-----+
 

my armbianEnv.txt

add -> overlays = i2c0 i2c1 uart1 ttyS1

 

I think wiring is not problem...

help me...

Share this post


Link to post
Share on other sites

Why are you showing us a 40 pins header while OPiZeroPlus2 has only a 26 pins one ?

 

As I said earlier, simply do a loopback test ! It is what I've just did :

 

- connect a jumper between pins 8 and 10 of the 26 pins OPiZeroPlus2 header.

- add "overlays=uart2" (I don't know why you've added ttyS1 in overlays, such overlay doesn't exist !)

- reboot

- then "picocom -b 115200 /dev/ttyS2" and type any thing, it will be echoed ...

 

Share this post


Link to post
Share on other sites

Hi martinayotte i have good news

i successed uart communication, thank you very much 

but i wonder why another ttyS1 or ttyS3 pin is not working

i heard orangepi zero provide 3 uart pin

anyway i add "overlays=uart1 uart3" after checking uart2

and also i tried picocom -b 115200 /dev/ttyS1 and  picocom -b 115200 /dev/ttyS3

then ttyS1 note can't use and ttyS3 can use

so i tried ttyS3

- connect a jumper pins(i tried 10, 11 40 because GPS just send Data(Tx))

- nothing happen

- orangepi zero plus H5 provide just 1 uart pin?

thanks for your advise and care

i always respect all developers ^^   

Share this post


Link to post
Share on other sites

UART1 is dedicated to on-board Bluetooth of the AP6212, so not available on headers.

UART2 is working, like I've experiment earlier.

UART3 could be also enabled, but you will loose the SPI1 on header, the pins should be 23 and 24.

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
0