IMX6 UART 9 bit MDB protocol

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

IMX6 UART 9 bit MDB protocol

ソリューションへジャンプ
6,378件の閲覧回数
smvankampen
Contributor II

Hello,

I have a question about the IMX6 uart peripheral. I am creating a 9bit uart driver from scratch to implement the 9bit MDB (Multi drop bus) protocol used in many vending machines.

At this moment (I have the driver code attached) I am able to send 9 bit data (very rudimentary) with the scope I see data transmitting. I know using a sample program the uart should receive data (including 9th bit set), but currently my driver does not generates any interrupts, although it is correctly configured in my device tree, nor does the status register change or any data in the RX FIFO.

My driver is not yet using DMA, the very basics of my driver is attached.

Does anybody have an idea why my interrupt is not working or has its own custom 9 bit uart driver?

Device tree configuration:

dts:

   &uart5 {
      pinctrl-names = "default";
      pinctrl-0 = <&pinctrl_uart5>;
      status = "okay";
   };

dtsi:

   uart5: serial@021f4000 {
      compatible = "ptr,imx6ul-mdb";
      reg = <0x021f4000 0x4000>;
      interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
      clocks = <&clks IMX6UL_CLK_UART5_IPG>,
      <&clks IMX6UL_CLK_UART5_SERIAL>;
      clock-names = "ipg", "per";
      status = "disabled";
};

Thanks in advance.

タグ(2)
0 件の賞賛
返信
1 解決策
5,208件の閲覧回数
smvankampen
Contributor II

Problem solved!

To all, If you encounter this problem, working TX no working RX, check bit 2 (RXDMUXSEL) in UCR3 register. This bit should be 1.


igorpadykov‌ The initialization sequence for the 9 bit RS485 mode in the IMX6UL reference manual (page 3162 sec. 53.13.2) does not set UCR3 and the default value for bit 2 (RXDMUXSEL) for this register is 0. Perhaps this could be changed in the documentation.

Stephan

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
5,209件の閲覧回数
smvankampen
Contributor II

Problem solved!

To all, If you encounter this problem, working TX no working RX, check bit 2 (RXDMUXSEL) in UCR3 register. This bit should be 1.


igorpadykov‌ The initialization sequence for the 9 bit RS485 mode in the IMX6UL reference manual (page 3162 sec. 53.13.2) does not set UCR3 and the default value for bit 2 (RXDMUXSEL) for this register is 0. Perhaps this could be changed in the documentation.

Stephan

0 件の賞賛
返信
5,208件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Stephan

one can try to add to compatible = "ptr,imx6ul-mdb"; strings as in

dts example linux/arch/arm/boot/dts/imx6ul.dtsi
imx6ul.dtsi\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

imx.c\serial\tty\drivers - linux-imx - i.MX Linux kernel 

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

0 件の賞賛
返信
5,208件の閲覧回数
smvankampen
Contributor II

The main problem is the RX on uart5 not receiving while we see the data on the scope.

What we have done:

  • Verified hardware path by configure pad as gpio and toggle them.
  • verified mux control pads in dts and at runtime with the memtool of nxp.
  • Interrupts are correctly working when loopback enabled in UART5
  • With current driver and dts file, i can list the device under /dev/mxc_mdb, so probe works
  • with user program send data and verified if it has transmitted.

So, we excluded hardware failures, verified if all uart registers were setup correctly, tx works, only rx not.

Perhaps interesting to know that we only use TX and RX no cts/rts etc.

0 件の賞賛
返信
5,208件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Stephan

one can try with linux nxp releases located on

linux-imx - i.MX Linux kernel 

Best regards
igor

0 件の賞賛
返信
5,208件の閲覧回数
smvankampen
Contributor II

Igor,

Currently we use the linux-imx kernel version:

Linux version 4.9.88-1.0.0+gafb47b59fd5c (oe-user@oe-host) (gcc version 7.3.0 (GCC) )

0 件の賞賛
返信