MAX14830 不冲洗 TX

MAX14830 not flushing TX

因此,经过一天的努力,我设法在 IMX7D、5.4.129 内核上安装了 Debian 11,以识别 MAX14830 并通过 MAX310X 驱动程序与其通信。但是当我尝试使用 echo a > /dev/ttyMAX0 发送数据时,没有任何反应。好吧,除了 Tx 计数上升。

查看 SPI 流量,这似乎正常进行,并且芯片正在发送预期的响应(如果发送三个字符,则 Tx FIFO 计数 returns 三个)但缓冲区似乎没有任何变化。驱动程序不断询问最大值,但 FIFO 保持在 3。然后驱动程序到达超时我猜。因为它随后发送 0x81,0x00 清除 IRQen 寄存器,然后发送 0x9B 0x40 设置波特率寄存器......这使得它更加混乱。

到目前为止,我已经完成了所有 stty 设置并使用 -ixon 禁用了 XON/XOFF,但这并没有什么不同。

是否有 way/place/file 保存驱动程序的设置?还是我忘记了什么? RX 似乎也不起作用,但不确定 max 是否没有接收到它或者只是没有通知驱动程序。

DTS 的相关部分

&ecspi3 {
    max14830: max14830@3 {
        compatible = "maxim,max14830";
        spi-max-frequency = <15000000>;
        reg = <0>; // SPI chip select number
        clocks = <&clk16m0>;
        clock-names = "osc";
        interrupt-parent = <&gpio5>;
        interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
        gpio-controller; // Marks the device node as a GPIO controller
        #gpio-cells = <2>;
        clk16m0: clk16m0 {
            compatible = "fixed-clock";
            #clock-cells = <0>;
            clock-frequency = <3686400>; // freq of external xtal
            clock-accuracy = <100>;
        };
   };
};

以及启动期间的通信

OUT          IN            MEANING
0x9F 0xCE               -> Write globalCmd = Enable Extend register map acces
0x05 0x00 -> 0x0F 0xB4  -> Clear SpclChrIntEn= RevID is B4
0x9F 0xCD               -> Write globalCmd = Disable Extend register map access

0x8A 0x01               -> Write UART0 Mode2 = Set RST
0x8A 0x00               -> Write UART0 Mode2 = Clear RST
0x1C 0x00 -> 0x0F 0x01  -> Read UART0 DivLSB = Div0 set
0x89 0x80               -> Set UART0 MODE1 =  ~RTS0 is three state

0xAA 0x01               -> Write UART1 Mode2 = Set RST
0xAA 0x00               -> Write UART1 Mode2 = Clear RST
0x3C 0x00 -> 0x0F 0x01  -> Read UART1 DivLSB = Div0 set
0xA9 0x80               -> Set UART1 MODE1 =  ~RTS1 is three state

0xCA 0x01               -> Write UART2 Mode2 = Set RST
0xCA 0x00               -> Write UART2 Mode2 = Clear RST
0x5C 0x00 -> 0xF 0x01   -> Read UART2 DivLSB = Div0 set
0xC9 0x80               -> Set UART2 MODE1 =  ~RTS2 is three state

0xEA 0x01               -> Write UART3 Mode2 = Set RST
0xEA 0x00               -> Write UART3 Mode2 = Clear RST
0x7C 0x00 -> 0x0F 0x01  -> Read UART3 DivLSB = Div0 set
0xE9 0x80               -> Set UART3 MODE1 = ~RTS3 is three state

0x9A 0x44               -> Write PLLConfig = Set PreDiv5 and PreDiv2
0x9E 0x14               -> Write ClockSource = 0001 0100 -> first 1 at dont care, second PLLen

0x81 0x00              -> Clear IRQen UART0 
0x02 0x00 -> 0x0F 0x60 -> Read ISR UART0 = both fifo empty
0x1B 0x00 -> 0x0F 0x00 -> Read BRConfig UART0 -> all clear
0x9B 0x40              -> Write BRConfig UART0 -> FRACT2 Set

0xA1 0x00              -> Clear IRQen UART1 
0x22 0x00 -> 0x0F 0x60 -> Read ISR UART1 = both fifo empty
0x3B 0x00 -> 0x0F 0x00 -> Read BRConfig UART1 -> all clear
0xBB 0x40              -> Write BRConfig UART1 -> FRACT2 Set

0xC1 0x00              -> Clear IRQen UART2 
0x42 0x00 -> 0x0F 0x60 -> Read ISR UART2 = both fifo empty
0x58 0x00 -> 0x0F 0x00 -> Read BRConfig UART2 -> all clear
0xDB 0x40              -> Write BRConfig UART2 -> FRACT2 Set

0xE1 0x00              -> Clear IRQen UART3 
0x62 0x00 -> 0x0F 0x60 -> Read ISR UART3 = both fifo empty
0x7B 0x00 -> 0x0F 0x00 -> Read BRConfig UART3 -> all clear
0xFB 0x40              -> Write BRConfig UART3 -> FRACT2 Set

ttyMAX0 设置根据 stty stty -F /dev/ttyMAX0

的结果
-parenb -> don't generate parity
-parodd -> Even parity?
-cmspar -> No stick parity
cs8     -> character size 8 bits
hupcl   -> don't send hangup signal
-cstopb -> use one bit per character
cread   -> allow input to be received
clocal  -> disable modem control signals
-crtscts -> dont enable rts/cts handschaking
-ignbr  -> don't ignore break characters
-brkint -> breaks don't cause an interrupt signal
-ignpar -> don't ignore characters with parity errors
-parmrk -> don't mark parity errors
-inpck  -> don't enable parity checking
-istrip -> don't clear high (8th) bit of input characters
-inlcr  -> dont translate newline to carriage return
-igncr  -> don't ignore carriage return
icrnl   -> don't translate carriage return to newline
-ixon   -> disable XON/XOFF flow control
-ixoff  -> disable sending of start/stop characters
-iuclc  -> don't translate uppercase to lowercase
-ixany  -> Don't let any character restart output
-imaxbel -> don't beep and flush
-iutf8   -> don't assume characters are utf8 encoded
OUTPUT SETTINGS
opost   -> post process output
-olcuc  -> don't translate lower to upper
-ocrnl  -> don't translate carriage return to newline
onlcr   -> translate newline to carriage return newline
-onocr  -> print carriage return in the first column
-onlret -> newline doesn't perform a carriage return
-ofill -> don't use fill characters instead of timing for delays
-ofdel -> don't use delete character for fill instead of null
nl0
cr0
tab0 -> horizontal tab delay style 0
bs0
vt0
ff0    -> form feed delay style
isig   -> enable interrpt,
icanon -> enable special characters: erase, kill, werase, rprnt
iexten -> enable non-POSIX special characters
echo   -> echo input characters
echoe  -> echo erase characters as backspace-space-backspace 
echok  -> echo a newline after a kill character
-echonl
-noflsh -> don't disable flushing after interrupt & quit special
              chars
-xcase
-tostop
-echoprt
echoctl   -> echo control characters in hat notation ('^c')
echoke    -> kill all line by obeying the echoprt and echoe settings
-flusho
-extproc
  • TX 不工作,因为时钟名称应该是 xtal
  • RX 不工作,因为我从未打开端口,但检查了 /proc/tty/driver/max310x 接收到的数据,如果端口未打开,驱动程序会禁用 rx。

工作节点。

&ecspi3 {

    /delete-node/spidev@0;

    max14830: max14830@3 {
        compatible = "maxim,max14830";
        spi-max-frequency = <15000000>;
        reg = <0>; // SPI chip select number
        clocks = <&clk16m0>;
        clock-names = "xtal"; /* because using external xtal */
        interrupt-parent = <&gpio5>;
        interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
        gpio-controller;  /* Marks the device node as a GPIO controller */
        #gpio-cells = <2>;
        clk16m0: clk16m0 {
            compatible = "fixed-clock";
            #clock-cells = <0>;
            clock-frequency = <3686400>; /* external xtal frequency */
            clock-accuracy = <100>;
        };
     };
};
```