Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted

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?

Posted

I don't see why editing the FEX with only the above changes would prevent from booting properly.

Maybe the whole image is badly written or the SDCard defective.

Try to redo the whole image, make sure it is booting, and then redo the FEX changes.

Posted

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.

Posted

What do you mean exactly ?

UART and I2C as nothing in common, except if you mean that you are using an I2C-to-UART bridge chip such SC16IS752, which Linux kernel is able to manage with proper kernel custom build configs and overlays.

This means that WiringPi is not used for this case.

 

Posted
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?

 

Posted (edited)

You need to use bin2fex/fex2bin tools to decompile/recompile current /boot/script.bin.

 

Edited by chwe
corrected vin2fex to bin2fex
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines