1.. zephyr:board:: twr_ke18f 2 3Overview 4******** 5 6The TWR-KE18F is a development board for NXP Kinetis KE1xF 32-bit 7MCU-based platforms. The onboard OpenSDAv2 serial and debug adapter, 8running an open source bootloader, offers options for serial 9communication, flash programming, and run-control debugging. 10 11Hardware 12******** 13 14- MKE18F512VLL16 MCU (up to 168 MHz, 512 KB flash memory, 64 KB RAM, 15 and 100 Low profile Quad Flat Package (LQFP)) 16- 3.3 V or 5 V MCU operation 17- 6-axis FXOS8700CQ digital accelerometer and magnetometer 18- RGB LED 19- Four user LEDs 20- Two user push-buttons 21- Potentiometer 22- Thermistor 23- Infrared port (IrDA) 24- CAN pin header 25- Flex I/O pin header 26 27For more information about the KE1xF SoC and the TWR-KE18F board, see 28these NXP reference documents: 29 30- `KE1xF Website`_ 31- `KE1xF Datasheet`_ 32- `KE1xF Reference Manual`_ 33- `TWR-KE18F Website`_ 34- `TWR-KE18F User Guide`_ 35- `TWR-KE18F Schematics`_ 36 37Supported Features 38================== 39 40.. zephyr:board-supported-hw:: 41 42System Clock 43============ 44 45The KE18 SoC is configured to use the 8 MHz external oscillator on the 46board with the on-chip PLL to generate a 120 MHz system clock. 47 48Serial Port 49=========== 50 51The KE18 SoC has three UARTs. UART0 is configured for the console. The 52remaining UARTs are not used. 53 54Accelerometer and magnetometer 55============================== 56 57The TWR-KE18F board by default only supports polling the FXOS8700 58accelerometer and magnetometer for sensor values 59(``CONFIG_FXOS8700_TRIGGER_NONE=y``). 60 61In order to support FXOS8700 triggers (interrupts) the 0 ohm resistors 62``R47`` and ``R57`` must be mounted on the TWR-KE18F board. The 63devicetree must also be modified to describe the FXOS8700 interrupt 64GPIOs: 65 66.. code-block:: devicetree 67 68 /dts-v1/; 69 70 &fxos8700 { 71 int1-gpios = <&gpioa 14 0>; 72 int2-gpios = <&gpioc 17 0>; 73 }; 74 75Finally, a trigger option must be enabled in Kconfig (either 76``FXOS8700_TRIGGER_GLOBAL_THREAD=y`` or 77``FXOS8700_TRIGGER_OWN_THREAD=y``). 78 79Programming and Debugging 80************************* 81 82.. zephyr:board-supported-runners:: 83 84Build and flash applications as usual (see :ref:`build_an_application` and 85:ref:`application_run` for more details). 86 87Configuring a Debug Probe 88========================= 89 90A debug probe is used for both flashing and debugging the board. This board is 91configured by default to use the :ref:`opensda-daplink-onboard-debug-probe`. 92 93Early versions of this board have an outdated version of the OpenSDA bootloader 94and require an update. Please see the `DAPLink Bootloader Update`_ page for 95instructions to update from the CMSIS-DAP bootloader to the DAPLink bootloader. 96 97Option 1: :ref:`opensda-daplink-onboard-debug-probe` (Recommended) 98------------------------------------------------------------------ 99 100Install the :ref:`pyocd-debug-host-tools` and make sure they are in your search 101path. 102 103Follow the instructions in :ref:`opensda-daplink-onboard-debug-probe` to program 104the `OpenSDA DAPLink TWR-KE18F Firmware`_. 105 106Option 2: :ref:`opensda-jlink-onboard-debug-probe` 107-------------------------------------------------- 108 109Install the :ref:`jlink-debug-host-tools` and make sure they are in your search 110path. 111 112Follow the instructions in :ref:`opensda-jlink-onboard-debug-probe` to program 113the `OpenSDA J-Link Firmware for TWR-KE18F`_. 114 115Add the arguments ``-DBOARD_FLASH_RUNNER=jlink`` and 116``-DBOARD_DEBUG_RUNNER=jlink`` when you invoke ``west build`` to override the 117default runner from pyOCD to J-Link: 118 119.. zephyr-app-commands:: 120 :zephyr-app: samples/hello_world 121 :board: twr_ke18f 122 :gen-args: -DBOARD_FLASH_RUNNER=jlink -DBOARD_DEBUG_RUNNER=jlink 123 :goals: build 124 125Configuring a Console 126===================== 127 128Regardless of your choice in debug probe, we will use the OpenSDA 129microcontroller as a usb-to-serial adapter for the serial console. 130 131Connect a USB cable from your PC to J2. 132 133Use the following settings with your serial terminal of choice (minicom, putty, 134etc.): 135 136- Speed: 115200 137- Data: 8 bits 138- Parity: None 139- Stop bits: 1 140 141Flashing 142======== 143 144Here is an example for the :zephyr:code-sample:`hello_world` application. 145 146.. zephyr-app-commands:: 147 :zephyr-app: samples/hello_world 148 :board: twr_ke18f 149 :goals: flash 150 151Open a serial terminal, reset the board (press the SW1 button), and you should 152see the following message in the terminal: 153 154.. code-block:: console 155 156 ***** Booting Zephyr OS v1.14.0-xxx-gxxxxxxxxxxxx ***** 157 Hello World! twr_ke18f 158 159Debugging 160========= 161 162Here is an example for the :zephyr:code-sample:`hello_world` application. 163 164.. zephyr-app-commands:: 165 :zephyr-app: samples/hello_world 166 :board: twr_ke18f 167 :goals: debug 168 169Open a serial terminal, step through the application in your debugger, and you 170should see the following message in the terminal: 171 172.. code-block:: console 173 174 ***** Booting Zephyr OS v1.14.0-xxx-gxxxxxxxxxxxx ***** 175 Hello World! twr_ke18f 176 177.. include:: ../../common/board-footer.rst 178 :start-after: nxp-board-footer 179 180.. _TWR-KE18F Website: 181 https://www.nxp.com/TWR-KE18F 182 183.. _TWR-KE18F User Guide: 184 https://www.nxp.com/docs/en/user-guide/TWRKE18FUG.pdf 185 186.. _TWR-KE18F Schematics: 187 https://www.nxp.com/webapp/Download?colCode=TWR-KE18F-SCH-DESIGNFILES 188 189.. _KE1xF Website: 190 https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/kinetis-cortex-m-mcus/e-series5v-robustm0-plus-m4/kinetis-ke1xf-168mhz-performance-with-can-5v-microcontrollers-based-on-arm-cortex-m4:KE1xF 191 192.. _KE1xF Datasheet: 193 https://www.nxp.com/docs/en/data-sheet/KE1xFP100M168SF0.pdf 194 195.. _KE1xF Reference Manual: 196 https://www.nxp.com/docs/en/reference-manual/KE1xFP100M168SF0RM.pdf 197 198.. _DAPLink Bootloader Update: 199 https://os.mbed.com/blog/entry/DAPLink-bootloader-update/ 200 201.. _OpenSDA DAPLink TWR-KE18F Firmware: 202 https://www.nxp.com/support/developer-resources/run-time-software/kinetis-developer-resources/ides-for-kinetis-mcus/opensda-serial-and-debug-adapter:OPENSDA#TWR-KE18F 203 204.. _OpenSDA J-Link Firmware for TWR-KE18F: 205 https://www.segger.com/downloads/jlink/OpenSDA_TWR-KE18F 206