Skip to content

Board: Phytec phyWAVE KW22

Johann Fischer edited this page Jul 6, 2015 · 27 revisions

Manufacturer

Designed and produced by PHYTEC Messtechnik GmbH, D-55129 Mainz.

Components

MCU MKW22D512 CM4, 32-bit, 64kB RAM
Light (TCS3772 Color Light-to-Digital Converter)
Pressure (MPL3115A2)
Tri-axis accelerometer (MMA8652FC)
Tri-axis magnetometer (MAG3110FCR1)
IR-Termopile Sensor (TMP006)
Humidity Sensor (HDC1000)
RGB-LED
Capacitive Button
1x User-Button
Integrated IEEE802.15.4(2006)-compliant radio at 2.4 GHz, 250kBit/s Support for dual PAN ID mode

Layout / Hardware

phyWAVE-A-Eval-Board with equipped phyWAVE-KW22 processor/radio-module.

Phytec PBA-D-01 PhyWave

Details

The PCB-pieces with the mounted sensors can be separated from the eval-board to capture sensor-values from specific spatial points.

Implementation Status

Device ID Supported Comments
MCU MKW22D512 yes mainline
Low-level driver GPIO yes mainline
PWM yes mainline
UART yes mainline
I2C yes mainline
SPI yes mainline
USB no
RTT yes mainline
RNG yes mainline
Timer yes mainline
Radio Chip integrated yes mainline
Humidity Sensor HDC1000 yes mainline
Pressure Sensor MPL3115A2 yes mainline
Accelerometer MMA8652FC yes mainline
Magnetometer MAG3110FCR1 yes mainline
Light Sensor TCS3772 yes WIP
IR-Termopile Sensor TMP006 yes mainline
Capacitive Button PCB no planned

Toolchains

See ARM Family

Working:

Debugging

In order to program (flash) and debug the node you need OpenOCD and an ARM version of gdb (arm-none-eabi-gdb), which provided by most toolchains. Most Linux distributions provide also a package for OpenOCD. The required configuration files are provided by RIOT. Since version 0.9 of OpenOCD the target microcontroller MKW22D512 is supported. The following section describes how to install OpenOCD and set up a gdb-debugging session.

Setup the Environment

The debugging setting consists of openocd and GDB. Additionally one can use CGDB frontend for GDB or Nemiver (sudo yum install nemiver) for a more fancy looking.

  • Various libraries:
    Command for installing them in Ubuntu 14.04:
    sudo apt-get install gcc libudev-dev libusb-1.0-0-dev libfox-1.6-dev autotools-dev autoconf automake libtool gdb-arm-none-eabi gcc-arm-none-eabi cgdb libhidapi-hidraw0 libusb-dev libhidapi-dev libhidapi-hidraw0-dbg
    Command for installing them in Fedora 21 /CentOS 7:
    sudo yum install libudev-devel libusb-devel fox autoconf automake libtool cgdb hidapi-devel libftdi-devel systemd-devel arm-none-eabi-gdb arm-none-eabi-gcc arm-none-eabi-newlib
    ATTENTION: Caused by a BUG in Fedora 21 arm-none-eabi-gcc the provided Toolchain from the Repository isn't able to build RIOT-OS (and a lot more of THUMB-Code Projects) properly! Better use Linaro Toolchain or Toolchain from https://launchpad.net/gcc-arm-embedded. You have to export the Path into your $PATH or e.g. edit your ~/.bashrc file.
    For building openOCD you might need (Fedora 21 / CentOS 7):
    sudo yum install mpfr-devel flex gmp-devel libmpc-devel texinfo bison ncurses-libs ncurses-devel expat expat-devel make gcc gcc-c++

Install openocd (0.9.0-dev-00209-gc3ec194) with the following steps:

clone git://git.code.sf.net/p/openocd/code
git checkout c3ec194
./bootstrap
./configure --enable-cmsis-dap
make
sudo make install

Add hidraw permissions:

  • Open /etc/udev/rules.d/99-hidraw-permissions.rules and append:
`KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev"
ls -l /dev/hidraw*`

Debug Steps

  • Build RIOT for the phyWAVE (pba-d-01) board
    Navigate to the appropriate application inside the RIOT folder structure you want to build. Build, debug or flash with:
BOARD=pba-d-01-kw2x make
BOARD=pba-d-01-kw2x make flash
BOARD=pba-d-01-kw2x make debug
BOARD=pba-d-01-kw2x make reset
BOARD=pba-d-01-kw2x make term (to start the terminal connection to the board)

Attention: In Fedora it is possible that you have to install pyserial:

sudo yum install pyserial

It is possible if you are using Fedora that your OpenOCD cannot connect to your Board, if so, try:

sudo groupadd plugdev
sudo usermod -aG plugdev YOURUSERNAME
sudo usermod -aG dialout YOURUSERNAME
sudo reboot

If you want to use the fancy Nemiver for debugging you have to edit the following files in the shown way:

.../boards/pba-d-01-kw2x/dist/gdb.conf :
target extended-remote:3333
.../boards/pba-d-01-kw2x/dist/debug.sh :
if [ "$retval" == "$unlocked_fcfield" ]; then echo -e "Flash configuration tested...${green} [OK]${NC}" #arm-none-eabi-gdb -tui --command=${1} ${2} #cgdb -d arm-none-eabi-gdb --command=${1} ${2} arm-none-eabi-gdb --batch --command=${1} ${2} nemiver --remote=localhost:3333 --gdb-binary="$(which arm-none-eabi-gdb)" ${2}

Important hints

Missleading openocd terminal print

When perform "BOARD=pba-d-01 make flash" and the target is getting flashed, openocd prints the following message:

flash configuration field erased, please reset the device

Do not reset the device, the terminal print is missleading!!!
If you disconnect the target or shutting down openocd during flash the target will be locked!!

Check for fitting .elf file

To prevent the risk of device locking, there is a automatic test that validates if the .elf-file was built with a fitting board-configuration. This automatic test is executed when perform "make debug" or "make flash".
The successful test is indicated before flash or debug with the following print:

Flash configuration tested... [OK]

If the test fails, the flash or debug process will abort.

Reflash the target in case of an empty or wrong image

If the target-flash is empty or there is a wrong config loaded to the flash, openocd won't work in the described way above. One can fix this following:

  • push and hold reset and start openocd in the RIOT-application build-directory.
openocd -f ../../boards/pba-d-01-kw2x/dist/mkw22d512.cfg
telnet localhost 4444
reset halt
  • release reset
flash write_image erase examples/hello-world/bin/pba-d-01/hello-world.elf
Clone this wiki locally