Issues with UART communication on IMX6SLL EVK

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

Issues with UART communication on IMX6SLL EVK

2,644 Views
ekerebel
Contributor III

Hello,

I am trying to make implement a bluetooth module (DA14531) on my IMX6SLLEVK dev board, using the J4/ UART5 connection.

I implemented the following changes to my dts:

&uart5 {
	pinctrl-names = "default";
	/*pinctrl-0 = <&pinctrl_uart5>;*/
	uart-has-rtscts;
	/* for DTE mode, add below change */
	fsl,dte-mode; 
	pinctrl-0 = <&pinctrl_uart5dte>;
	dmas = <&sdma 33 4 2>, <&sdma 34 4 2>;
  	dma-names = "rx", "tx"; 
	status = "okay";
};


...


pinctrl_uart5: uart5grp {
		fsl,pins = <
			MX6SLL_PAD_ECSPI1_MOSI__UART5_DCE_TX 0x1b0b1
			MX6SLL_PAD_ECSPI1_SCLK__UART5_DCE_RX 0x1b0b1
			MX6SLL_PAD_ECSPI1_SS0__UART5_DCE_CTS 0x1b0b1
			MX6SLL_PAD_ECSPI1_MISO__UART5_DCE_RTS 0x1b0b1
		>;
	};

 

I also made the changes necessary to have dma installed as a module rather than in firmware.

Doing a hciattach fails with a timeout:

root@imx6sllevk:~# stty -F /dev/ttymxc4 115200 crtscts cs8 -cstopb -parenb -cread
root@imx6sllevk:~# hciattach -t 30 /dev/ttymxc4 any 115200 flow
Device setup complete
[ 2666.731916] Bluetooth: hci0: command 0x1003 tx timeout
[ 2668.811913] Bluetooth: hci0: command 0x1001 tx timeout
[ 2670.891909] Bluetooth: hci0: command 0x1009 tx timeout

 

The signals seem to be correct:

ekerebel_0-1660948583054.png

 

But nothing is being received on RX (see below, rx:0 for UART5) even though the bluetooth module is responding correctly.

root@imx6sllevk:~# cat /proc/tty/driver/IMX-uart
serinfo:1.0 driver revision:
0: uart:IMX mmio:0x02020000 irq:26 tx:31721 rx:1776 RTS|DTR|DSR|CD
4: uart:IMX mmio:0x021F4000 irq:74 tx:52 rx:0 RTS|DTR|DSR

 

0 Kudos
Reply
13 Replies

2,589 Views
ekerebel
Contributor III

@ceggers I had tried that already w/o success

0 Kudos
Reply

2,578 Views
ceggers
Contributor V

As the next step, I would test whether the I/O pin is working at all. The ECSPI_MOSI pin is also shared with GPIO4_IO09. In order to see the current state of the pin in GPIO4_PSR, you need to enable the SION bit in IOMUC_SW_MUX_CTL_PAD_ECSPI_MOSI.

When you disconnect the external Bluetooth module and manually tie the pin to high or low, you should see the current state in GPIO4_PSR.

regards,
Christian

0 Kudos
Reply

2,564 Views
ekerebel
Contributor III

Thank you Christian

I have set SION to 1 and then run some tests pulling down ECSPI1_MOSI but I cannot seem to detect the change:

root@imx6sllevk:~# /unit_tests/memtool 0x020E01B0 1
E
Reading 0x1 count starting at address 0x020E01B0

0x020E01B0:  00000012

root@imx6sllevk:~# echo 105 >/sys/class/gpio/export
root@imx6sllevk:/unit_tests# cat /sys/class/gpio/gpio105/direction
in
root@imx6sllevk:~# cat /sys/class/gpio/gpio105/value
0
root@imx6sllevk:~# cat /sys/class/gpio/gpio105/value
0
0 Kudos
Reply

2,533 Views
ekerebel
Contributor III

@ceggers : do you have any idea what I could check on my set-up based on the results from my tests with SION=1 (see above)?

0 Kudos
Reply

2,528 Views
ceggers
Contributor V

It looks like something is wrong with you external connection between your Bluetooth module in the RX pin of the UART.

0 Kudos
Reply

2,623 Views
ekerebel
Contributor III

@ceggers Thank you for the response.

I think my registers are correct.

here is imx6sll_pinfunc.h:

#define MX6SLL_PAD_ECSPI1_MOSI__UART5_DTE_RX                      0x01B0 0x0478 0x0764 0x2 0x3

 And an extract from memtool:

Reading 0x1 count starting at address 0x020E0764
0x020E0764:  00000003

 

My RX is on R131 of the EVK (ECSPI1_MOSI).

 

0 Kudos
Reply

2,495 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @ekerebel,

 

Please refer to this link: https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/i-MX6-What-does-the-DTE-DCE-in-i-MX6-s-U...

 

Note: The dte-mode swaps RTS/CTS and TX/RX pins.

 

Thank you.

Best Regards,
Dhruvit.

0 Kudos
Reply

2,592 Views
ceggers
Contributor V

Ok, pin muxing looks ok. At next lets try without SDMA. Please comment out the two DMA related lines in the device tree and try again.

regards
Christian

0 Kudos
Reply

2,584 Views
ekerebel
Contributor III

I had tried that without success

0 Kudos
Reply

2,615 Views
ceggers
Contributor V

Looks like your first post contains the wrong pinctrl block ("pinctrl_uart5" vs. "pinctrl_uart5dte").

0 Kudos
Reply

2,608 Views
ekerebel
Contributor III

Sorry about pasting the wrong group.

Here is the correct .dts extract:

&uart5 {
	pinctrl-names = "default";
	/*pinctrl-0 = <&pinctrl_uart5>;*/
	uart-has-rtscts;
	/* for DTE mode, add below change */
	fsl,dte-mode; 
	pinctrl-0 = <&pinctrl_uart5dte>;
	dmas = <&sdma 33 4 2>, <&sdma 34 4 2>;
  	dma-names = "rx", "tx"; 
	status = "okay";
};

...

pinctrl_uart5dte: uart5dtegrp {
		fsl,pins = <
			MX6SLL_PAD_ECSPI1_MOSI__UART5_DTE_RX 0x1b0b1
			MX6SLL_PAD_ECSPI1_SCLK__UART5_DTE_TX 0x1b0b1
			MX6SLL_PAD_ECSPI1_SS0__UART5_DTE_RTS 0x1b0b1
			MX6SLL_PAD_ECSPI1_MISO__UART5_DTE_CTS 0x1b0b1
		>;
	};
0 Kudos
Reply

2,601 Views
ekerebel
Contributor III

@ceggers note that I also tested in dce and have the same results

0 Kudos
Reply

2,632 Views
ceggers
Contributor V

ceggers_0-1661157799128.png

Maybe this problem is related to pin muxing. The RX signal of UART5 can be taken from several sources. You may want to check the appropriate register setting (see picture).

 

regards
Christian

0 Kudos
Reply