Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

UART on gpio pins Orange Pi Lite

Featured Replies

Hi,

 

I need to use uart (for a gps receiver) and i2c (for some sensors) for my project via the gpio pins. Fortunately i2c is enabled in the images by default. I hope it is also enabled if I recompile armbian for the orangepi lite by default?

Afaik I have to enable UART in the following file: https://github.com/igorpecovnik/lib/blob/master/config/fex/orangepilite.fex .

Unfurtunately I do not understand which pins on the gpio header correspond to the ports defined in this file.

For example:

 

uart_tx = port:PG06<2><1><default><default> uart_rx = port:PG07<2><1><default><default>

Can I use UART on any pins on the gpio header?

I would like to use UART on the same pins as in https://www.element14.com/community/servlet/JiveServlet/previewBody/73950-102-10-339300/pi3_gpio.png

How do I do that?

The UART available on pin 8 and 10 on the Pi header is the UART3, while the UART2 is located on pin 11 and 13.

So, in the FEX, for the UART3, you simply need to enable it (uart_used = 1) and remove the corresponding pins (PA13/PA14) from the GPIO list.

For the UART2, the pins to remove from GPIO list are PA00/PA01/PA02/PA03.

For the reference - this image is from schematics for on of H3 Orange Pi boards.

 

Edit: It is stated in the article.

 

Edit 2: BTW, It doesn't reference port/pin numbers for UART, I2C and SPI interfaces, so you still need to check original schematics to disable appropriate GPIOs.

  • Author

Thank you for your replies. I have now tried to enable UART2 and UART3 and remove the corresponding pins from the GPIO list.

Unfortunately the Orange Pi does not boot with the new image and the screen is just black. The green led is also off.

 

Here are the changes I have made in the orangepilite.fex:

[uart2]
uart_used = 1
uart_port = 2
uart_type = 2
uart_tx = port:PA00<2><1><default><default>
uart_rx = port:PA01<2><1><default><default>
;uart_rts = port:PA02<2><1><default><default>
;uart_cts = port:PA03<2><1><default><default>

[uart3]
uart_used = 1
uart_port = 3
uart_type = 2
uart_tx = port:PA13<3><1><default><default>
uart_rx = port:PA14<3><1><default><default>
;uart_rts = port:PA15<3><1><default><default>
;uart_cts = port:PA16<3><1><default><default>

and

[gpio_para]
gpio_used = 1
gpio_num = 16
gpio_pin_1       = port:PA06<1><default><default><0>
gpio_pin_2       = port:PD14<1><default><default><0>
gpio_pin_3       = port:PA03<1><default><default><0>
gpio_pin_4       = port:PC04<1><default><default><0>
gpio_pin_5       = port:PC07<1><default><default><0>
gpio_pin_6      = port:PA02<1><default><default><0>
gpio_pin_7      = port:PA21<1><default><default><0>
gpio_pin_8      = port:PA07<1><default><default><0>
gpio_pin_9      = port:PA08<1><default><default><0>
gpio_pin_10      = port:PG08<1><default><default><0>
gpio_pin_11      = port:PA09<1><default><default><0>
gpio_pin_12      = port:PA10<1><default><default><0>
gpio_pin_13      = port:PG09<1><default><default><0>
gpio_pin_14      = port:PG06<1><default><default><0>
gpio_pin_15      = port:PG07<1><default><default><0>

Here are the fex file excerpts before I modified them:

[uart2]
uart_used = 0
uart_port = 2
uart_type = 4
uart_tx = port:PA00<2><1><default><default>
uart_rx = port:PA01<2><1><default><default>
uart_rts = port:PA02<2><1><default><default>
uart_cts = port:PA03<2><1><default><default>

[uart3]
uart_used = 0
uart_port = 3
uart_type = 4
uart_tx = port:PA13<3><1><default><default>
uart_rx = port:PA14<3><1><default><default>
uart_rts = port:PA15<3><1><default><default>
uart_cts = port:PA16<3><1><default><default>

and

[gpio_para]
gpio_used = 1
gpio_num = 19
gpio_pin_1       = port:PA06<1><default><default><0>
gpio_pin_2       = port:PA13<1><default><default><0>
gpio_pin_3       = port:PA14<1><default><default><0>
gpio_pin_4       = port:PA01<1><default><default><0>
gpio_pin_5       = port:PD14<1><default><default><0>
gpio_pin_6       = port:PA00<1><default><default><0>
gpio_pin_7       = port:PA03<1><default><default><0>
gpio_pin_8       = port:PC04<1><default><default><0>
gpio_pin_9       = port:PC07<1><default><default><0>
gpio_pin_10      = port:PA02<1><default><default><0>
gpio_pin_11      = port:PA21<1><default><default><0>
gpio_pin_12      = port:PA07<1><default><default><0>
gpio_pin_13      = port:PA08<1><default><default><0>
gpio_pin_14      = port:PG08<1><default><default><0>
gpio_pin_15      = port:PA09<1><default><default><0>
gpio_pin_16      = port:PA10<1><default><default><0>
gpio_pin_17      = port:PG09<1><default><default><0>
gpio_pin_18      = port:PG06<1><default><default><0>
gpio_pin_19      = port:PG07<1><default><default><0>

What have I done wrong?

Hello,

 

Is UART I2C communication available via WiringPI or how do you manage to actually communicate with a device via I2C protocol using an OPI board and C language?

I want to read data from an I2C sensor using C script. Did someone managed to do this? 

Can you please tell me what can I try?

 

Thanks.

Sorry for getting confused.

 

I do have an I2C sensor that I am trying to manage to send data to the Orange PI Zero/Lite.

I want to read data from an I2C sensor using C script.

 

Thanks.

On 7/15/2016 at 6:43 PM, martinayotte said:

The UART available on pin 8 and 10 on the Pi header is the UART3, while the UART2 is located on pin 11 and 13.

So, in the FEX, for the UART3, you simply need to enable it (uart_used = 1) and remove the corresponding pins (PA13/PA14) from the GPIO list.

For the UART2, the pins to remove from GPIO list are PA00/PA01/PA02/PA03.

i have orange pi lite when i go to /boot/boot0_OPI.fex what i must be do?

 

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.