Skip to content

Commit

Permalink
更新logic串口文档 cklink文档
Browse files Browse the repository at this point in the history
  • Loading branch information
magesep committed Aug 15, 2023
1 parent 829da49 commit 65ba35c
Show file tree
Hide file tree
Showing 14 changed files with 175 additions and 23 deletions.
14 changes: 14 additions & 0 deletions docs/hardware/en/logic_analyzer/combo8/use_cklink_function.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,17 @@ The pins on the right side of the diagram (TCK, TDI, TDO, TMS) are used for CKLi

On both Windows and Linux systems, you can directly refer to [Using CDK + Sipeed RV-Debugger Plus for Compilation and Debugging](https://bouffalolab.gitee.io/bl_mcu_sdk/get_started/cdk_rv_debugger_plus.html#cdk-sipeed-rv-debugger-plus) and [T-HEAD Debug Server User Manual](https://occ.t-head.cn/document?temp=introduction-2&slug=t-head-debug-server-user-manual), the usage is exactly the same.

### Debugging with CDK

- Click the `Start/Stop Debugger` button on the toolbar to enter the debug interface, as shown in the image below:

![Debug CDK](./../../../zh/logic_analyzer/combo8/assets/use_cklink_function/cklink_cdk_debug.png)
_Debug HelloWorld!_

- Under the `debug` interface, you can view the internal register data of the CPU in the `Register` window on the left side. At the same time, in the `Peripherals` peripheral panel on the right side, you can browse the corresponding peripheral register data. You can select the desired peripherals by using the `Peripherals->System Viewer` option in the top menu bar. Additionally, in the toolbar above the interface, you will find relevant debugging buttons that can be used for setting breakpoints, single-stepping, executing instructions one by one, and running at full speed. Of course, all these operations have corresponding shortcuts and quick setup methods. For detailed information, please refer to the CDK documentation, which will provide a comprehensive guide.

- Click the single-step run button to execute the code. You will see the cursor move to the next line of code, and at the same time, the serial panel will display the output "Hello World!"

### Debugging with T-HEAD Debug Server

> Please refer to the **Section Ten: Debugging with JTAG** in the [Getting Started with M1s DOCK](../../maix/m1s/other/start.md) guide for details.
82 changes: 73 additions & 9 deletions docs/hardware/en/logic_analyzer/combo8/use_fouruart_function.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ Press the toggle button to switch the indicator light to red.

## Getting Started

Please note: Due to system reasons, Linux may consider the device as a modem when it has more than one ttyACM. This may temporarily occupy the device for sending AT commands. In this situation, you may not be able to open the serial port, and it may report "Resource busy" due to device being occupied. This is normal, and it will return to normal after a while. To solve this problem, you can add a udev rule to avoid this issue. Please refer to the following commands:

```shell
sudo touch /etc/udev/rules.d/49-sipeed.rules
sudo echo "ATTRS{idVendor}==\"359f\", ATTRS{idProduct}==\"3101\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"" > /etc/udev/rules.d/49-sipeed.rules
sudo udevadm control --reload
```

### Pin sequence

![fouruart_line_order](./../../../zh/logic_analyzer/combo8/assets/use_fouruart_function/fouruart_line_order.png)
Expand All @@ -43,6 +35,16 @@ Note:
1. Ensure that the module and the target device share a common ground to prevent issues such as garbled data.
2. The device numbers on Windows may be in random order, so manual trial-and-error may be required to find the corresponding serial port.

### Linux

Please note: Due to system reasons, Linux may consider the device as a modem when it has more than one ttyACM. This may temporarily occupy the device for sending AT commands. In this situation, you may not be able to open the serial port, and it may report "Resource busy" due to device being occupied. This is normal, and it will return to normal after a while. To solve this problem, you can add a udev rule to avoid this issue. Please refer to the following commands:

```shell
sudo touch /etc/udev/rules.d/49-sipeed.rules
sudo echo "ATTRS{idVendor}==\"359f\", ATTRS{idProduct}==\"3101\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"" > /etc/udev/rules.d/49-sipeed.rules
sudo udevadm control --reload
```

### Data Transmission and Reception

For Linux, you can use **picocom** or **minicom** as the serial communication tool. Install it using the following commands:
Expand Down Expand Up @@ -76,4 +78,66 @@ After entering the command, you can communicate with the test device, receive an
(Above: Serial module wiring diagram)

Loopback test result:
![minicom_test_uart](./../../../zh/logic_analyzer/combo8/assets/use_fouruart_function/minicom_test_uart.png)

![minicom_test_uart](./../../../zh/logic_analyzer/combo8/assets/use_fouruart_function/minicom_test_uart.png)



### Windows

In the Windows operating system, you can use tools like SSCOM, MobaXterm, and others as serial port communication tools. Here, we'll use **SSCOM** as an example to demonstrate how to perform serial communication tests.

1. First, download SSCOM. This software is open source, so please search and download it via an online search.

2. After the download is complete, extract and launch the serial port tool. You will see the following interface:

![SSCOM Interface](./../../../zh/logic_analyzer/combo8/assets/use_fouruart_function/sscom_gui.png)

3. Connect the module to your PC. Then, in the Windows Device Manager (shortcut `Win + X + M`), check if the connection was successful and obtain the port number information.

![Device Manager](./../../../zh/logic_analyzer/combo8/assets/use_fouruart_function/sscom_device_manage.png)

Due to the nature of Windows systems, the port numbers might be in a disordered sequence. Therefore, you can follow these steps to test the corresponding port numbers:

- Connect the TX* and RX* pins of the module (* can be 0-3).
- Set the baud rate, typically using 115200.
- Open the serial port.
- Sequentially try different port device numbers, click the "Send" button, and check if data is received to confirm the corresponding serial port for each.

![Confirm Port](./../../../zh/logic_analyzer/combo8/assets/use_fouruart_function/sscom_determine_port.png)

4. After confirming the port numbers for each serial port, you can input the data you want to send in the data input window. Simultaneously, received data will also be displayed in the window.

#### Transmission and Reception Testing

Using the SLogic 4xUART module for serial communication testing, the first two virtual serial ports can achieve a maximum speed of 20Mbps. Here's an example of testing performance using SSCOM.

##### 1Mbps Test (256kbps, 512kbps)

1. Connect TX2 and RX3.
2. Start two instances of SSCOM, connecting them to the respective serial ports.
3. Set the baud rate to 1000000 and open the serial port.
4. Create a 256KB text file with repetitive common characters.
5. Use SSCOM's file sending feature, select the newly created text file and send it.
6. The other instance of SSCOM will receive the data and verify the received file content.

Below is the result of the 1Mbps test (256KB). Confirm the success of the test by checking the file size and data content.

![1Mbps Test (256KB)](./../../../zh/logic_analyzer/combo8/assets/use_fouruart_function/uart_sscom_1mbps_256kb.png)

Increase the data size of the text file to 512KB and repeat the test to confirm the success of sending and receiving 512KB of data at 1Mbps.

![1Mbps Test (512KB)](./../../../zh/logic_analyzer/combo8/assets/use_fouruart_function/uart_sscom_1mbps_512kb.png)

##### 20Mbps Test (256kbps)

1. Connect TX0 and RX1.
2. Start two instances of SSCOM, connecting them to the respective serial ports.
3. Set the baud rate to 20000000 and open the serial port.
4. Create a 256KB text file with repetitive common characters.
5. Use SSCOM's file sending feature, select the newly created text file and send it.
6. The other instance of SSCOM will receive the data and verify the received file content.

Below is a screenshot of the test results. Confirm the success of the test by checking the file size and data content.

![20Mbps Test](./../../../zh/logic_analyzer/combo8/assets/use_fouruart_function/uart_sscom_20mbps_256kb.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion docs/hardware/zh/logic_analyzer/combo8/use_cklink_function.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,19 @@ CKLink模式下可以同时支持一路CKLink和一路UART

### 使用方法

在Windows、Linux系统可以直接参考[使用 CDK + Sipeed RV-Debugger Plus 编译调试](https://bouffalolab.gitee.io/bl_mcu_sdk/get_started/cdk_rv_debugger_plus.html#cdk-sipeed-rv-debugger-plus)[T-HEAD Debug Server 用户手册](https://occ.t-head.cn/document?temp=introduction-2&slug=t-head-debug-server-user-manual),用法完全一样
在Windows、Linux系统可以直接参考[使用 CDK + Sipeed RV-Debugger Plus 编译调试](https://bouffalolab.gitee.io/bl_mcu_sdk/get_started/cdk_rv_debugger_plus.html#cdk-sipeed-rv-debugger-plus)[T-HEAD Debug Server 用户手册](https://occ.t-head.cn/document?temp=introduction-2&slug=t-head-debug-server-user-manual),用法完全一样

### 使用CDK进行调试

- 点击工具栏上方的`Start/Stop Debugger`按钮,进入debug界面,如下图所示

![](./assets/use_cklink_function/cklink_cdk_debug.png)
_Debug HellowWorld!_

-`debug`界面下,你可以在左侧的`Register`窗口中查看CPU的内部寄存器数据。同时,在右侧的`Peripherals`外设面板中,你可以浏览相应外设寄存器数据。你可以通过顶部菜单栏的`Peripherals->System Viewer`来选择所需的外设。此外,在界面上方的工具栏中,你会找到相关的调试按钮,它们可以用于设置断点、单步调试、逐条指令执行以及全速运行等操作。当然,所有这些操作都有相应的快捷键和快速设置方式。如需详细信息,请参考CDK帮助文档,这里就不再详细展开介绍。

- 点击单步运行按钮,运行代码,即可看到指示光标移动到下一句代码,同时可以看到串口面板中显示输出的 Hello World!

### 使用T-HEAD Debug Server进行调试

> [参考](../../maix/m1s/other/start.md)M1s DOCK 上手**第十节 使用JTAG调试**的内容。
85 changes: 72 additions & 13 deletions docs/hardware/zh/logic_analyzer/combo8/use_fouruart_function.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ SLogic Combo8 具备4路独立高速串口功能,前两路基于UART可同时

## 开始使用

注意:Linux由于系统原因,当设备拥有大于一个的ttyACM后,Linux会认为其为调制解调器,会临时占用发送AT指令。此时无法打开串口,会报资源占用设备忙碌,属正常现象,稍等片刻即可恢复正常。要解决该问题,可以添加udev规则来规避该问题,参考以下指令:
```shell
sudo touch /etc/udev/rules.d/49-sipeed.rules
sudo echo "ATTRS{idVendor}==\"359f\", ATTRS{idProduct}==\"3101\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"" > /etc/udev/rules.d/49-sipeed.rules
sudo udevadm control --reload
```

### 引脚连接

![fouruart_line_order](./assets/use_fouruart_function/fouruart_line_order.png)
Expand All @@ -43,7 +36,15 @@ SLogic combo8总共有4个串口,UART0和UART1最高支持20M波特率,UART3
1. 保证模块与目标设备共地,防止出现乱码等情况。
2. Windows平台的设备号可能是乱序的,需要手动尝试来找到对应的串口

### 数据收发
### Linux

注意:Linux由于系统原因,当设备拥有大于一个的ttyACM后,Linux会认为其为调制解调器,会临时占用发送AT指令。此时无法打开串口,会报资源占用设备忙碌,属正常现象,稍等片刻即可恢复正常。要解决该问题,可以添加udev规则来规避该问题,参考以下指令:
```shell
sudo touch /etc/udev/rules.d/49-sipeed.rules
sudo echo "ATTRS{idVendor}==\"359f\", ATTRS{idProduct}==\"3101\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"" > /etc/udev/rules.d/49-sipeed.rules
sudo udevadm control --reload
```
#### 数据收发

Linux可使用picocom或minicom作为串口收发工具,安装指令为:

Expand All @@ -54,25 +55,83 @@ sudo apt install minicom

以minicom为例,使用`CTRL+ALT+T`打开Linux终端,输入安装指令,将会提示输入该Linux系统管理员用户密码,输入密码后回车,静待软件包安装完成

![minicom_install_uart](./assets/use_fouruart_function/minicom_install_uart.png)

![](./assets/use_fouruart_function/minicom_install_uart.png)
完成安装后,使用UART0与测试设备进行通信,于终端输入命令:

```Bash
sudo minicom -b 2000000 -D /dev/ttyACM0
```

-b参数指定所需的波特率,与测试设备UART串口设置波特率相同即可

-D参数指定监听的端口号
![minicom_uart](./assets/use_fouruart_function/minicom_uart.png)
![](./assets/use_fouruart_function/minicom_uart.png)

命令输入后即与测试设备进行通信,收到信息将于终端进行打印;以及向测试设备发送数据。

#### 串口回传测试:

![uart_line_uart](./assets/use_fouruart_function/uart_line_uart.jpg)
![](./assets/use_fouruart_function/uart_line_uart.jpg)
(上:串口模块接线图)

回传测试结果:
![](./assets/use_fouruart_function/minicom_test_uart.png)

### Windows

在Windows系统中,您可以使用SSCOM、MobaXterm等串口助手作为串口收发工具。以下以**SSCOM**为例,演示如何使用SSCOM进行串口通信测试

1. 首先,下载SSCOM,该软件为开源软件,请自行百度下载

2. 下载完成后,解压并启动串口助手。您将看到如下界面:

![SSCOM界面](./assets/use_fouruart_function/sscom_gui.png)

3. 将模块连接到PC上。然后在Windows设备管理器中(快捷键`Win + X + M`)查看是否成功连接,以及获取串口号信息

![设备管理器](./assets/use_fouruart_function/sscom_device_manage.png)

由于Windows系统的特性,串口号可能会是乱序的。因此,您可以按照以下步骤测试对应的串口号:

- 连接模块的TX*和RX*引脚(*为0-3)
- 设置波特率,通常使用115200
- 开启串口
- 逐个尝试不同的端口号设备,点击“发送”按钮,检查是否收到数据,以确认每个端口对应的串口号

![确认串口号](./assets/use_fouruart_function/sscom_determine_port.png)

4. 确认了每个串口的端口号后,您可以在数据输入窗口中输入需要发送的数据。同时,接收到的数据也会显示在窗口中

#### 收发测试

使用SLogic 4xUART模块进行串口通信测试,前两路虚拟串口最高速率可达20Mbps。以下以使用SSCOM测试性能为例

##### 测试 1Mbps(256kbps,512kbps)

1. 连接TX2和RX3
2. 启动两个SSCOM实例,分别连接到两个串口
3. 将波特率设置为1000000,然后开启串口
4. 创建一个256KB的文本文件,其中的内容为重复的常见字符
5. 使用SSCOM的文件发送功能,选择刚创建的文本文件并发送
6. 另一个SSCOM实例将接收数据并检查接收到的文件内容

以下是1Mbps测试的结果,检查文件大小以及数据内容确认1Mbps时,收发256kb数据测试成功

![1Mbps测试(256KB)](./assets/use_fouruart_function/uart_sscom_1mbps_256kb.png)

将文本文件的数据增大至512KB,并重复测试,确认1Mbps时,收发512kb数据测试成功

![](./assets/use_fouruart_function/uart_sscom_1mbps_512kb.png)

##### 测试 20Mbps(256kbps)

1. 连接TX0和RX1
2. 启动两个SSCOM实例,分别连接到两个串口
3. 将波特率设置为20000000,然后开启串口
4. 创建一个256KB的文本文件,其中的内容为重复的常见字符
5. 使用SSCOM的文件发送功能,选择刚创建的文本文件并发送
6. 另一个SSCOM实例将接收数据并检查接收到的文件内容

以下是测试结果截图,可以通过检查文件大小和数据内容来确认测试是否成功

![minicom_test_uart](./assets/use_fouruart_function/minicom_test_uart.png)
![20Mbps测试](./assets/use_fouruart_function/uart_sscom_20mbps_256kb.png)

0 comments on commit 65ba35c

Please sign in to comment.