Welcome, Guest

Author Topic: A10 Lime UART's for serial communication  (Read 12429 times)

jmss

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
A10 Lime UART's for serial communication
« on: July 09, 2014, 06:29:50 PM »
Hi,

How can I enable some of the UART's for serial communication, namely UART's 2 to 7?

This is usually done by editing uEnv.txt or so, but I haven't found anything on it in the documentation.

Thanks.


djrose

  • Newbie
  • *
  • Posts: 21
  • Karma: +0/-0
Re: A10 Lime UART's for serial communication
« Reply #1 on: July 12, 2014, 11:23:05 PM »
A good starting point is:

http://linux-sunxi.org/Fex_Guide

It's worth studying this wiki. You can learn about the configuration and a whole lot more.

jmyreen

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +4/-0
Re: A10 Lime UART's for serial communication
« Reply #2 on: July 14, 2014, 12:22:24 PM »
Note that you can't enable functionality that isn't available in the hardware. Ports that aren't implemented on a specific SoC don't magically appear by editing a Fex file.

jmss

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Re: A10 Lime UART's for serial communication
« Reply #3 on: July 15, 2014, 02:40:37 AM »
A good starting point is:

http://linux-sunxi.org/Fex_Guide

It's worth studying this wiki. You can learn about the configuration and a whole lot more.

Thanks.

I'm using the image from http://eewiki.net/display/linuxonarm/A10-OLinuXino-LIME

I see the dts/dtb files, specifically the lines:

Code: [Select]
uart0: serial@01c28000 {
  pinctrl-names = "default";
  pinctrl-0 = <&uart0_pins_a>;
  status = "okay";
};

but how do I add another line for another UART with the information from the FEX guide?

How does the fex file relates to the dtb file? From my understanding fex is for the hardware configuration and dtb for Linux configuration. But I don't see any script.fex or script.bin files either in the source of the image or the image itself. I can only find the dts/dtb files.

Any further hints?


JohnS

  • Hero Member
  • *****
  • Posts: 1723
  • Karma: +33/-48
Re: A10 Lime UART's for serial communication
« Reply #5 on: July 17, 2014, 08:33:56 PM »
Linux is moving / has moved to DT.  AW use Fex as yet.

John

jmss

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Re: A10 Lime UART's for serial communication
« Reply #6 on: July 17, 2014, 10:10:02 PM »
Linux is moving / has moved to DT.  AW use Fex as yet.

John

Can you elaborate? I'm not familiar with the acronyms. Thanks.

jmss

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Re: A10 Lime UART's for serial communication
« Reply #7 on: July 18, 2014, 03:53:58 AM »
I think I've decoded the message from John :)

"Linux is using DTB files, while Allwinner still uses the FEX file."

That's why I wasn't able to figure out how the two worked together, since they don't :)

From Lub/OLIMEX:
1. use official Debian image
2. convert script.bin to script.fex
3. edit script.fex, e.g.:
Code: [Select]
[uart_para6]
uart_used = 0
uart_port = 6
uart_type = 2
uart_tx = port:PA12<4><1><default><default>
uart_rx = port:PA13<4><1><default><default>
4. convert script.fex to script.bin

From Robert C. Nelson/Digikey:
1. use Ubuntu Lime image
2. change booting UART via the "${console}" variable in the uEnv.txt file
3. remember to update the getty redirect in the serial section
4. or edit the DTB file, e.g.:
Code: [Select]
uart0: serial@01c28000 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart0_pins_a>;
        status = "okay";
};

Does anyone know how to "update the getty redirect in the serial section"?

Does anyone know how to add a uart1 to the DTB file? Would this work:
Code: [Select]
uart1: serial@01c28400 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart1_pins_a>;
        status = "okay";
};

jmss

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Re: A10 Lime UART's for serial communication
« Reply #8 on: December 04, 2014, 05:30:55 PM »
Using the Ubuntu image from Robert C. Nelson I managed to make it work with this DTS entry (added after uart0 entry):

uart2: serial@01c28800 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart2_pins_a>;
        status = "okay";
};

uart1 is used for ethernet.

Build the kernel with ./build_kernel.sh, edit the DTS file and then run ./tools/rebuild.sh to compile the modified DTS file.

Don't forget to copy the DTB file (extract DTB package) to the micro-SD card after re-compiling it.

This UART uses pins 34 and 36 from GPIO2 and is available at /dev/ttyS1.

Check that UART2 is enabled by looking under /proc/device-tree.

jmss

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Re: A10 Lime UART's for serial communication
« Reply #9 on: December 11, 2014, 12:37:45 AM »
Does anyone know if the instructions from https://www.olimex.com/wiki/A20-OLinuXino-LIME#GPIO_under_Linux apply to the Ubuntu image (which uses DTBs instead of Allwinner's FEX)?

JohnS

  • Hero Member
  • *****
  • Posts: 1723
  • Karma: +33/-48
Re: A10 Lime UART's for serial communication
« Reply #10 on: December 11, 2014, 01:11:07 AM »
Which exact Ubuntu?

It is fairly likely there will be changes, depending on the exact one, since all this is bleeding edge with AW and DT.

If you got it from site XXX then asking whoever put it there / built it might be useful or even better: read the source :)

John
« Last Edit: December 11, 2014, 01:12:49 AM by JohnS »

jmss

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Re: A10 Lime UART's for serial communication
« Reply #11 on: December 11, 2014, 01:16:41 AM »
Which exact Ubuntu?

It is fairly likely there will be changes, depending on the exact one, since all this is bleeding edge with AW and DT.

John

The one from Robert C. Nelson: https://eewiki.net/display/linuxonarm/A20-OLinuXino-LIME

I tried to control pin PC3 to power down SATA, but it did nothing. So I thought I might be controlling something else, since it's not a Debian image with FEX configuration from Allwinner.

But I can't see anywhere in the DTS file where do you define the GPIOs. There is however an entry for the PC3 pin in the DTS file:

                        ahci_pwr_pin_olinuxinolime: ahci_pwr_pin@1 {
                                allwinner,pins = "PC3";
                                allwinner,function = "gpio_out";
                                allwinner,drive = <0>;
                                allwinner,pull = <0>;
                        };

jmss

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Re: A10 Lime UART's for serial communication
« Reply #12 on: December 11, 2014, 01:19:39 AM »
If you got it from site XXX then asking whoever put it there / built it might be useful or even better: read the source :)

John

Which file should I look into?

Thanks.

JohnS

  • Hero Member
  • *****
  • Posts: 1723
  • Karma: +33/-48
Re: A10 Lime UART's for serial communication
« Reply #13 on: December 11, 2014, 10:10:47 AM »
I'd start with the kernel doc to see how it's supposed to work and hope that's a guide to roughly which file(s).  I hope the doc in effect explains the naming conventions and what gets the names into the FS, thus making it fairly easy to find the files.

If the doc fails to do that then please figure a patch and/or raise it as an issue with the GPIO maintainer(s) as it will just bite other people until fixed.

find and grep will get you from there to the C and/or H file(s) within seconds I hope.

John

iz4ako

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: A10 Lime UART's for serial communication
« Reply #14 on: January 13, 2015, 03:50:04 PM »
Hello,
please could someone check my script.fex. I want to anable all the UART phisically available trought GPIO_xx connectors.


[uart_para0]
uart_used = 1
uart_port = 0
uart_type = 2
uart_tx = port:PB22<2><1><default><default>
uart_rx = port:PB23<2><1><default><default>

[uart_para1]
uart_used = 0
uart_port = 1
uart_type = 8
uart_tx = port:PA10<4><1><default><default>
uart_rx = port:PA11<4><1><default><default>
uart_rts = port:PA12<4><1><default><default>
uart_cts = port:PA13<4><1><default><default>
uart_dtr = port:PA14<4><1><default><default>
uart_dsr = port:PA15<4><1><default><default>
uart_dcd = port:PA16<4><1><default><default>
uart_ring = port:PA17<4><1><default><default>

[uart_para2]
uart_used = 1
uart_port = 2
uart_type = 4
uart_tx = port:PI18<3><1><default><default>
uart_rx = port:PI19<3><1><default><default>
uart_rts = port:PI16<3><1><default><default>
uart_cts = port:PI17<3><1><default><default>

[uart_para3]
uart_used = 1
uart_port = 3
uart_type = 4
uart_tx = port:PG06<4><1><default><default>
uart_rx = port:PG07<4><1><default><default>
uart_rts = port:PG08<4><1><default><default>
uart_cts = port:PG09<4><1><default><default>

[uart_para4]
uart_used = 1
uart_port = 4
uart_type = 2
uart_tx = port:PG10<4><1><default><default>
uart_rx = port:PG11<4><1><default><default>

[uart_para5]
uart_used = 1
uart_port = 5
uart_type = 2
uart_tx = port:PI10<3><1><default><default>
uart_rx = port:PI11<3><1><default><default>

[uart_para6]
uart_used = 1
uart_port = 6
uart_type = 2
uart_tx = port:PI12<3><1><default><default>
uart_rx = port:PI13<3><1><default><default>

[uart_para7]
uart_used = 1
uart_port = 7
uart_type = 2
uart_tx = port:PI20<3><1><default><default>
uart_rx = port:PI21<3><1><default><default>

[tvout_para]
tvout_used = 0
tvout_channel_num = 1
tv_en = port:PI12<1><default><default><0>

[gpio_para]
gpio_used = 1
gpio_num = 62
gpio_pin_1 = port:PG00<0><default><default><default>
gpio_pin_2 = port:PG01<0><default><default><default>
gpio_pin_3 = port:PG02<0><default><default><default>
gpio_pin_4 = port:PG03<0><default><default><default>
gpio_pin_5 = port:PG04<0><default><default><default>
gpio_pin_6 = port:PG05<0><default><default><default>
gpio_pin_7 = port:PC17<0><default><default><default>
gpio_pin_8 = port:PC18<0><default><default><default>
gpio_pin_9 = port:PC23<0><default><default><default>
gpio_pin_10 = port:PC24<0><default><default><default>
gpio_pin_11 = port:PH00<0><default><default><default>
gpio_pin_12 = port:PH02<0><default><default><default>
gpio_pin_13 = port:PH09<0><default><default><default>
gpio_pin_14 = port:PH10<0><default><default><default>
gpio_pin_15 = port:PH11<0><default><default><default>
gpio_pin_16 = port:PH12<0><default><default><default>
gpio_pin_17 = port:PH13<0><default><default><default>
gpio_pin_18 = port:PH14<0><default><default><default>
gpio_pin_19 = port:PH15<0><default><default><default>
gpio_pin_20 = port:PH16<0><default><default><default>
gpio_pin_21 = port:PH17<0><default><default><default>
gpio_pin_22 = port:PH18<0><default><default><default>
gpio_pin_23 = port:PH19<0><default><default><default>
gpio_pin_24 = port:PH20<0><default><default><default>
gpio_pin_25 = port:PH21<0><default><default><default>
gpio_pin_26 = port:PH22<0><default><default><default>
gpio_pin_27 = port:PH23<0><default><default><default>
gpio_pin_28 = port:PH24<0><default><default><default>
gpio_pin_29 = port:PH25<0><default><default><default>
gpio_pin_30 = port:PH26<0><default><default><default>
gpio_pin_31 = port:PH27<0><default><default><default>
gpio_pin_32 = port:PB03<0><default><default><default>
gpio_pin_33 = port:PB04<0><default><default><default>
gpio_pin_34 = port:PB05<0><default><default><default>
gpio_pin_35 = port:PB06<0><default><default><default>
gpio_pin_36 = port:PB07<0><default><default><default>
gpio_pin_37 = port:PB10<0><default><default><default>
gpio_pin_38 = port:PB11<0><default><default><default>
gpio_pin_39 = port:PB12<0><default><default><default>
gpio_pin_40 = port:PB13<0><default><default><default>
gpio_pin_41 = port:PB14<0><default><default><default>
gpio_pin_42 = port:PB15<0><default><default><default>
gpio_pin_43 = port:PB16<0><default><default><default>
gpio_pin_44 = port:PB17<0><default><default><default>
gpio_pin_45 = port:PI00<0><default><default><default>
gpio_pin_46 = port:PI01<0><default><default><default>
gpio_pin_47 = port:PI02<0><default><default><default>
gpio_pin_48 = port:PI03<0><default><default><default>
gpio_pin_49 = port:PI04<0><default><default><default>
gpio_pin_50 = port:PI05<0><default><default><default>
gpio_pin_51 = port:PI06<0><default><default><default>
gpio_pin_52 = port:PI07<0><default><default><default>
gpio_pin_53 = port:PI08<0><default><default><default>
gpio_pin_54 = port:PI09<0><default><default><default>
gpio_pin_55 = port:PI14<0><default><default><default>
gpio_pin_56 = port:PI15<0><default><default><default>
gpio_pin_57 = port:PE00<0><default><default><default>
gpio_pin_58 = port:PE01<0><default><default><default>
gpio_pin_59 = port:PE02<0><default><default><default>
gpio_pin_60 = port:PE03<0><default><default><default>
gpio_pin_61 = port:PE04<0><default><default><default>
gpio_pin_62 = port:PE05<0><default><default><default>

[gpio_init]
pin_1 = port:PG00<0><default><default><default>
pin_2 = port:PG01<0><default><default><default>
pin_3 = port:PG02<0><default><default><default>
pin_4 = port:PG03<0><default><default><default>
pin_5 = port:PG04<0><default><default><default>
pin_6 = port:PG05<0><default><default><default>
pin_7 = port:PC17<0><default><default><default>
pin_8 = port:PC18<0><default><default><default>
pin_9 = port:PC23<0><default><default><default>
pin_10 = port:PC24<0><default><default><default>
pin_11 = port:PH00<0><default><default><default>
pin_12 = port:PH02<0><default><default><default>
pin_13 = port:PH09<0><default><default><default>
pin_14 = port:PH10<0><default><default><default>
pin_15 = port:PH11<0><default><default><default>
pin_16 = port:PH12<0><default><default><default>
pin_17 = port:PH13<0><default><default><default>
pin_18 = port:PH14<0><default><default><default>
pin_19 = port:PH15<0><default><default><default>
pin_20 = port:PH16<0><default><default><default>
pin_21 = port:PH17<0><default><default><default>
pin_22 = port:PH18<0><default><default><default>
pin_23 = port:PH19<0><default><default><default>
pin_24 = port:PH20<0><default><default><default>
pin_25 = port:PH21<0><default><default><default>
pin_26 = port:PH22<0><default><default><default>
pin_27 = port:PH23<0><default><default><default>
pin_28 = port:PH24<0><default><default><default>
pin_29 = port:PH25<0><default><default><default>
pin_30 = port:PH26<0><default><default><default>
pin_31 = port:PH27<0><default><default><default>
pin_32 = port:PB03<0><default><default><default>
pin_33 = port:PB04<0><default><default><default>
pin_34 = port:PB05<0><default><default><default>
pin_35 = port:PB06<0><default><default><default>
pin_36 = port:PB07<0><default><default><default>
pin_37 = port:PB10<0><default><default><default>
pin_38 = port:PB11<0><default><default><default>
pin_39 = port:PB12<0><default><default><default>
pin_40 = port:PB13<0><default><default><default>
pin_41 = port:PB14<0><default><default><default>
pin_42 = port:PB15<0><default><default><default>
pin_43 = port:PB16<0><default><default><default>
pin_44 = port:PB17<0><default><default><default>
pin_45 = port:PI00<0><default><default><default>
pin_46 = port:PI01<0><default><default><default>
pin_47 = port:PI02<0><default><default><default>
pin_48 = port:PI03<0><default><default><default>
pin_49 = port:PI04<0><default><default><default>
pin_50 = port:PI05<0><default><default><default>
pin_51 = port:PI06<0><default><default><default>
pin_52 = port:PI07<0><default><default><default>
pin_53 = port:PI08<0><default><default><default>
pin_54 = port:PI09<0><default><default><default>
pin_55 = port:PI14<0><default><default><default>
pin_56 = port:PI15<0><default><default><default>
pin_57 = port:PE00<0><default><default><default>
pin_58 = port:PE01<0><default><default><default>
pin_59 = port:PE02<0><default><default><default>
pin_60 = port:PE03<0><default><default><default>
pin_61 = port:PE04<0><default><default><default>
pin_62 = port:PE05<0><default><default><default>