UART Sending Extra 0x00 Bytes

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

UART Sending Extra 0x00 Bytes

1,841 次查看
neuro
Contributor III

Hello,

I am working on a IMX6 Solo X chip with Linux and using 3 UARTS (RS485) to send/receive data from the serial ports interfacing with another board. I'm simply testing these ports with a simple C program utilizing Linux libraries (termios, read, write) by sending and receiving simple messages (e.g. ABCDEFGHIJ).

I'm reading bytes from the external board fine, however, anytime i send bytes, the external board receives a large amount of 0x00 bytes that come after the bytes i sent.

What can I do to prevent these extra 0x00 bytes from being sent after my initial message? I preferably do not want to modify the external boards code to band aid this.

I have been reading some other posts and it seems like it might be the DMA, however, I also was reading the uarts have to have DMA enabled. Is this true or can i disable DMA?

An example device tree node for a uart is setup as such:

uart3: serial@021ec000 {
                compatible = "fsl,imx6sx-uart",
                         "fsl,imx6q-uart", "fsl,imx21-uart";
                reg = <0x021ec000 0x4000>;
                interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&clks IMX6SX_CLK_UART_IPG>,
                     <&clks IMX6SX_CLK_UART_SERIAL>;
                clock-names = "ipg", "per";
                dmas = <&sdma 29 4 0>, <&sdma 30 4 0>;
                dma-names = "rx", "tx";
                status = "disabled";
};

pinctrl_uart3: uart3grp {
            fsl,pins = <
                MX6SX_PAD_NAND_DATA04__GPIO4_IO_8    0x1b0b1
                MX6SX_PAD_NAND_DATA06__UART3_RX        0x1b0b1
                MX6SX_PAD_NAND_DATA07__UART3_TX        0x1b0b1
            >;
 };

&uart3 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_uart3>;
    dma-names = "","tx";
    status = "okay";
};

Thank you

标签 (5)
标记 (4)
0 项奖励
回复
4 回复数

1,671 次查看
neuro
Contributor III

This happened to be a compiler issue. I was recompiled pre-built application and caused the issue. If I left the pre-built application alone and only recompiled certain files, it worked fine.

This issue can be closed.

0 项奖励
回复

1,671 次查看
igorpadykov
NXP Employee
NXP Employee

Hi Jon

nxp does not officially supports rs485 in its bsps, however one can look at below

link with good overview of possible issues:

https://community.nxp.com/thread/499630 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,671 次查看
neuro
Contributor III

Igor,

Are you implying I need to add the marked and space parity bits in a kernel patch to get it working which will remove the extra 0x00 bytes that are being sent out?

I don't use parity bit currently when sending/receiving.

Thanks,

Jon

0 项奖励
回复

1,671 次查看
igorpadykov
NXP Employee
NXP Employee

Hi Jon

one can try these patches.

Best regards
igor

0 项奖励
回复