how to configure UART4 with RTSCTS mode on iMX6 ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to configure UART4 with RTSCTS mode on iMX6 ?

6,996 Views
abraham_v
Contributor IV

Hello,

I'm trying to interface an iMX6 (dual core) with a bluetooth module via the UART4 bus. (end-user will see android, code below is from linux kernel) I've done the following in my board file,

static const struct imxuart_platform_data mx6q_sd_uart4_data __initconst = {

    .flags      = IMXUART_HAVE_RTSCTS,

    .dma_req_rx =   MX6Q_DMA_REQ_UART4_RX,

    .dma_req_tx = MX6Q_DMA_REQ_UART4_TX,

};

static inline void mx6q_sabresd_init_uart(void)

{

    // imx6q_add_imx_uart(3, NULL);

    imx6q_add_imx_uart(3, &mx6q_sd_uart4_data);

    imx6q_add_imx_uart(0, NULL);

}

But it does not work.

Specifically, when I probe (with an Oscilloscope) the CTS and RTS lines (with respect to iMX6), I can see CTS line toggling - indicating that my bluetooth module wants to talk to the iMX6. But the RTS line just stays high. Which means that from my bluetooth module's point-of-view, the iMX6 is not ready to receive any data. Does anyone know how I could fix this?

For reference here are snippets of how I've done the pin multiplexing,

> cat arch/arm/mach-mx6/board-mx6q_sabresd.h

/*

* Copyright (C) 2012-2013 Freescale Semiconductor, Inc. All Rights Reserved.

<comments snipped out>

*/

#define _BOARD_MX6Q_SABRESD_H

#include <mach/iomux-mx6q.h>

static iomux_v3_cfg_t mx6q_sabresd_pads[] = {

  MX6Q_PAD_CSI0_DAT4__GPIO_5_22,   /* LCD reset at pad N1 */

MX6Q_PAD_SD3_DAT6__UART1_RXD,

  MX6Q_PAD_SD3_DAT7__UART1_TXD,

// un-needed pins snipped out

/********************* Wifi and bluetooth PIN mux **************************************************/

  MX6Q_PAD_CSI0_DAT12__UART4_TXD, /* uart transmit at pad M2 */

  MX6Q_PAD_CSI0_DAT13__UART4_RXD, /* uart receive at pad L1 */

  MX6Q_PAD_CSI0_DAT16__UART4_RTS, /* UART RTS at pad L4 */

  MX6Q_PAD_CSI0_DAT17__UART4_CTS, /* UART CTS at pad L3 */

  MX6Q_PAD_CSI0_DAT19__GPIO_6_5, /* bluetooth gpio pin at pad L6 */

};

-Abraham V.

Labels (4)
Tags (3)
4 Replies

1,703 Views
rickchu
Contributor IV

Hi Abraham,

You may need to check if your hardware design as below describe; in Freescale's SoC, the defination in CTS and RTS are different with other vendor (Samsung, Ti and etc).

MX6Q_PAD_CSI0_DAT17__UART4_CTS connect to Bluetooth's "CTS"
and
MX6Q_PAD_CSI0_DAT16__UART4_RTS connect to Bluetooth's "RTS"

Rick

1,703 Views
sivakumarganesa
Contributor III

Hi Rick Chu,

I have already connected CTS to CTS , and RTS to RTS lines between the iMX6SoloLite processor and WL1835 chip. and TX and RX has been swapped.  Even thought Bluetooth communication is not happening. Below i mentioned the error which we are getting while we loading the kernal. If you have any idea please suggest me.

Starting kernel ...

Booting Linux on physical CPU 0x0

Linux version 3.10.53 (root@vivek-To-be-filled-by-O-E-M) (gcc version 4.8.1 (GCC) ) #147 SMP PREEMPT Mon Mar 2 11:04:38 IST 2015

CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d

CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache

Machine: Freescale i.MX6 SoloLite (Device Tree), model: Freescale i.MX6 SoloLite EVK Board(PFUZE100)

cma: CMA: reserved 320 MiB at 8c000000

Memory policy: ECC disabled, Data cache writealloc

PERCPU: Embedded 8 pages/cpu @80cec000 s8960 r8192 d15616 u32768

Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048

Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk0p2 rootwait rw

PID hash table entries: 2048 (order: 1, 8192 bytes)

Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)

Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)

Memory: 512MB = 512MB total

Memory: 182260k/182260k available, 342028k reserved, 0K highmem

Virtual kernel memory layout:

    vector  : 0xffff0000 - 0xffff1000   (   4 kB)

    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

    vmalloc : 0xa0800000 - 0xff000000   (1512 MB)

    lowmem  : 0x80000000 - 0xa0000000   ( 512 MB)

    pkmap   : 0x7fe00000 - 0x80000000   (   2 MB)

    modules : 0x7f000000 - 0x7fe00000   (  14 MB)

      .text : 0x80008000 - 0x807db8dc   (8015 kB)

      .init : 0x807dc000 - 0x80826300   ( 297 kB)

      .data : 0x80828000 - 0x80875320   ( 309 kB)

       .bss : 0x80875320 - 0x808dd55c   ( 417 kB)

SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1

Preemptible hierarchical RCU implementation.

  RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=1.

NR_IRQS:16 nr_irqs:16 16

L310 cache controller enabled

l2x0: 16 ways, CACHE_ID 0x410000c8, AUX_CTRL 0x32030000, Cache size: 262144 B

sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956ms

Console: colour dummy device 80x30

Calibrating delay loop... 1581.05 BogoMIPS (lpj=7905280)

pid_max: default: 32768 minimum: 301

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

CPU0: thread -1, cpu 0, socket 0, mpidr 80000000

Setting up static identity map for 0x805ce878 - 0x805ce8d0

Brought up 1 CPUs

SMP: Total of 1 processors activated (1581.05 BogoMIPS).

CPU: All CPU(s) started in SVC mode.

devtmpfs: initialized

pinctrl core: initialized pinctrl subsystem

regulator-dummy: no parameters

NET: Registered protocol family 16

DMA: preallocated 256 KiB pool for atomic coherent allocations

Use WDOG1 as reset source

syscon 20c8000.anatop: regmap [mem 0x020c8000-0x020c8fff] registered

vdd1p1: 800 <--> 1375 mV at 1125 mV

vdd3p0: 2800 <--> 3150 mV at 3000 mV

vdd2p5: 2100 <--> 2850 mV at 2525 mV

cpu: 725 <--> 1450 mV at 1100 mV

vddpu: 725 <--> 1450 mV at 1100 mV

vddsoc: 725 <--> 1450 mV at 1175 mV

syscon 20e0000.iomuxc-gpr: regmap [mem 0x020e0000-0x020e0037] registered

syscon 21bc000.ocotp-ctrl: regmap [mem 0x021bc000-0x021bffff] registered

hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.

hw-breakpoint: maximum watchpoint size is 4 bytes.

imx6sl-pinctrl 20e0000.iomuxc: initialized IMX pinctrl driver

bio: create slab <bio-0> at 0

lcd-3v3: no parameters

wm8962-supply-3v15: 3150 mV

wm8962-supply-4v2: 4325 mV

wm8962-supply-1v8: 1800 mV

ov5642-supply-2v8: 2800 mV

ov5642-supply-1v8: 1800 mV

ov5642-supply-1v5: 1500 mV

wlan-en-regulator: 1800 mV

reg-fixed-voltage regulator.21: Fixed regulator specified with variable voltages

reg-fixed-voltage: probe of regulator.21 failed with error -22

i2c-core: driver [max17135] using legacy suspend method

i2c-core: driver [max17135] using legacy resume method

SCSI subsystem initialized

i2c i2c-0: IMX I2C adapter registered

i2c i2c-1: IMX I2C adapter registered

media: Linux media interface: v0.10

Linux video capture interface: v2.00

pps_core: LinuxPPS API ver. 1 registered

pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>

PTP clock support registered

MIPI CSI2 driver module loaded

ads129x: Driver-Driver Initads129x: mutex init ads129x: sem init ads129x: Init succesfullads129x: 0, 0 retAdvanced Linux Sound Architecture Driver Initialized.

Bluetooth: Core ver 2.16

NET: Registered protocol family 31

Bluetooth: HCI device and connection manager initialized

Bluetooth: HCI socket layer initialized

Bluetooth: L2CAP socket layer initialized

Bluetooth: SCO socket layer initialized

pureg-dummy: no parameters

Switching to clocksource mxc_timer1

NET: Registered protocol family 2

TCP established hash table entries: 4096 (order: 3, 32768 bytes)

TCP bind hash table entries: 4096 (order: 3, 32768 bytes)

TCP: Hash tables configured (established 4096 bind 4096)

TCP: reno registered

UDP hash table entries: 256 (order: 1, 8192 bytes)

UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)

NET: Registered protocol family 1

RPC: Registered named UNIX socket transport module.

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

RPC: Registered tcp NFSv4.1 backchannel transport module.

hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available

imx6_busfreq busfreq.2: busfreq_probe: failed to get pll3_usb_otg

imx6_busfreq: probe of busfreq.2 failed with error -2

Bus freq driver module loaded

futex hash table entries: 256 (order: 2, 16384 bytes)

VFS: Disk quotas dquot_6.5.2

Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)

NFS: Registering the id_resolver key type

Key type id_resolver registered

Key type id_legacy registered

jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.

fuse init (API version 7.22)

msgmni has been set to 995

io scheduler noop registered

io scheduler deadline registered

io scheduler cfq registered (default)

MIPI DSI driver module loaded

ILI9163 driver initimx-sdma 20ec000.sdma: loaded firmware 1.1

imx-sdma 20ec000.sdma: initialized

pfuze100-regulator 0-0008: unrecognized pfuze chip ID!

pfuze100-regulator: probe of 0-0008 failed with error -5

Serial: IMX driver

imx:uart RTS failed2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 58) is a IMX

console [ttymxc0] enabled

imx:uart has RTS/CTS2038000.serial: ttymxc3 at MMIO 0x2038000 (irq = 61) is a IMX

serial: Freescale lpuart driver

imx sema4 driver is registered.

[drm] Initialized drm 1.1.0 20060810

brd: module loaded

loop: module loaded

kim:/dev/ttymxc3 kim:1 kim:0 kim:115200 Kim: requested shutdown gpio succesfully(stk) :sysfs entries created

debugfs entries created ads129x: ads129x_probe

ads129x spi32766.0: No reset-gpios gpio

IRQ: 238

ads129x:ADS Chip registered, 1 chips total.

spi_imx 2008000.ecspi: probed

ili9163: LCD probe function calledili9163: Request CTS ili9163: Request Shutdown ili9163: pmw ON

ili9163: vmem ON

Console: switching to colour frame buffer device 16x20

ili9163: registerFB done

ili9163: spi_set_drv_data

fb0: ili9163fb frame buffer device,

  using 40960 KiB of video memory

spi_imx 200c000.ecspi: probed

CAN device driver interface

mousedev: PS/2 mouse device common for all mice

input: TSC2007 Touchscreen as /devices/virtual/input/input0

snvs_rtc 20cc034.snvs-rtc-lp: rtc core: registered 20cc034.snvs-rtc-lp as rtc0

i2c /dev entries driver

i2c-core: driver [mag3110] using legacy suspend method

i2c-core: driver [mag3110] using legacy resume method

imx2-wdt 20bc000.wdog: IMX2+ Watchdog Timer enabled. timeout=60s (nowayout=0)

Bluetooth: HCI UART driver ver 2.2

Bluetooth: HCI H4 protocol initialized

Bluetooth: HCI BCSP protocol initialized

Bluetooth: HCILL protocol initialized

Bluetooth: Generic Bluetooth SDIO driver ver 0.1

hdev 8602d000

HCI device registered (hdev 8602d000)

cpuidle: using governor ladder

cpuidle: using governor menu

hci0 8602d000

(stc):  chnl_id list empty :4

(stk) : st_kim_startuse device tree data

kim: Bluetooth GPIO startsdhci: Secure Digital Host Controller Interface driver

sdhci: Copyright(c) Pierre Ossman

sdhci-pltfm: SDHCI platform and OF driver helper

mmc0: no vqmmc regulator found

mmc0: no vmmc regulator found

mmc0: SDHCI controller on 2190000.usdhc [2190000.usdhc] using DMA

sdhci-esdhc-imx 2198000.usdhc: could not get ultra high speed state, work on normal mode

mmc1: no vqmmc regulator found

mmc0: new high speed SDHC card at address 59b4

mmcblk0: mmc0:59b4 USD   3.74 GiB

mmcblk0: p1 p2

(stk) :ldisc_install = 1mmc1: SDHCI controller on 2198000.usdhc [2198000.usdhc] using DMA

[drm] Supports vblank timestamp caching Rev 1 (10.10.2010).

mmc1: card claims to support voltages below the defined range. These will be ignored.

[drm] No driver support for vblank timestamp query.

[drm] Initialized imx-drm 1.0.0 20120507 on minor 0

mmc1: queuing unknown CIS tuple 0x91 (3 bytes)

mmc1: new high speed SDIO card at address 0001

wm8962 1-001a: customer id 0 revision F

input: WM8962 Beep Generator as /devices/soc0/soc.1/2100000.aips-bus/21a8000.i2c/i2c-1/1-001a/input/input1

imx-wm8962 sound.24:  wm8962 <-> 202c000.ssi mapping ok

NET: Registered protocol family 26

TCP: cubic registered

NET: Registered protocol family 10

sit: IPv6 over IPv4 tunneling driver

NET: Registered protocol family 17

can: controller area network core (rev 20120528 abi 9)

NET: Registered protocol family 29

can: raw protocol (rev 20120528)

can: broadcast manager protocol (rev 20120528 t)

can: netlink gateway (rev 20130117) max_hops=1

Bluetooth: RFCOMM TTY layer initialized

Bluetooth: RFCOMM socket layer initialized

Bluetooth: RFCOMM ver 1.11

Bluetooth: BNEP (Ethernet Emulation) ver 1.3

Bluetooth: BNEP filters: protocol multicast

Bluetooth: BNEP socket layer initialized

Bluetooth: HIDP (Human Interface Emulation) ver 1.2

Bluetooth: HIDP socket layer initialized

8021q: 802.1Q VLAN Support v1.8

Key type dns_resolver registered

VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4

imx6-cpufreq imx6-cpufreq.0: failed to get regulators

imx6-cpufreq: probe of imx6-cpufreq.0 failed with error -2

ov5642-supply-1v5: disabling

ov5642-supply-1v8: disabling

ov5642-supply-2v8: disabling

wm8962-supply-1v8: disabling

wm8962-supply-4v2: disabling

wm8962-supply-3v15: disabling

lcd-3v3: disabling

vddpu: disabling

regulator-dummy: disabling

imx mcc test is registered.

snvs_rtc 20cc034.snvs-rtc-lp: setting system clock to 1970-01-01 00:00:00 UTC (0)

ALSA device list:

  #0: wm8962-audio

(stk) :ldisc installation timeoutuse device tree data

(stk) :ldisc_install = 0

(stk) : timed out waiting for ldisc to be un-installed

kim: Bluetooth GPIO start(stk) :ldisc_install = 1

(stk) :ldisc installation timeoutuse device tree data

(stk) :ldisc_install = 0

kjournald starting.  Commit interval 5 seconds

EXT3-fs (mmcblk0p2): using internal journal

EXT3-fs (mmcblk0p2): recovery complete

EXT3-fs (mmcblk0p2): mounted filesystem with ordered data mode

VFS: Mounted root (ext3 filesystem) on device 179:2.

devtmpfs: mounted

Freeing unused kernel memory: 296K (807dc000 - 80826000)

INIT: version 2.88 booting(stk) : timed out waiting for ldisc to be un-installed

kim: Bluetooth GPIO start(stk) :ldisc_install = 1

Starting udev

udevd[121]: starting version 182

(stk) :ldisc installation timeoutuse device tree data

(stk) :ldisc_install = 0

bootlogd: cannot allocate pseudo tty: No such file or directory

Loading modules backported from Linux version R8.5-0-gcb51164

Backport generated by backports.git R8.4-0-g0d46f43

ov5640_read_reg:write reg error:reg=300a

camera ov5640 is not found

(stk) : timed out waiting for ldisc to be un-installed

kim: Bluetooth GPIO start(stk) :ldisc_install = 1

csi_v4l_open: Internal error, camera is not found!

cfg80211: Calling CRDA to update world regulatory domain

(stk) :ldisc installation timeoutuse device tree data

(stk) :ldisc_install = 0

cfg80211: World regulatory domain updated:

wlcore: ERROR could not get configuration binary ti-connectivity/wl18xx-conf.bin: -2

cfg80211:  DFS Master region: unset

cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)

wlcore: WARNING falling back to default config

cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)

cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)

cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)

cfg80211:   (5170000 KHz - 5250000 KHz @ 160000 KHz), (N/A, 2000 mBm), (N/A)

cfg80211:   (5250000 KHz - 5330000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)

cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)

cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)

cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)

wlcore: wl18xx HW: 183x or 180x, PG 2.2 (ROM 0x11)

wlcore: loaded

wlcore: driver version: R8.5

wlcore: compilation time: Mon Mar  2 05:40:54 2015

FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

(stk) : timed out waiting for ldisc to be un-installed

kim: Bluetooth GPIO start(stk) :ldisc_install = 1ALSA: Restoring mixer settings...

Fri Feb 20 11:27:36 UTC 2015

INIT: Entering runlevel: 5Configuring network interfaces... ifconfig: SIOCGIFFLAGS: No such device

Starting Xserver

Starting system message bus: Unknown username "xuser" in message bus configuration file

Unknown username "avahi" in message bus configuration file

dbus.

(stk) :ldisc installation timeoutuse device tree data

(stk) :ldisc_install = 0

Starting Connection Manager

Starting Dropbear SSH server: dropbear.

(stk) : timed out waiting for ldisc to be un-installed

kim: Bluetooth GPIO start(stk) :ldisc_install = 1

Starting rpcbind daemon...done.

rpcbind: cannot get uid of 'rpc': Success

(stk) :ldisc installation timeoutuse device tree data

(stk) :ldisc_install = 0

Starting advanced power management daemon: No APM support in kernel

(failed.)

Starting syslogd/klogd: done

* Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon

(stk) : timed out waiting for ldisc to be un-installed

Bluetooth: st_register failed -22

Timeout reached while wating for return value

Could not receive return value from daemon process.

   ...fail!

Starting Telephony daemon

Starting Linux NFC daemon

/etc/rc5.d/S64neard: line 26: /usr/lib/neard/neard: No such file or directory

Running local boot scripts (/etc/rc.local)Successfully initialized wpa_supplicant

Line 61: unknown global field 'p2p_go_ht40=1'.

Line 61: Invalid configuration line 'p2p_go_ht40=1'.

Line 63: unknown global field 'concurrent_sched_scan=1'.

Line 63: Invalid configuration line 'concurrent_sched_scan=1'.

Line 64: unknown global field 'p2p_disabled=1'.

Line 64: Invalid configuration line 'p2p_disabled=1'.

Failed to read or parse configuration '/etc/wpa_supplicant.conf'.

wlcore: PHY firmware version: Rev 8.2.0.0.224

wlcore: firmware booted (Rev 8.9.0.0.31)

IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready

.

Poky (Yocto Project Reference Distro) 1.7 imx6slevk /dev/ttymxc0

imx6slevk login:

Thanks,

Sivakumar

0 Kudos

1,703 Views
abraham_v
Contributor IV
You may need to check if your hardware design as below describe; in Freescale's SoC, the defination in CTS and RTS are different with other vendor (Samsung, Ti and etc).

Yikes!

...

For better or worse, this appears to be the issue. We've worked with chips from other manufacturers before and just assumed that it would be the same for Freescale as well (with regards to UART). As a result, our CTS and RTS lines have been swapped. :smileysad:

Does anyone know if there is anyway to fix this issue from software? Perhaps some way to tell the driver to use the CTS line in RTS mode and vice-versa?

Worried,

Abraham V.

0 Kudos

1,703 Views
mattreimer
Contributor I

You should be able to handle this in software by setting UART4_UFCR[DCEDTE] and IOMUXC_UART4_UART_RTS_B_SELECT_INPUT appropriately. Note that IOMUXC_UART4_UART_RTS_B_SELECT_INPUT is normally set by

MX6Q_PAD_CSI0_DAT16__UART4_RTS and MX6Q_PAD_CSI0_DAT17__UART4_CTS, but note that they both set IOMUXC_UART4_UART_RTS_B_SELECT_INPUT so make sure MX6Q_PAD_CSI0_DAT16__UART4_RTS comes last in the list, so its value is the one that is written last.

Matt

0 Kudos