diff --git a/advanced-snapdragon.md b/advanced-snapdragon.md index 6ac8b92..fab81b4 100644 --- a/advanced-snapdragon.md +++ b/advanced-snapdragon.md @@ -1,66 +1,69 @@ -# Snapdragon Advanced +# 骁龙飞控进阶 -## Connect to Snapdragon +## 骁龙飞控连接方式 -### Over FTDI +### 通过 FTDI -Connect the small debug header shipped with the Snapdragon and the FTDI cable. +将小调试板插在 Snapdragon 的主板上,使用 FTDI 线将其与主机连接。 -On Linux, open a console using: +如果在 Linux 平台,在控制台中输入如下命令: ``` screen /dev/ttyUSB0 115200 ``` -Change USB0 to whatever it happens to be. Check `/dev/` or `/dev/serial/by-id`. +将 USB0 更改为当前识别到的 USB 端口。 通过 `/dev/` 或 `/dev/serial/by-id` 检查。 -### Over ADB (Android Debug Bridge) -Connect the Snapdragon over USB2.0 and power it up using the power module. -When the Snapdragon is running the, the LED will be slowly blinking (breathing) in blue. +### 通过 ADB (Android Debug Bridge) -Make sure the board can be found using adb: +将骁龙通过 USB2.0 与主机连接,并用供电模块供电。当骁龙启动后,蓝色的 LED 灯将会缓慢的闪烁(呼吸)。 + +通过 adb 确认飞控板已经被检测到: ``` adb devices ``` -If you cannot see the device, it is most likely a USB device permission issue. Follow the instructions +如果无法显示设备,很可能是 USB 设备权限的问题。根据提示 -To get a shell, do: +输入以下命令获取一个 shell: ``` adb shell ``` -## Upgrade Snapdragon +## 升级骁龙 + +此步骤需要 Intrynsic 提供的 Flight_BSP 压缩文件,使用主板序列号注册后可以获得该文件。 -For this step the Flight_BSP zip file from Intrynsic is required. It can be obtained after registering using the board serial. -### Upgrading/replacing the Linux image - +### 升级/替换 Linux 镜像 -Make sure the board can be found using adb: + + +通过 adb 确认飞控板已经被检测到: ``` adb devices ``` -Then, reboot it into the fastboot bootloader: +然后重启飞控板进入fastboot模式: ``` adb reboot bootloader ``` -Make sure the board can be found using fastboot: +通过 fastboot 确认飞控板已经被检测到: ``` fastboot devices ``` -Download the latest BSP from Intrinsyc: + +从Intrinsyc下载最新的板级支持包(BSP): ``` unzip Flight_3.1.1_BSP_apq8074-00003.zip @@ -68,46 +71,49 @@ cd BSP/binaries/Flight_BSP_4.0 ./fastboot-all.sh ``` -It is normal that the partitions `recovery`, `update`, and `factory` will fail. +若 `recovery`, `update` 或 `factory` 部分出现错误,属于正常情况。 + + +### 升级 ADSP 固件 + +部分 PX4 栈在 ADSP(骁龙 8074 的 DSP 端) 上运行。底层的操作系统 QURT 需要单独升级。 -### Updating the ADSP firmware + -Part of the PX4 stack is running on the ADSP (the DSP side of the Snapdragon 8074). The underlying operating system QURT needs to be updated separately. +首先,如果你的BSP还没有达到3.1.1版本,那么先[升级 Linux 镜像](#upgradingreplacing-the-linux-image)! - -First of all, if you're not already on BSP 3.1.1, [upgrade the Linux image](#upgradingreplacing-the-linux-image)! +#### 防止刷成砖 -#### Prevent bricking +为了防止 ADSP 固件的问题而导致系统卡死在启动过程中,请在升级之前完成以下改动: -To prevent the system from hanging on boot because of anything wrong with the ADSP firmware, do the following changes before updating: +通过 `screen` 或者 `adb shell` 直接修改骁龙板上的文件: -Edit the file directly on the Snapdragon over `screen` or `adb shell`: ```sh vim /usr/local/qr-linux/q6-admin.sh ``` -Or load the file locally and edit it there with the editor of your choice: +或者将文件加载到本地并在本地用你自己的编辑器修改它: -To do this, load the file locally: +将文件加载到本地: ```sh adb pull /usr/local/qr-linux/q6-admin.sh ``` -Edit it: +编辑: ```sh gedit q6-admin.sh ``` -And push it back: +然后推送回去: ```sh adb push q6-admin.sh /usr/local/qr-linux/q6-admin.sh adb shell chmod +x /usr/local/qr-linux/q6-admin.sh ``` -Comment out the while loops causing boot to hang: +注释掉会导致启动卡死的 while 循环: ``` # Wait for adsp.mdt to show up @@ -116,7 +122,7 @@ Comment out the while loops causing boot to hang: #done ``` -and: +以及: ``` # Don't leave until ADSP is up @@ -125,11 +131,11 @@ and: #done ``` -#### Push the latest ADSP firmware files +#### 推送最新的 ADSP 固件文件 -Download the file [Flight_3.1.1a_qcom_flight_controller_hexagon_sdk_add_on.zip](http://support.intrinsyc.com/attachments/download/691/Flight_3.1.1a_qcom_flight_controller_hexagon_sdk_add_on.zip) from Intrinsyc. +从 Intrinsyc 下载文件:[Flight_3.1.1a_qcom_flight_controller_hexagon_sdk_add_on.zip](http://support.intrinsyc.com/attachments/download/691/Flight_3.1.1a_qcom_flight_controller_hexagon_sdk_add_on.zip) 。 -And copy them on to the Snapdragon: +并将文件复制到骁龙板上: ``` unzip Flight_3.1.1a_qcom_flight_controller_hexagon_sdk_add_on.zip @@ -137,46 +143,47 @@ cd images/8074-eagle/normal/adsp_proc/obj/qdsp6v5_ReleaseG/LA/system/etc/firmwar adb push . /lib/firmware ``` -Then do a graceful reboot, so that the firmware gets applied: +然后重启一次,让固件能够应用起来: ``` adb reboot ``` -## Serial ports +## 串口 -### Use serial ports +### 使用串口 -Not all POSIX calls are currently supported on QURT. Therefore, some custom ioctl are needed. +现阶段的 QURT 无法支持所有的 POSIX 命令。因此需要用到一些自定义的 ioctl。 -The APIs to set up and use the UART are described in [dspal](https://github.com/PX4/dspal/blob/master/include/dev_fs_lib_serial.h). +用来设置以及使用 UART 的 API 的描述信息包含在[dspal](https://github.com/PX4/dspal/blob/master/include/dev_fs_lib_serial.h)中。 -## Wifi-settings +## Wifi设置 - + -Connect to the Linux shell (see [console instructions](advanced-system-console.html#snapdragon-flight-wiring-the-console)). +连接上 Linux shell (参见 [console instructions](advanced-system-console.html#snapdragon-flight-wiring-the-console))。 -### Access point mode +### 接入点模式 -If you want the Snapdragon to be a wifi access point (AP mode), edit the file: `/etc/hostapd.conf` and set: +如果你想把骁龙设置为一个 wifi 接入点(AP 模式),那么修改文件:`/etc/hostapd.conf`并且设置: ``` ssid=EnterYourSSID wpa_passphrase=EnterYourPassphrase ``` -Then configure AP mode: +然后配置 AP 模式: ``` /usr/local/qr-linux/wificonfig.sh -s softap reboot ``` -### Station mode +### 站模式 + +如果你想让骁龙连上你现有的 wifi ,那么修改此文件:`/etc/wpa_supplicant/wpa_supplicant.conf` 并添加你的网络设置: -If you want the Snapdragon to connect to your existing wifi, edit the file: `/etc/wpa_supplicant/wpa_supplicant.conf` and add your network settings: ``` network={ @@ -185,7 +192,7 @@ network={ } ``` -Then configure station mode: +然后配置站模式: ``` /usr/local/qr-linux/wificonfig.sh -s station @@ -193,25 +200,26 @@ reboot ``` -## Troubleshooting +## 故障排除 -### adb does not work +### adb 不工作 -- Check [permissions](#usb-permissions) -- Make sure you are using a working Micro-USB cable. -- Try a USB 2.0 port. -- Try front and back ports of your computer. +- 检查 [权限](#usb-permissions) +- 确认你的 Micro-USB 线正常连接。 +- 试试 USB 2.0 接口。 +- 试试你电脑前面或后面的接口。 -### USB permissions +### USB 权限 -1) Create a new permissions file +1) 创建一个新的权限管理文件 ``` sudo -i gedit /etc/udev/rules.d/51-android.rules ``` -paste this content, which enables most known devices for ADB access: +粘贴以下内容,这将使 ADB 能够接入大多数已知设备: + ``` SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666", GROUP="plugdev" @@ -247,13 +255,13 @@ SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0666", GROUP="plugdev" SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666", GROUP="plugdev" ``` -Set up the right permissions for the file: +为文件设置正确的权限: ``` sudo chmod a+r /etc/udev/rules.d/51-android.rules ``` -Restart the deamon +重启守护进程: ``` sudo udevadm control --reload-rules @@ -261,85 +269,98 @@ sudo service udev restart sudo udevadm trigger ``` -If it still doesn't work, check [this answer on StackOverflow](http://askubuntu.com/questions/461729/ubuntu-is-not-detecting-my-android-device#answer-644222). +如果 ADB 还是无法工作,看看 [在 StackOverflow 上的这个回答](http://askubuntu.com/questions/461729/ubuntu-is-not-detecting-my-android-device#answer-644222). -### Board doesn't start / is boot-looping / is bricked +### 主板无法启动 / 无限重启 / 变砖 + +如果使用串口控制台仍能连上飞控板,并得到一个提示符,如︰ -If you can still connect to the board using the serial console and get to a prompt such as: ``` root@linaro-developer:~# ``` -You can get into fastboot (bootloader) mode by entering: +你可以输入如下命令进入 fastboot(引导装载程序)模式: + ``` reboot2fastboot ``` -If the serial console is not possible, you can try to connect the Micro USB cable, and enter: +如果串口控制台不可用,你可以尝试使用 Micro USB,并输入如下命令: + ``` adb wait-for-device && adb reboot bootloader ``` -Then power cycle the board. If you're lucky, adb manages to connect briefly and can send the board into fastboot. -To check if it's in fastboot mode, use: +然后重新给主板上电。如果你运气够好,adb 会短暂地连上主板并使主板进入 fastboot 模式。 + +使用下列命令检查主板是否处于 fastboot 模式: ``` fastboot devices ``` -Once you managed to get into fastboot mode, you can try [above teps](#upgradingreplacing-the-linux-image) to update the Android/Linux image. +一旦成功进入 fastboot 模式,就可以尝试通过[上述步骤](#upgradingreplacing-the-linux-image)升级 Android/Linux 镜像。 + +如果你的主板正好是一块 [P2 板](#do-i-have-a-p1-or-p2-board),你应该可以在启动骁龙的时候,通过短接 J3 标识符旁边的两个引脚(在角落的孔和 SD 卡槽之间的两个互相垂直的引脚),将骁龙重置到恢复镜像。 -If you happen to have a [P2 board](#do-i-have-a-p1-or-p2-board), you should be able to reset the Snapdragon to the recovery image by starting up the Snapdragon while shorting the two pins next to where J3 is written (The two rectangular pins in-between the corner hole and the MicroSD card slot almost at the edge of the board. -If everything fails, you probably need to request help from intrinsyc. +如果所有尝试都无效,你可能需要向 Intrinsyc 寻求帮助。 -### No space left on device -Sometimes `make eagle_default upload` fails to upload: +### 设备上没有剩余空间 + +有时 `make eagle_default upload` 会上传失败: ``` failed to copy 'px4' to '/home/linaro/px4': No space left on device ``` -This can happen if ramdumps fill up the disk. To clean up, do: +如果 ramdumps 占满硬盘就会产生这个错误。要清理硬盘,请执行: + + ``` rm -rf /var/log/ramdump/* ``` -Also, the logs might have filled the space. To delete them, do: +同样的,log 文件也可能会占满空间。要删除 log 文件,请执行: + + ``` rm -rf /root/log/* ``` -### Undefined PLT symbol +### 未定义的 PLT 符号 #### _FDtest -If you see the following output on mini-dm when trying to start the px4 program, it means that you need to [update the ADSP firmware](#updating-the-adsp-firmware): +如果在启动 px4 程序时看到 mini-dm 有如下输出,那么说明你需要[升级ADSP固件](#updating-the-adsp-firmware): ``` [08500/03] 05:10.960 HAP:45:undefined PLT symbol _FDtest (689) /libpx4muorb_skel.so 0303 symbol.c ``` -#### Something else +#### 其他 + +如果你改动了源码,类似于添加了函数后,显示`undefined PLT symbol ...`,那说明链接失败了。 + +- 你的函数声明与函数定义一一对应吗? +- 你的代码真的被编译了吗?模块被添加到 [cmake config](https://github.com/PX4/Firmware/blob/master/cmake/configs/qurt_eagle_default.cmake) 了吗? -If you have changed the source, presumably added functions and you see `undefined PLT symbol ...` it means that the linking has failed. +- (添加的)文件包含在`CMakeLists.txt`中吗? +- 试着将它添加到POSIX编译里再进行编译。POSIX链接器会将编译/链接时出现的链接错误显示出来。 -- Do the declaration and definition of your function match one to one? -- Is your code actually getting compiled? -Is the module listed in the [cmake config](https://github.com/PX4/Firmware/blob/master/cmake/configs/qurt_eagle_default.cmake)? -- Is the (added) file included in the `CMakeLists.txt`? -- Try adding it to the POSIX build and running the compilation. The POSIX linker will inform you about linking errors at compile/linking time. -### krait update param XXX failed on startup + + +### krait 启动时更新参数 XXX 失败 ``` ERROR [platforms__posix__px4_layer] krait update param 297 failed @@ -350,19 +371,21 @@ ERROR [muorb] Initialize Error calling the uorb fastrpc initalize method.. ERROR [muorb] ERROR: FastRpcWrapper Not Initialized ``` -If you get errors like the above when starting px4, try -- [upgrading the Linux image](#upgradingreplacing-the-linux-image) -- and [updating the ADSP firmware](#updating-the-adsp-firmware). Also try to do this from a native Linux installation instead of a virtual machine. There have been [reports](https://github.com/PX4/Firmware/issues/5303) where it didn't seem to work when done in a virtual machine. -- then [rebuild the px4 software](http://dev.px4.io/starting-building.html#building-px4-software), by first completely deleting your existing Firmware repo and then recloning it [as described here](http://dev.px4.io/starting-building.html#compiling-on-the-console) -- and finally [rebuild and re-run it](http://dev.px4.io/starting-building.html#qurt--snapdragon-based-boards) -- make sure the executable bit of `/usr/local/qr-linux/q6-admin.sh` is set: +启动 px4 时如果出现上述错误,请尝试: +- [更新 Linux 镜像](#upgradingreplacing-the-linux-image) +- 以及 [更新 ADSP 固件](#updating-the-adsp-firmware)。操作时尝试使用 Linux 实体系统而不是虚拟机。已有[报告](https://github.com/PX4/Firmware/issues/5303)称使用虚拟机更新可能会不起作用。 +- 然后 [重新编译 px4 软件](http://dev.px4.io/starting-building.html#building-px4-software),首先彻底删除你已有的固件仓库再[按此所述](http://dev.px4.io/starting-building.html#compiling-on-the-console)重新克隆。 +- 最后 [重新编译运行 px4](http://dev.px4.io/starting-building.html#qurt--snapdragon-based-boards) +- 确保设置了 `/usr/local/qr-linux/q6-admin.sh` 的可执行权限: `adb shell chmod +x /usr/local/qr-linux/q6-admin.sh` -### ADSP restarts -If the mini-dm console suddently shows a whole lot of INIT output, the ADSP side has crashed. The reasons for it are not obvious, e.g. it can be some segmentation fault, null pointer exception, etc.. +### ADSP 重启 + +如果 mini-dm 控制台突然显示大段初始化输出,那说明 ADSP 端已经崩溃了。崩溃的原因并不明显,有可能是一些段错误,空指针异常等。 + +mini-dm 控制台的输出看起来通常是像这样: -The mini-dm console output typically looks like this: ``` [08500/02] 20:32.332 Process Sensor launched with ID=1 0130 main.c @@ -404,9 +427,10 @@ The mini-dm console output typically looks like this: [08500/02] 20:32.550 HAP:76:cannot find /voiceproc_rx.so 0141 load.c ``` -### Do I have a P1 or P2 board? +### P1 板还是 P2 板? + +骁龙板上的丝印类似于: -The silkscreen on the Snapdragon reads something like: ``` 1DN14-25- @@ -415,8 +439,9 @@ REV A QUALCOMM ``` -If you see **H9550**, it means you have a P2 board! +如果你看到**H9550**,说明你有一块P2板! + +**请忽略上面的-P1。** -**Please ignore that it says -P1.** +可能是由于 P1 板没有出厂分区/镜像,因此不能恢复到出厂状态。 -Presumably P1 boards don't have a factory partition/image and therefore can't be restored to factory state. diff --git a/advanced-uorb.md b/advanced-uorb.md index 905a4a1..0897b28 100644 --- a/advanced-uorb.md +++ b/advanced-uorb.md @@ -1,62 +1,58 @@ -# uORB Messaging +# uORB 消息机制 -## Introduction +## 简介 -The uORB is an asynchronous publish() / subscribe() messaging API used for -inter-thread/inter-process communication. +uORB(*微型对象请求代理*)是一个异步的发布/订阅消息机制的 API,用来实现线程或进程间的通讯。 -Look at the [tutorial](tutorial-hello-sky.md) to learn how to use it in C++. +请参照[教程](tutorial-hello-sky.md) 学习如何在 C++ 中使用该功能。 -uORB is automatically started early on bootup as many applications depend on it. -It is started with `uorb start`. Unit tests can be started with `uorb test`. +由于很多应用依赖该消息机制,uORB 会在系统启动时自动开始运行。 + `uorb start` 命令会启动该消息机制。使用 `uorb test` 命令可以启动单元测试。 -## Adding a new topic +## 添加一个新主题 -To add a new topic, you need to create a new `.msg` file in the `msg/` -directory and add the file name to the `msg/CMakeLists.txt` list. From this, -there will automatically be C/C++ code generated. +为了添加一个新主题,你需要在 `msg/` 路径下添加一个新的 `.msg` 文件,并将该文件名添加到 `msg/CMakeLists.txt` 列表中。通过以上步骤,系统将会自动生成 C/C++ 代码。 -Have a look at the existing `msg` files for supported types. A message can also -be used nested in other messages. -To each generated C/C++ struct, a field `uint64_t timestamp` will be added. This -is used for the logger, so make sure to fill it in when logging the message. +让我们来看看现有的 `msg` 文件所支持的类型。一条消息可以被嵌套在其他消息内。 +对于每一个生成的 C/C++ 结构,都会包含一个 `uint64_t timestamp` 成员。这个成员会被日志模块使用,所以如果要将消息记录进日志,请确保该成员被赋值。 + +要在代码中使用该消息,需要包含头文件: -To use the topic in the code, include the header: ``` #include ``` -By adding a line like the following in the `.msg` file, a single message -definition can be used for multiple independent topic instances: +在 `.msg` 文件中添加类似下面这一行,一条单一的消息定义可以被多个独立的主题实例使用。 + ``` # TOPICS mission offboard_mission onboard_mission ``` -Then in the code, use them as topic id: `ORB_ID(offboard_mission)`. +然后在代码中,通过如下的主题 ID 来使用新定义的主题:`ORB_ID(offboard_mission)`. + +## 消息发布 (Publishing) -## Publishing +消息发布可以在系统的任何地方实现,包括中断上下文(通过 `hrt_call` API 调用的函数)。然而公告消息 (advertising) 则只能在中断上下文外部实现。在同一个进程中,一条主题被发布之前,必须先公告。 -Publishing a topic can be done from anywhere in the system, including interrupt context (functions called by the `hrt_call` API). However, advertising a topic is only possible outside of interrupt context. A topic has to be advertised in the same process as its later published. -## Listing Topics and Listening in +## 主题列表与监听 -