cisen / blog

Time waits for no one.
135 stars 20 forks source link

德仪 CC2652R1 TI 使用相关 #774

Open cisen opened 5 years ago

cisen commented 5 years ago

总结

文档

cisen commented 5 years ago

入门

  1. 安装sdk: simplelink_cc13x2_26x2_sdk_3_30_00_03(驱动)
  2. 安装ccs:CCS9.2.0.00013_win64(代码编辑,自带程序变量关联)
  3. 用ccs import sdk自带的example,并编译,比如:C:\ti\simplelink_cc13x2_26x2_sdk_3_30_00_03\examples\nortos\CC26X2R1_LAUNCHXL
  4. 然后在工作区域(user/workspace)就可以找到对应工程的out文件
  5. 安装uniflash_sl.5.2.0.2519,选择ccs编译好的.out文件烧录到板子里面

Reset 重置

  1. 使用uniflash的Board Reset之后,系统也会被删除,这时候手机app没办法连接板子和查看板子信息
  2. 这时候可以使用uniflash将C:\ti\simplelink_cc13x2_26x2_sdk_3_30_00_03\examples\rtos\CC26X2R1_LAUNCHXL\ble5stack\hexfiles SDK里面自带的ROM烧录到板子里面,然后等待大概1分钟,手机就又会出现project zero连接到板子

调试

串口连接

编写代码

cisen commented 5 years ago

tock

安装

TI LAUNCHXL-CC26x2/CC13x2 SimpleLink Wireless MCU LaunchPad Development Kit

The launchpad launchxl CC26X2R1 is a platform based on the CC26x2 MCU by Texas Instrument, an SoC with an ARM Cortex-M4 and a multi-functional Radio (BLE, IEEE, FM). The kit is i2c compatible, and can be extended with several sensors using i2c.

The technical reference manual for the cc26x2 can be found here.

Getting Started

First, follow the Tock Getting Started guide.

There are two options for flashing and debugging the board:

  1. OpenOCD + on-board debugger: The launchxl boards have an on-board debug-chip (the XDS110) to allow flashing and debugging the chip over USB that works with OpenOCD. However, to use the on-board debugger, you need to upgrade its firmware, and use an unreleased version of OpenOCD that can interface with it.

  2. JLinkExe + external JTag debugger: You can connect an external debugger to the JTag port (labled "Target In") and use JLinkExe/JLinkGDBServer to flash and debug the chip. This is currently a more seemless software experience, but requires additinoal hardware (the debugger).

Hardware Setup

The jumpers on the configurable headers change which debug features are available.

In order to interact with the serial console over USB, you need to attach jumpers to the RX and TX pins.

For flashing and debugging, you need different sets of jumpers for each strategy.

If you're using OpenOCD, ensure all the jumpers are attached to the configurable header pins. Specifically, for flashing and debugging you need at least:

If you're using JLinkExe/JLinkGDBServer, make sure to detach the TMS, TCK, TDO, and TDI pins. If you don't, JLinkExe will fail to connect and print an error that it cannot find ICE-PICK (because TI is really serious about useful error messages).

InitTarget: Can not find ICE-Pick (IDCODE mismatch).

Update the XDS110 firmware

Only necessary for OpenOCD

The launchpad has TI's XDS110 JTAG device that can be used to program it. However, OpenOCD requires a recent version of the firmware that may not be on the board. To update, follow the steps here. Note: you only need to download CCS to do this, the firmware.bin file is in the xds110 folder.

Install OpenOCD from Git

Only necessary for OpenOCD

As of July 2018, the released version of OpenOCD (v0.10) does not include support for the XDS110 on-board debugger. However, support is available from source since May 2018 so you must install a version of OpenOCD from a recent Git snapshot.

$ git clone https://git.code.sf.net/p/openocd/code openocd

Refer to the OpenOCD README for specific installation instructions, but it is just a normal autotools project, so the following should work:

$ cd openocd
$ ./bootstrap
$ ./configure --prefix $HOME/.local
$ make install

Tockloader

Tockloader supports flashing the launchpad using OpenOCD.

$ tockloader <command> --board launchxl-cc26x2r1 --openocd

Customer Configuration (CCFG)

IMPORTANT: This step is both necessary (at least once) and a bit dangerous. Proceed carefully.

The CC26x2/CC13x2 series of chips contains a set of customer configuration registers (CCFG) that modify chip behavior in various ways, including the radio MAC address, voltage, and startup behavior. The registers live at a very high address, but can be written using the last page in flash (offset 0x56000).

By default, the chip is configured to start a hardware bootloader that loads a payload binary over the UART. We do not use this bootloader. Before Tock will properly boot, you have to change the CCFG registers.

A reasonable set of CCFG values is in src/ccfg.rs, which compiles to a separate target binary and can be flashed directly to offset of the first CCFG register (0x57FA8).

If you're using OpenOCD:

$ make flash-ccfg

If you're using JLinkExe

$ make flash-ccfg-jlink

Flashing the kernel

The Makefile targets flash (for OpenOCD) and flash-jlink) (for JLinkExe) build and load the kernel.

OpenOCD:

$ make flash       # make and flash the kernel

JLinkExe:

$ make flash-jlink       # make and flash the kernel

Flashing processes

You can flash processes using Tockloader.

OpenOCD:

$ tockloader install --board launchxl-cc26x2r1 --openocd [PATH_TO_PROCESS]

JLinkExe:

$ tockloader install --board launchxl-cc26x2r1 --jlink [PATH_TO_PROCESS]

Debugging

You need to use openocd together with gdb in order to debug the launchxl board using JTAG. However, you'll need to build OpenOCD with extra applied patches until the next version has been released.

Clone the repository and apply the patches:

$> git clone https://git.code.sf.net/p/openocd/code openocd
$> cd openocd
$> git pull http://openocd.zylin.com/openocd refs/changes/22/4322/2
$> git pull http://openocd.zylin.com/openocd refs/changes/58/4358/1

Once cloned and the patches has been applied, read the readme in order to build and install openocd.

Once flashed, launch openocd with the configuration specified at jtag/openocd.cfg:

$> openocd -f jtag/openocd.cfg

And then launch gdb

$> arm-none-eabi-gdb -x jtag/gdbinit

and it will automatically connect to the board.

NOTE: There is currently a problem using the cortex_m SYSRESETREQ command in openocd in order to reset the board. This is also the default way we want to reset..

Panic/Crash

When the board panics or crashes, the RED led will blink rapidly.