海思Hi3559AV100串口RS232、RS485和CAN调试


原文链接: 海思Hi3559AV100串口RS232、RS485和CAN调试

GPIO

3559A有18组GPIO+5组M7的GPIO,这个是M7的第4组GPIO,18+4=22

海思Hi3559AV100串口RS232、RS485和CAN调试

1 外设分配

2 管脚复用设置

col 1col 2col 3
串口外设管脚复用寄存器

DBG RS232

/dev/ttyAMA0 | UART0_RXD/CANBUS0_RX/GPIO13_0

UART0_TXD/CANBUS0_TX/GPIO13_1 | 复用寄存器0x01F0000D4

0:GPIO13_0,1:UART0_RXD, 2:CANBUS0_RX

himm 0x01F0000D4 0x1101;

复用寄存器0x01F0000D8

0:GPIO13_1,1:UART0_TXD,2:CANBUS0_TX

himm 0x01F0000D8 0x1101;
前面板DB9

/dev/ttyAMA2 | UART2_RXD/UART1_RTSN/GPIO13_4 | 复用寄存器0x01F0000E4

0:GPIO13_4,1:UART2_RXD, 2:UART1_RTSN

himm 0x01F0000E4 0x1101;

复用寄存器0x0_1F00_00E8

0:GPIO13_5, 1:UART2_TXD,2:UART1_CTSN

himm 0x01F0000E8 0x1101;
UART2_TXD/UART1_CTSN/GPIO13_5
RS232-1

/dev/ttyAMA3 | UART3_RXD/GPIO13_6 | 复用寄存器0x0_1F00_00EC

0:GPIO13_6,1:UART3_RXD

himm 0x01F0000EC 0x1101;

复用寄存器0x0_1F00_00F0

0:GPIO13_7,1:UART3_TXD

himm 0x01F0000F0 0x1101;
UART3_TXD/GPIO13_7
RS232-2

/dev/ttyAMA4 | UART4_RXD/UART3_RTSN/GPIO0_4 | 复用寄存器0x0_1F00_00F4

0:GPIO0_4,1:UART4_RXD,2:UART3_RTSN

himm 0x01F0000F4 0x1101;

复用寄存器0x0_1F00_00F8

0:GPIO0_5,1:UART4_TXD,2:UART3_CTSN

himm 0x01F0000F8 0x1101;
UART4_TXD/UART3_CTSN/GPIO0_5
RS485-1

/dev/ttyAMA5

波特率115200 | SHUB_UART0_RXD/SHUB_GPIO1_5 | 复用寄存器0x0_1805_0034

0:SHUB_GPIO1_5, 1:SHUB_UART0_RXD

himm 0x018050034 0x1101;

复用寄存器0x0_1805_003C

0:SHUB_GPIO1_7,1:SHUB_UART0_TXD

himm 0x01805003C 0x1101;
SHUB_UART0_TXD/SHUB_GPIO1_7

SPI2_SCLK/SPI2_3WIRE_CLK/I2C2_SCL/GPIO4_0

RS485_RD1_1V8(GPIO4_0: 1接收,0发送)
GPS

/dev/ttyAMA6

波特率:9600 | SHUB_UART1_RXD/SHUB_GPIO2_1 | 复用寄存器0x0_1805_0044

0:SHUB_GPIO2_1

1:SHUB_UART1_RXD

himm 0x018050044 0x1101;

复用寄存器0x0_1805_004C

0:SHUB_GPIO2_3

1:SHUB_UART1_TXD

himm 0x01805004C 0x1101;
SHUB_UART1_TXD/SHUB_GPIO2_3
4G | SHUB_UART0_RTSN/SHUB_UART4_RXD | 复用寄存器0x0_1805_0030

0:SHUB_GPIO1_4

1:SHUB_UART0_RTSN

2:SHUB_UART4_RXD

3:SHUB_I2C6_SCL

himm 0x018050030 0x1102

复用寄存器0x0_1805_0038

0:SHUB_GPIO1_6

1:SHUB_UART0_CTSN

2:SHUB_UART4_TXD

3:SHUB_I2C6_SDA

himm 0x018050038 0x1102
SHUB_UART0_CTSN/SHUB_UART4_TXD
CAN | UART1_RXD/CANBUS1_RX/GPIO13_2

    UART1_TXD/CANBUS1_TX/GPIO13_3 | 复用寄存器 x0_1F00_00DC

                        0:GPIO13_2

                        1:UART1_RXD

                        2:CANBUS1_RX

                        Himm 0x1F0000DC 0x1102;

                        复用寄存器 x0_1F00_00E0

                        0:GPIO13_3

                        1:UART1_TXD

                        2:CANBUS1_TX

                        hmm 0x1F0000E0 0x1102;                                                               

3 测试收发

3.1 RS232测试

3.2 485测试

控制收发管脚GPIO4_0,默认发送,如果接收GPIO4_0置高。

3.3 CAN测试

使用UTEK的USB转CAN BUS模拟收发测试输入

`