This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM6548: UART can not receive data fully

Part Number: AM6548

Tool/software: Linux

Dear TI experts

SDK:ti-processor-sdk-linux-am65xx-evm-05.03.00.07

I encounter some problems when I use uart.
when I send data for 100 times from other device to the EVM board,the evm board can not receive the data correctly.

Test flow:
simply test code:
TX:on the computer
#!/bin/bash

count=100;

for((i=1;i<=$count;i++));
do
echo "0;1;3;4;6;7;8;9;a;b;c;d;e;f;10;11;12;13;14;15;16;17;18;19;1a;1b;1c;1d;1e;1f;20;21;22;23;24;25;26;27;28;29;2a;2b;2c;2d;2e;2f;30;31;32;33;34;35;36;37;38;39;3a;3b;3c;3d;3e;3f;40;41;42;43;44;45;46;47;48;49;4a;4b;4c;4d;4e;4f;50;51;52;53;54;55;56;57;58;59;5a;5b;5c;5d;5e;5f;60;61;62;63;64;65;66;67;68;69;6a;6b;6c;6d;6e;6f;70;71;72;73;74;75;76;77;78;79;7a;7b;7c;7d;7e;7f;80;81;82;83;84;85;86;87;88;89;8a;8b;8c;8d;8e;8f;90;91;92;93;94;95;96;97;98;99;9a;#a3" > /dev/ttyUSB2;
done

RX:on the EVM board
#!/bin/bash
while (true);
do
cat /dev/ttyS1 > test.txt;
done



On the EVM board,there are some call trace messages output:
[   29.725159] random: crng init done
[   29.728569] random: 7 urandom warning(s) missed due to ratelimiting
[   55.935292] INFO: rcu_preempt detected stalls on CPUs/tasks:
[   55.940969]  0-...: (1 GPs behind) idle=6e6/2/0 softirq=2767/2768 fqs=2625
[   55.947913]  (detected by 1, t=5252 jiffies, g=262, c=261, q=483)
[   55.953999] Task dump for CPU 0:
[   55.957219] swapper/0       R  running task        0     0      0 0x00000002
[   55.964258] Call trace:
[   55.966713] [<ffff0000080852bc>] __switch_to+0x8c/0xd0
[   55.971839] [<          (null)>]           (null)




and besides, I can not receive all the message send from other devices.there is just few data received

there are lots of data missing


could you help me check what's the reason for this problems?

  • Hi Asura,

    I will try to replicate the test and look into it. I probably should get you back next week.
  • Dear

    I have not received any reply, does this problem reproduce?
    and do you have some suggestions how can I solved this problems?


    BRs
  • Hi Asura,

    Sorry for my late response. I was busy in another work and just got a chance back on this.

    Are you unable to receive data at all? or some bytes are missing?
    What revision of the evm do you have?
    Which uart port on the AM65x EVM are you trying to use?

    According to the device tree (k3-am6.dtsi), ttyS1 is the MCU_UART, but it is disabled in the device tree by default. have you changed the device tree to enable it?

    When you connect the evm uart port to a PC, 4 ttyUSBx nodes will be generated. is ttyUSB2 the 3rd port of them on your PC? If so, it is the WKUP_UART, not MCU_UART.

  • Hi

    I use EVM beita version.

    there are some bytes missing. I can receive parts of data. and as described before,there are some call trace information output.

    I have changed the dts to enable the ttyS1,to use mcu_uart0

    there are some other usb-serial devices plug in my pc,so the ttyUSB2 may not is the 3rd port of them. but before I doing the test, I have used echo and cat to test the connection. I am sure the ttyS1 is response to the ttyUSB2 on my PC when I dong the test.
  • Hi

    Add some extra information.
    On the EVM board,The described testing is under baud 9600 using ttyS1-mcu_uart.
    and I test it on the 4800 baud, the problem also exists

    I do the same test on our own designed board using ttyS2-main_uart0.
    there are also the same problem on the board
  • Hi,

    The root cause is that the uart driver in the Processor SDK v5.3 kernel has a bug which causes dma stop working if multiple uart ports have dma enabled. The workaround is to not use use dma, or just enable dma on ONE uart port. The bug is fixed in the next Processor SDK release.

    The following patch 0001 is to disable uart dma, and patch 0002 is that I used to enable mcu uart to the ftdi connector.

    From e1168883184235995326a162a6f636946e15f887 Mon Sep 17 00:00:00 2001
    From: Bin Liu <b-liu@ti.com>
    Date: Wed, 22 May 2019 10:29:32 -0500
    Subject: [PATCH 1/2] dts:am6: disable uart dma
    
    ---
     arch/arm64/boot/dts/ti/k3-am6.dtsi | 12 ------------
     1 file changed, 12 deletions(-)
    
    diff --git a/arch/arm64/boot/dts/ti/k3-am6.dtsi b/arch/arm64/boot/dts/ti/k3-am6.dtsi
    index 58471172762a..aab63b342dff 100644
    --- a/arch/arm64/boot/dts/ti/k3-am6.dtsi
    +++ b/arch/arm64/boot/dts/ti/k3-am6.dtsi
    @@ -381,9 +381,6 @@
     			interrupts = <GIC_SPI 565 IRQ_TYPE_LEVEL_HIGH>;
     			clock-frequency = <96000000>;
     			current-speed = <115200>;
    -			dmas = <&mcu_udmap &mcu_pdma1 18 UDMA_DIR_TX>,
    -			       <&mcu_udmap &mcu_pdma1 18 UDMA_DIR_RX>;
    -			dma-names = "tx", "rx";
     			status = "disabled";
     		};
     
    @@ -395,9 +392,6 @@
     			interrupts = <GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>;
     			clock-frequency = <48000000>;
     			current-speed = <115200>;
    -			dmas = <&main_udmap &pdma1 20 UDMA_DIR_TX>,
    -			       <&main_udmap &pdma1 20 UDMA_DIR_RX>;
    -			dma-names = "tx", "rx";
     			status = "disabled";
     		};
     
    @@ -409,9 +403,6 @@
     			interrupts = <GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH>;
     			clock-frequency = <48000000>;
     			current-speed = <115200>;
    -			dmas = <&main_udmap &pdma1 21 UDMA_DIR_TX>,
    -			       <&main_udmap &pdma1 21 UDMA_DIR_RX>;
    -			dma-names = "tx", "rx";
     			status = "disabled";
     		};
     
    @@ -423,9 +414,6 @@
     			interrupts = <GIC_SPI 194 IRQ_TYPE_LEVEL_HIGH>;
     			clock-frequency = <48000000>;
     			current-speed = <115200>;
    -			dmas = <&main_udmap &pdma1 22 UDMA_DIR_TX>,
    -			       <&main_udmap &pdma1 22 UDMA_DIR_RX>;
    -			dma-names = "tx", "rx";
     			status = "disabled";
     		};
     
    -- 
    2.17.1
    
    

    From 19df2f963b37a0e669f89c4790b808d2a090242c Mon Sep 17 00:00:00 2001
    From: Bin Liu <b-liu@ti.com>
    Date: Wed, 22 May 2019 10:30:03 -0500
    Subject: [PATCH 2/2] dts:am6: enable mcu uart
    
    ---
     .../arm64/boot/dts/ti/k3-am654-base-board.dts | 20 +++++++++++++++++++
     1 file changed, 20 insertions(+)
    
    diff --git a/arch/arm64/boot/dts/ti/k3-am654-base-board.dts b/arch/arm64/boot/dts/ti/k3-am654-base-board.dts
    index 6e44cb426902..af620fa3830e 100644
    --- a/arch/arm64/boot/dts/ti/k3-am654-base-board.dts
    +++ b/arch/arm64/boot/dts/ti/k3-am654-base-board.dts
    @@ -154,6 +154,12 @@
     	status = "okay";
     };
     
    +&mcu_uart0 {
    +	pinctrl-names = "default";
    +	pinctrl-0 = <&mcu_uart0_pins_default>;
    +	status = "okay";
    +};
    +
     &main_pmx0 {
     	main_uart0_pins_default: main_uart0_pins_default {
     		pinctrl-single,pins = <
    @@ -303,6 +309,14 @@
     		>;
     	};
     
    +	mcu_uart0_pins_default: mcu_uart0_pins_default {
    +		pinctrl-single,pins = <
    +			AM65X_WKUP_IOPAD(0x0044, PIN_INPUT | MUX_MODE4) /* (P4) MCU_OSPI1_D1.MCU_UART0_RXD */
    +			AM65X_WKUP_IOPAD(0x0048, PIN_OUTPUT | MUX_MODE4) /* (P5) MCU_OSPI1_D2.MCU_UART0_TXD */
    +			AM65X_WKUP_IOPAD(0x004c, PIN_INPUT | MUX_MODE4) /* (P1) MCU_OSPI1_D3.MCU_UART0_CTSn */
    +			AM65X_WKUP_IOPAD(0x0054, PIN_OUTPUT | MUX_MODE4) /* (N3) MCU_OSPI1_CSn1.MCU_UART0_RTSn */
    +		>;
    +	};
     	mcu_fss0_ospi0_pins_default: mcu_fss0_ospi0_pins_default {
     		pinctrl-single,pins = <
     			AM65X_WKUP_IOPAD(0x0000, PIN_OUTPUT | MUX_MODE0) /* (V1) MCU_OSPI0_CLK */
    @@ -387,6 +401,12 @@
     		reg = <0x21>;
     		gpio-controller;
     		#gpio-cells = <2>;
    +		p1 {
    +			gpio-hog;
    +			gpios = <14 GPIO_ACTIVE_HIGH>;
    +			output-high;
    +			line-name = "uart_sel";
    +		};
     	};
     };
     
    -- 
    2.17.1
    
    

  • Hi

    I apply 0001 patch to the kernel and do some tests, there is no problem found currently.
  • That is great! Thanks for the update.