Part 1
요약·해설
기능 16종, 120 MHz clock, FXOS8700 interrupt 수정, 구형 bootloader 갱신과 pyOCD/J-Link 선택을 설명합니다.
KE18F · 최대 168 MHz · 5 V
R47/R57 · devicetree · Kconfig
DAPLink/pyOCD 또는 J-Link
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
0B2138E5570065579D2AAEE01353F60BB9CA4710373BD69F99F6AD04FDE8019C
.. _twr_ke18f:
NXP TWR-KE18F
#############
Overview
********
The TWR-KE18F is a development board for NXP Kinetis KE1xF 32-bit
MCU-based platforms. The onboard OpenSDAv2 serial and debug adapter,
running an open source bootloader, offers options for serial
communication, flash programming, and run-control debugging.
.. figure:: ../../../../../../../boards/nxp/twr_ke18f/doc/TWR-KE18F-DEVICE.jpg
:align: center
:alt: TWR-KE18F
TWR-KE18F (Credit: NXP)
Hardware
********
- MKE18F512VLL16 MCU (up to 168 MHz, 512 KB flash memory, 64 KB RAM,
and 100 Low profile Quad Flat Package (LQFP))
- 3.3 V or 5 V MCU operation
- 6-axis FXOS8700CQ digital accelerometer and magnetometer
- RGB LED
- Four user LEDs
- Two user push-buttons
- Potentiometer
- Thermistor
- Infrared port (IrDA)
- CAN pin header
- Flex I/O pin header
For more information about the KE1xF SoC and the TWR-KE18F board, see
these NXP reference documents:
- `KE1xF Website`_
- `KE1xF Datasheet`_
- `KE1xF Reference Manual`_
- `TWR-KE18F Website`_
- `TWR-KE18F User Guide`_
- `TWR-KE18F Schematics`_
Supported Features
==================
The twr_ke18f board configuration supports the following hardware
features:
+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+=====================================+
| NVIC | on-chip | nested vector interrupt controller |
+-----------+------------+-------------------------------------+
| SYSTICK | on-chip | systick |
+-----------+------------+-------------------------------------+
| PINMUX | on-chip | pinmux |
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
| UART | on-chip | serial port-polling; |
| | | serial port-interrupt |
+-----------+------------+-------------------------------------+
| FLASH | on-chip | soc flash |
+-----------+------------+-------------------------------------+
| RTC | on-chip | rtc |
+-----------+------------+-------------------------------------+
| I2C(M) | on-chip | i2c |
+-----------+------------+-------------------------------------+
| SENSOR | off-chip | fxos8700 polling; |
| | | trigger supported with H/W mods |
| | | explained below; |
+-----------+------------+-------------------------------------+
| SPI(M) | on-chip | spi |
+-----------+------------+-------------------------------------+
| ADC | on-chip | adc |
+-----------+------------+-------------------------------------+
| CAN | on-chip | can |
+-----------+------------+-------------------------------------+
| WDT | on-chip | watchdog |
+-----------+------------+-------------------------------------+
| PWM | on-chip | pwm |
+-----------+------------+-------------------------------------+
| DAC | on-chip | dac |
+-----------+------------+-------------------------------------+
| ACMP | on-chip | analog comparator |
+-----------+------------+-------------------------------------+
The default configuration can be found in the defconfig file:
:zephyr_file:`boards/nxp/twr_ke18f/twr_ke18f_defconfig`.
Other hardware features are not currently supported by the port.
System Clock
============
The KE18 SoC is configured to use the 8 MHz external oscillator on the
board with the on-chip PLL to generate a 120 MHz system clock.
Serial Port
===========
The KE18 SoC has three UARTs. UART0 is configured for the console. The
remaining UARTs are not used.
Accelerometer and magnetometer
==============================
The TWR-KE18F board by default only supports polling the FXOS8700
accelerometer and magnetometer for sensor values
(``CONFIG_FXOS8700_TRIGGER_NONE=y``).
In order to support FXOS8700 triggers (interrupts) the 0 ohm resistors
``R47`` and ``R57`` must be mounted on the TWR-KE18F board. The
devicetree must also be modified to describe the FXOS8700 interrupt
GPIOs:
.. code-block:: devicetree
/dts-v1/;
&fxos8700 {
int1-gpios = <&gpioa 14 0>;
int2-gpios = <&gpioc 17 0>;
};
Finally, a trigger option must be enabled in Kconfig (either
``FXOS8700_TRIGGER_GLOBAL_THREAD=y`` or
``FXOS8700_TRIGGER_OWN_THREAD=y``).
Programming and Debugging
*************************
Build and flash applications as usual (see :ref:`build_an_application` and
:ref:`application_run` for more details).
Configuring a Debug Probe
=========================
A debug probe is used for both flashing and debugging the board. This board is
configured by default to use the :ref:`opensda-daplink-onboard-debug-probe`.
Early versions of this board have an outdated version of the OpenSDA bootloader
and require an update. Please see the `DAPLink Bootloader Update`_ page for
instructions to update from the CMSIS-DAP bootloader to the DAPLink bootloader.
Option 1: :ref:`opensda-daplink-onboard-debug-probe` (Recommended)
------------------------------------------------------------------
Install the :ref:`pyocd-debug-host-tools` and make sure they are in your search
path.
Follow the instructions in :ref:`opensda-daplink-onboard-debug-probe` to program
the `OpenSDA DAPLink TWR-KE18F Firmware`_.
Option 2: :ref:`opensda-jlink-onboard-debug-probe`
--------------------------------------------------
Install the :ref:`jlink-debug-host-tools` and make sure they are in your search
path.
Follow the instructions in :ref:`opensda-jlink-onboard-debug-probe` to program
the `OpenSDA J-Link Firmware for TWR-KE18F`_.
Add the arguments ``-DBOARD_FLASH_RUNNER=jlink`` and
``-DBOARD_DEBUG_RUNNER=jlink`` when you invoke ``west build`` to override the
default runner from pyOCD to J-Link:
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: twr_ke18f
:gen-args: -DBOARD_FLASH_RUNNER=jlink -DBOARD_DEBUG_RUNNER=jlink
:goals: build
Configuring a Console
=====================
Regardless of your choice in debug probe, we will use the OpenSDA
microcontroller as a usb-to-serial adapter for the serial console.
Connect a USB cable from your PC to J2.
Use the following settings with your serial terminal of choice (minicom, putty,
etc.):
- Speed: 115200
- Data: 8 bits
- Parity: None
- Stop bits: 1
Flashing
========
Here is an example for the :ref:`hello_world` application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: twr_ke18f
:goals: flash
Open a serial terminal, reset the board (press the SW1 button), and you should
see the following message in the terminal:
.. code-block:: console
***** Booting Zephyr OS v1.14.0-xxx-gxxxxxxxxxxxx *****
Hello World! twr_ke18f
Debugging
=========
Here is an example for the :ref:`hello_world` application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: twr_ke18f
:goals: debug
Open a serial terminal, step through the application in your debugger, and you
should see the following message in the terminal:
.. code-block:: console
***** Booting Zephyr OS v1.14.0-xxx-gxxxxxxxxxxxx *****
Hello World! twr_ke18f
.. _TWR-KE18F Website:
https://www.nxp.com/TWR-KE18F
.. _TWR-KE18F User Guide:
https://www.nxp.com/docs/en/user-guide/TWRKE18FUG.pdf
.. _TWR-KE18F Schematics:
https://www.nxp.com/webapp/Download?colCode=TWR-KE18F-SCH-DESIGNFILES
.. _KE1xF Website:
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
.. _KE1xF Datasheet:
https://www.nxp.com/docs/en/data-sheet/KE1xFP100M168SF0.pdf
.. _KE1xF Reference Manual:
https://www.nxp.com/docs/en/reference-manual/KE1xFP100M168SF0RM.pdf
.. _DAPLink Bootloader Update:
https://os.mbed.com/blog/entry/DAPLink-bootloader-update/
.. _OpenSDA DAPLink TWR-KE18F Firmware:
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
.. _OpenSDA J-Link Firmware for TWR-KE18F:
https://www.segger.com/downloads/jlink/OpenSDA_TWR-KE18F
Part 3
한국어 전문 번역
개요
TWR-KE18F는 NXP Kinetis KE1xF 32-bit MCU platform용 development board입니다. Open-source bootloader를 실행하는 on-board OpenSDAv2 serial/debug adapter가 serial communication, flash programming, run-control debugging 선택지를 제공합니다.

하드웨어
MKE18F512VLL16MCU: 최대 168 MHz, 512 KB flash, 64 KB RAM, 100-pin LQFP- 3.3 V 또는 5 V MCU 동작
- 6-axis FXOS8700CQ digital accelerometer·magnetometer
- RGB LED와 user LED 4개
- User push-button 2개
- Potentiometer와 thermistor
- Infrared port(IrDA)
- CAN pin header와 Flex I/O pin header
지원 기능
| 인터페이스 | 컨트롤러 | 드라이버/컴포넌트 |
|---|---|---|
NVIC | on-chip | nested vector interrupt controller |
SYSTICK | on-chip | systick |
PINMUX | on-chip | pinmux |
GPIO | on-chip | gpio |
UART | on-chip | serial port-polling; serial port-interrupt |
FLASH | on-chip | soc flash |
RTC | on-chip | rtc |
I2C(M) | on-chip | i2c |
SENSOR | off-chip | fxos8700 polling; 아래 hardware 수정 시 trigger 지원 |
SPI(M) | on-chip | spi |
ADC | on-chip | adc |
CAN | on-chip | can |
WDT | on-chip | watchdog |
PWM | on-chip | pwm |
DAC | on-chip | dac |
ACMP | on-chip | analog comparator |
기본 구성은 boards/nxp/twr_ke18f/twr_ke18f_defconfig에 있습니다. 표 밖의 하드웨어 기능은 현재 port에서 지원하지 않습니다.
시스템 클록
KE18 SoC는 보드의 8 MHz external oscillator와 on-chip PLL로 120 MHz system clock을 생성하도록 구성됩니다.
직렬 포트
KE18 SoC에는 UART가 3개 있습니다. UART0을 console로 구성하고 나머지는 사용하지 않습니다.
Accelerometer와 magnetometer
기본 TWR-KE18F는 CONFIG_FXOS8700_TRIGGER_NONE=y로 FXOS8700 sensor 값을 polling하는 방식만 지원합니다.
FXOS8700 trigger, 즉 interrupt를 지원하려면 TWR-KE18F에 0 Ohm resistor R47과 R57을 장착하고, devicetree에 interrupt GPIO를 기술합니다.
/dts-v1/;
&fxos8700 {
int1-gpios = <&gpioa 14 0>;
int2-gpios = <&gpioc 17 0>;
};
마지막으로 Kconfig에서 FXOS8700_TRIGGER_GLOBAL_THREAD=y 또는 FXOS8700_TRIGGER_OWN_THREAD=y를 활성화합니다.
프로그래밍과 디버깅
일반 application과 같은 방식으로 build하고 flash합니다. 기본 debug probe는 OpenSDA DAPLink입니다. 초기 revision 보드는 오래된 OpenSDA bootloader를 사용하므로 DAPLink Bootloader Update 절차에 따라 CMSIS-DAP bootloader에서 DAPLink bootloader로 갱신해야 합니다.
선택 1: OpenSDA DAPLink on-board, 권장
- pyOCD host tool을 설치하고 검색 경로에 넣습니다.
- OpenSDA DAPLink on-board probe 절차에 따라 TWR-KE18F용 OpenSDA DAPLink firmware를 programming합니다.
선택 2: OpenSDA J-Link on-board
- J-Link host tool을 설치하고 검색 경로에 넣습니다.
- OpenSDA J-Link on-board probe 절차에 따라 TWR-KE18F용 OpenSDA J-Link firmware를 programming합니다.
west build 때 -DBOARD_FLASH_RUNNER=jlink와 -DBOARD_DEBUG_RUNNER=jlink를 추가해 기본 pyOCD runner를 J-Link로 바꿉니다.
# Zephyr 저장소 루트에서
west build -b twr_ke18f samples/hello_world -- -DBOARD_FLASH_RUNNER=jlink -DBOARD_DEBUG_RUNNER=jlink
콘솔
선택한 debug probe와 관계없이 OpenSDA MCU를 serial console용 USB-to-serial adapter로 사용합니다. PC의 USB cable을 J2에 연결합니다. Terminal은 115200 baud, data 8 bits, parity None, stop bit 1로 설정합니다.
플래시
# Zephyr 저장소 루트에서
west build -b twr_ke18f samples/hello_world
west flash
Serial terminal을 열고 SW1 button을 눌러 reset하면 다음 메시지가 표시됩니다.
***** Booting Zephyr OS v1.14.0-xxx-gxxxxxxxxxxxx *****
Hello World! twr_ke18f
디버깅
# Zephyr 저장소 루트에서
west build -b twr_ke18f samples/hello_world
west debug
Debugger에서 application을 단계 실행하면 terminal에 다음 메시지가 표시됩니다.
***** Booting Zephyr OS v1.14.0-xxx-gxxxxxxxxxxxx *****
Hello World! twr_ke18f
참고 자료
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.