1.. zephyr:board:: frdm_kl25z 2 3Overview 4******** 5 6The Freedom KL25Z is an ultra-low-cost development platform for 7Kinetis |reg| L Series KL1x (KL14/15) and KL2x (KL24/25) MCUs built 8on ARM |reg| Cortex |reg|-M0+ processor. 9 10The FRDM-KL25Z features include easy access to MCU I/O, battery-ready, 11low-power operation, a standard-based form factor with expansion board 12options and a built-in debug interface for flash programming and run-control. 13 14Hardware 15******** 16 17- MKL25Z128VLK4 MCU @ 48 MHz, 128 KB flash, 16 KB SRAM, USB OTG (FS), 80LQFP 18- On board capacitive touch "slider", MMA8451Q accelerometer, and tri-color LED 19- OpenSDA debug interface 20 21For more information about the KL25Z SoC and FRDM-KL25Z board: 22 23- `KL25Z Website`_ 24- `KL25Z Datasheet`_ 25- `KL25Z Reference Manual`_ 26- `FRDM-KL25Z Website`_ 27- `FRDM-KL25Z User Guide`_ 28- `FRDM-KL25Z Schematics`_ 29 30Supported Features 31================== 32 33The frdm_kl25z board configuration supports the following hardware features: 34 35+-----------+------------+-------------------------------------+ 36| Interface | Controller | Driver/Component | 37+===========+============+=====================================+ 38| NVIC | on-chip | nested vector interrupt controller | 39+-----------+------------+-------------------------------------+ 40| SYSTICK | on-chip | systick | 41+-----------+------------+-------------------------------------+ 42| PINMUX | on-chip | pinmux | 43+-----------+------------+-------------------------------------+ 44| GPIO | on-chip | gpio | 45+-----------+------------+-------------------------------------+ 46| UART | on-chip | serial port-polling; | 47| | | serial port-interrupt | 48+-----------+------------+-------------------------------------+ 49| I2C | on-chip | i2c | 50+-----------+------------+-------------------------------------+ 51| ADC | on-chip | adc | 52+-----------+------------+-------------------------------------+ 53| FLASH | on-chip | soc flash | 54+-----------+------------+-------------------------------------+ 55| USB | on-chip | USB device | 56+-----------+------------+-------------------------------------+ 57 58The default configuration can be found in 59:zephyr_file:`boards/nxp/frdm_kl25z/frdm_kl25z_defconfig` 60 61Other hardware features are not currently supported by the port. 62 63Connections and IOs 64=================== 65 66The KL25Z SoC has five pairs of pinmux/gpio controllers, and all are currently enabled 67(PORTA/GPIOA, PORTB/GPIOB, PORTC/GPIOC, PORTD/GPIOD, and PORTE/GPIOE) for the FRDM-KL25Z board. 68 69+-------+-------------+---------------------------+ 70| Name | Function | Usage | 71+=======+=============+===========================+ 72| PTB2 | ADC | ADC0 channel 12 | 73+-------+-------------+---------------------------+ 74| PTB18 | GPIO | Red LED | 75+-------+-------------+---------------------------+ 76| PTB19 | GPIO | Green LED | 77+-------+-------------+---------------------------+ 78| PTD1 | GPIO | Blue LED | 79+-------+-------------+---------------------------+ 80| PTA1 | UART0_RX | UART Console | 81+-------+-------------+---------------------------+ 82| PTA2 | UART0_TX | UART Console | 83+-------+-------------+---------------------------+ 84| PTE24 | I2C0_SCL | I2C | 85+-------+-------------+---------------------------+ 86| PTE25 | I2C0_SDA | I2C | 87+-------+-------------+---------------------------+ 88 89 90System Clock 91============ 92 93The KL25Z SoC is configured to use the 8 MHz external oscillator on the board 94with the on-chip FLL to generate a 48 MHz system clock. 95 96Serial Port 97=========== 98 99The KL25Z UART0 is used for the console. 100 101USB 102=== 103 104The KL25Z SoC has a USB OTG (USBOTG) controller that supports both 105device and host functions through its mini USB connector (USB KL25Z). 106Only USB device function is supported in Zephyr at the moment. 107 108Programming and Debugging 109************************* 110 111Build and flash applications as usual (see :ref:`build_an_application` and 112:ref:`application_run` for more details). 113 114Configuring a Debug Probe 115========================= 116 117A debug probe is used for both flashing and debugging the board. This board is 118configured by default to use the :ref:`opensda-daplink-onboard-debug-probe`. 119 120Early versions of this board have an outdated version of the OpenSDA bootloader 121and require an update. Please see the `DAPLink Bootloader Update`_ page for 122instructions to update from the CMSIS-DAP bootloader to the DAPLink bootloader. 123 124Option 1: Linkserver: :ref:`opensda-daplink-onboard-debug-probe` (Recommended) 125------------------------------------------------------------------------------ 126 127 Install the :ref:`linkserver-debug-host-tools` and make sure they are in your 128 search path. LinkServer works with the CMSIS-DAP debug firmware. Please follow the 129 instructions on :ref:`opensda-daplink-onboard-debug-probe` and select the latest revision 130 of the firmware image. 131 132 Linkserver is the default for this board, ``west flash`` and ``west debug`` will 133 call the linkserver runner. 134 135 .. code-block:: console 136 137 west flash 138 west debug 139 140Option 2: :ref:`opensda-jlink-onboard-debug-probe` 141-------------------------------------------------- 142 143Install the :ref:`jlink-debug-host-tools` and make sure they are in your search 144path. 145 146Follow the instructions in :ref:`opensda-jlink-onboard-debug-probe` to program 147the `OpenSDA J-Link FRDM-KL25Z Firmware`_. 148 149Add the arguments ``-DBOARD_FLASH_RUNNER=jlink`` and 150``-DBOARD_DEBUG_RUNNER=jlink`` when you invoke ``west build`` to override the 151default runner from pyOCD to J-Link: 152 153.. zephyr-app-commands:: 154 :zephyr-app: samples/hello_world 155 :board: frdm_kl25z 156 :gen-args: -DBOARD_FLASH_RUNNER=jlink -DBOARD_DEBUG_RUNNER=jlink 157 :goals: build 158 159Note: 160----- 161 162The runners supported by NXP are LinkServer and JLink. pyOCD is another potential option, 163but NXP does not test or support the pyOCD runner. 164 165Configuring a Console 166===================== 167 168Regardless of your choice in debug probe, we will use the OpenSDA 169microcontroller as a usb-to-serial adapter for the serial console. 170 171Connect a USB cable from your PC to J7. 172 173Use the following settings with your serial terminal of choice (minicom, putty, 174etc.): 175 176- Speed: 115200 177- Data: 8 bits 178- Parity: None 179- Stop bits: 1 180 181Flashing 182======== 183 184Here is an example for the :zephyr:code-sample:`hello_world` application. 185 186.. zephyr-app-commands:: 187 :zephyr-app: samples/hello_world 188 :board: frdm_kl25z 189 :goals: flash 190 191Open a serial terminal, reset the board (press the SW1 button), and you should 192see the following message in the terminal: 193 194.. code-block:: console 195 196 ***** Booting Zephyr OS v1.14.0-rc1 ***** 197 Hello World! frdm_kl25z 198 199Debugging 200========= 201 202Here is an example for the :zephyr:code-sample:`hello_world` application. 203 204.. zephyr-app-commands:: 205 :zephyr-app: samples/hello_world 206 :board: frdm_kl25z 207 :goals: debug 208 209Open a serial terminal, step through the application in your debugger, and you 210should see the following message in the terminal: 211 212.. code-block:: console 213 214 ***** Booting Zephyr OS v1.14.0-rc1 ***** 215 Hello World! frdm_kl25z 216 217.. _FRDM-KL25Z Website: 218 https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/kinetis-cortex-m-mcus/l-seriesultra-low-powerm0-plus/freedom-development-platform-for-kinetis-kl14-kl15-kl24-kl25-mcus:FRDM-KL25Z 219 220.. _FRDM-KL25Z User Guide: 221 https://www.nxp.com/webapp/Download?colCode=FRDMKL25ZUM 222 223.. _FRDM-KL25Z Schematics: 224 https://www.nxp.com/downloads/en/schematics/FRDM-KL25Z_SCH_REV_E.pdf 225 226.. _KL25Z Website: 227 https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/kinetis-cortex-m-mcus/l-seriesultra-low-powerm0-plus/kinetis-kl2x-72-96mhz-usb-ultra-low-power-microcontrollers-mcus-based-on-arm-cortex-m0-plus-core:KL2x?&l 228 229.. _KL25Z Datasheet: 230 https://www.nxp.com/docs/en/data-sheet/KL25P80M48SF0.pdf 231 232.. _KL25Z Reference Manual: 233 https://www.nxp.com/webapp/Download?colCode=KL25P80M48SF0RM 234 235.. _DAPLink Bootloader Update: 236 https://os.mbed.com/blog/entry/DAPLink-bootloader-update/ 237 238.. _OpenSDA DAPLink FRDM-KL25Z Firmware: 239 https://www.nxp.com/downloads/en/ide-debug-compile-build-tools/OpenSDAv2.2_DAPLink_frdmkl25z_rev0242.zip 240 241.. _OpenSDA J-Link FRDM-KL25Z Firmware: 242 https://www.segger.com/downloads/jlink/OpenSDA_FRDM-KL25Z 243