Changes

How to set up UART2 in J990

7,583 bytes added, 13:40, 1 July 2015
no edit summary
{{Message/Information Message|title=TITLE|message=This How-To was tested under Kernel 2.6.35.y but content are valid for Kernel 2.6.37.y}}
= Overview =
This How-To is meant to be a starting point for people to learn to set up UART2 for IGEPv2 J990 connector as quickly and easily as possible. In this how-to, we use [http://releases.linaro.org/platform/linaro-m/headless/final/linaro-m-headless-tar-20101108-2.tar.gz Linaro Headless] with [[Linux Kernel 2.6.35.y|Kernel 2.6.35.y]]. This How-To is focused for revisions RC1/RC3/RC4/RC6 (WIFI/BT versions). <br>
More information about UART: [http://en.wikipedia.org/wiki/UART UARTUniversal_asynchronous_receiver/transmitter <span style="text-decoration: underline;">here</span>] and [[How to use UARTs|here]].'''<br>'''
There are two three modes to configure UART2 in J990: via user space (fast modefirst way), editing only igep.ini (second way) or editing kernel source and compile it (slow modethird way).  '''NOTE: '''UART2 in j990 connector has CMOS voltages (0V-1V8).
= Feedback and Contributing =
At any point, if you see a mistake you can contribute to this How-To.<br>  = First way<br> = First way: this mode has an issue, when your system reboot or shutdown you will need to configure again. Using user space to configure mux and disable bluetooth.<br>
=== Configure IGEP ===
Fast Mode, set up UART2 until system reboot or halt. Using space to configure mux and disabling bluethoot. Default kernel binaries and source have disabled TWL4030 PCM voice interface output pins to high impedance, otherwise this module forces the level of mcbsp3_fsx and mcbsp3_clkx pins. To make sure, go to ~/sound/soc/codecs/twl4030.c file already read: <pre> 0x04, /* REG_VOICE_IF (0xF) */</pre> Make sure that If you use a IGEPv2 Expansion is disabledBoard, go to igep.ini file: <pre>;buddy=igep0022 </pre> Log with root user via SSH or Serial cable.don't use modem for this tutorial<br>
Go to /sys/kernel/debug/omap_mux/. '''Disable Bluetooth:'''
Logging with root user via SSH or Serial cable.<br> '''Disable BluethootNOTE:'''Poky distribution does not have debug filesystem enabled. Mount it: <pre>mount -t debugfs none /sys/kernel/debug</pre> Go to /sys/kernel/debug/omap_mux/<br>
Set sdmmc2_dat5 to GPIO gpio137 (mode4):
<pre>echo 0x004 &gt; sdmmc2_dat5 </pre>
Check Revise that:
<pre>root@localhost:/sys/kernel/debug/omap_mux# cat sdmmc2_dat5
name: sdmmc2_dat5.gpio_137 (0x48002166/0x136 = 0x0004), b ah3, t NA
mode: OMAP_PIN_OUTPUT | OMAP_MUX_MODE4
signals: sdmmc2_dat5 | sdmmc2_dir_dat1 | cam_global_reset | sdmmc3_dat1 | gpio_137 | hsusb3_tll_stp | mm3_rxdp | safe_mode
</pre>Go to: /sys/class/gpio/  Check that gpio137 is in user space: <pre>root@localhost:/sys/class/gpio# lsexport gpio137 gpio138 gpio139 gpio170 gpio64 gpiochip0 gpiochip128 gpiochip160 gpiochip192 gpiochip32 gpiochip64 gpiochip96 unexportroot@localhost:/sys/class/gpio# </pre> If you don't have it, you should export gpio137: <br> <pre>echo 137 &gt; /sys/class/gpio/export </pre> Set gpio137 to low value to disable bluetooth: <pre>echo 0 &gt; /sys/class/gpio/gpio137/value</pre> Revise that: <pre>root@localhost:/sys/class/gpio# cat /sys/class/gpio/gpio137/value 0root@localhost:/sys/class/gpio# </pre> '''Disable Bluetooth UART2 wires:'''  Go to /sys/kernel/debug/omap_mux/  Type: <pre>echo 0x007 &gt; uart2_ctsecho 0x007 &gt; uart2_rtsecho 0x007 &gt; uart2_rxecho 0x007 &gt; uart2_tx </pre> Revise that: <pre>root@localhost:/sys/kernel/debug/omap_mux# cat uart2_cts name: uart2_cts.safe_mode (0x48002174/0x144 = 0x0007), b ab26, t NAmode: OMAP_PIN_OUTPUT | OMAP_MUX_MODE7signals: uart2_cts | mcbsp3_dx | gpt9_pwm_evt | NA | gpio_144 | NA | NA | safe_moderoot@localhost:/sys/kernel/debug/omap_mux# cat uart2_rts name: uart2_rts.safe_mode (0x48002176/0x146 = 0x0007), b ab25, t NAmode: OMAP_PIN_OUTPUT | OMAP_MUX_MODE7signals: uart2_rts | mcbsp3_dr | gpt10_pwm_evt | NA | gpio_145 | NA | NA | safe_moderoot@localhost:/sys/kernel/debug/omap_mux# cat uart2_rx name: uart2_rx.safe_mode (0x4800217a/0x14a = 0x0007), b ad25, t NAmode: OMAP_PIN_OUTPUT | OMAP_MUX_MODE7signals: uart2_rx | mcbsp3_fsx | gpt8_pwm_evt | NA | gpio_147 | NA | NA | safe_moderoot@localhost:/sys/kernel/debug/omap_mux# cat uart2_txname: uart2_tx.safe_mode (0x48002178/0x148 = 0x0007), b aa25, t NAmode: OMAP_PIN_OUTPUT | OMAP_MUX_MODE7signals: uart2_tx | mcbsp3_clkx | gpt11_pwm_evt | NA | gpio_146 | NA | NA | safe_moderoot@localhost:/sys/kernel/debug/omap_mux# </pre> Mode will be 7 (safe_mode)  '''Enable UART2 in J990:'''  Type: <pre>echo 0x101 &gt; mcbsp3_dxecho 0x101 &gt; mcbsp3_clkxecho 0x101 &gt; mcbsp3_fsxecho 0x101 &gt; mcbsp3_dr </pre> Revise that: <pre>root@localhost:/sys/kernel/debug/omap_mux# cat mcbsp3_dx name: mcbsp3_dx.uart2_cts (0x4800216c/0x13c = 0x0101), b af6, t NAmode: OMAP_PIN_INPUT | OMAP_MUX_MODE1signals: mcbsp3_dx | uart2_cts | NA | NA | gpio_140 | hsusb3_tll_data4 | NA | safe_moderoot@localhost:/sys/kernel/debug/omap_mux# cat mcbsp3_clkx name: mcbsp3_clkx.uart2_tx (0x48002170/0x140 = 0x0101), b af5, t NAmode: OMAP_PIN_INPUT | OMAP_MUX_MODE1signals: mcbsp3_clkx | uart2_tx | NA | NA | gpio_142 | hsusb3_tll_data6 | NA | safe_moderoot@localhost:/sys/kernel/debug/omap_mux# cat mcbsp3_fsx name: mcbsp3_fsx.uart2_rx (0x48002172/0x142 = 0x0101), b ae5, t NAmode: OMAP_PIN_INPUT | OMAP_MUX_MODE1signals: mcbsp3_fsx | uart2_rx | NA | NA | gpio_143 | hsusb3_tll_data7 | NA | safe_moderoot@localhost:/sys/kernel/debug/omap_mux# cat mcbsp3_dr name: mcbsp3_dr.uart2_rts (0x4800216e/0x13e = 0x0101), b ae6, t NAmode: OMAP_PIN_INPUT | OMAP_MUX_MODE1signals: mcbsp3_dr | uart2_rts | NA | NA | gpio_141 | hsusb3_tll_data5 | NA | safe_moderoot@localhost:/sys/kernel/debug/omap_mux# </pre> Mode will be 1 (uart mode) = Second way<br> = Second way: configure kernel via IGEP Xloader. Configuration will be permanent.  '''NOTE:''' Only configures UART2_TX(6) and UART2_RX(8). You can not use UART2_CTS(4) AND UART2_RTS(10) which are usually referred to as hardware flow control. For example you can use RS232 but not RS485 peripheral. Don't use minicom with hardware flow control enable. <br> Go to igep.ini file, replaced by or type this: <pre>buddy=igep0022 buddy.modem=yes </pre> = Third way = Third way: configure kernel sources. Configuration will be permanent. There are many ways to edit source code, this method is focused for igep0020 RC without igep0022 support.<br>  === Configure Kernel source code === '''Disable TWL4030 PCM voice interface:'''  Default kernel&nbsp; has disabled TWL4030 PCM voice interface output pins to high impedance, otherwise this module forces the level of mcbsp3_fsx (uart2_rx) and mcbsp3_clkx (uart2_tx) pins. To make sure, go to [http://git.isee.biz/?p=pub/scm/linux-omap-2.6.git;a=blob_plain;f=sound/soc/codecs/twl4030.c;hb=linux-2.6.35.y $(kernel path)/sound/soc/codecs/twl4030.c] file already read: <br> <pre> 0x04, /* REG_VOICE_IF (0xF) */</pre> '''Disable bluetooth:'''  Go to [http://git.igep.es/?p=pub/scm/linux-omap-2.6.git;a=blob_plain;f=arch/arm/mach-omap2/board-igep0020.c;hb=refs/heads/linux-2.6.35.y $(kernel path)/arch/arm/mach-omap2/board-igep0020.c] and search next line: <pre> else if (hwrev == IGEP2_BOARD_HWREV_C) igep00x0_wifi_bt_init(IGEP2_RC_GPIO_WIFI_NPD, IGEP2_RC_GPIO_WIFI_NRESET, IGEP2_RC_GPIO_BT_NRESET, !opt); </pre> "igep00x0_wifi_bt_init" function initializes WIFI and Bluetooth peripherals. "opt" variable is used for disable Bluetooth in some cases: enabled (opt!=0) or disabled (opt==0). For example you can disable it permanently replacing "opt" by 1: <pre> else if (hwrev == IGEP2_BOARD_HWREV_C) igep00x0_wifi_bt_init(IGEP2_RC_GPIO_WIFI_NPD, IGEP2_RC_GPIO_WIFI_NRESET, IGEP2_RC_GPIO_BT_NRESET, !1); </pre> '''Disable UART2 default configuration:'''  Search again at the same file: "static struct omap_board_mux board_mux[] __initdata". Remove the following fields: <pre> OMAP3_MUX(UART2_TX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), OMAP3_MUX(UART2_RX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), </pre> Add the following fields below: <pre> OMAP3_MUX(UART2_TX, OMAP_MUX_MODE7 | OMAP_PIN_INPUT), OMAP3_MUX(UART2_RX, OMAP_MUX_MODE7 | OMAP_PIN_INPUT), OMAP3_MUX(UART2_RTS, OMAP_MUX_MODE7 | OMAP_PIN_INPUT), OMAP3_MUX(UART2_CTS, OMAP_MUX_MODE7 | OMAP_PIN_INPUT), </pre> '''Enable UART2 in J990:'''  Add the following fields under "OMAP3_MUX(UART2_CTS, OMAP_MUX_MODE7 | OMAP_PIN_INPUT), "&nbsp;:&nbsp; <pre> OMAP3_MUX(MCBSP3_DR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), OMAP3_MUX(MCBSP3_DX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), OMAP3_MUX(MCBSP3_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), OMAP3_MUX(MCBSP3_CLKX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),</pre> === Compile kernel source code === Use this [[Linux Kernel 2.6.35.y|tutorial]] (Kernel) and this [http://labs.igep.es/index.php/The_IGEP_X-loader other] (IGEPxloader) to install Linaro Headless with your custom kernel in SD card.&nbsp; You can compile the IGEPxloader, but is not necessary.<br> '''NOTE:''' for [[Linux_Kernel_2.6.37.y|Kernel 2.6.37.y]] you can use [[How_to_create_a_SD-card_with_the_latest_software_image|this tutorial]] removing default kernel for your new one<br> = Test UART2 in J990<br> = '''UART2 J990 pins:'''  <br>  {| cellspacing="1" cellpadding="1" width="200" border="1"|-| Pin | UART | Wire|-| 4 | UART2_CTS | MCBSP3_DX|-| 6 | UART2_TX | MCBSP3_CLKX|-| 8 | UART2_RX | MCBSP3_FSX|-| 10 | UART2_RTS | MCBSP3_DR|} <br>  === Test === '''NOTE: '''Starting from Kernel 2.6.37.y, ttySx are named ttyOx.  Connect UART2_TX with UART2_RX. Use minicom to prove UART2 (/dev/ttyS1)&nbsp;:<br> <pre>minicom -D /dev/ttyS1</pre> or<pre>microcom /dev/ttyS1 </pre>If you write characters and see the echo on the screen, you configure correctly UART.  {| cellspacing="1" cellpadding="1" width="200" border="1" align="center"|-| [[Image:Uart2 igepv2 j990 connector.png|800x500px]]  |} [[Category:UART]]
0
edits