Freescale FRDM-KL46Z 評価用ボードの使い方 Freescale FRDM-KL46Z の使い方を、「Quick Start Guide」や「FRDM-KL46Z User's Manual」を 中心に日本語で説明する。ソフト開発はCode Warriorを参照の事。Code WarriorとはFreescale社が 出している統合開発環境だ。 このボードを購入したら、先ずwww.freesacle.com の"サイト内検索"で FRDM-KL46Z Quick Start Package を 入れて、このパッケージをダウンロードしよう。パッケージ内にはライセンス・アグリーメントと コンパイル済みの本体用アプリとOpenSDAアプリと、クイック・スタート・ガイドが入っている。これだけでも 結構遊べる。 次に、www.freescal.com/FRDM-KL46Z からユーザーズマニュアルなどもゲットし、暇なときにコードウォリア という巨大アプリ開発環境もダウンロードしておこう。オフライン版は1GBを超える。コードウォリアは 統合開発環境で、アセンブラやC/C++などが込み。無料評価版は利用期間の制限はない。アセンブラも 利用制限はない。しかしこのボード上のMPUはKinetis LシリーズKL46なので、Cコンパイラは64kB制限になる。 なのでこのボードの256kBは全部を利用できないことになる・・・・。 無料でアプリを開発するならmbedの方がいい。このボードはARM mbed availableなのだ。 mbedでの利用はこちら参照 尚、ホビーユースでは、STM32やKinetisなどのARM cortex Mのマイコンボードは、mbed対応品でないと話に ならないと思う。なぜなら開発環境が断然いいからだ。また世界中のエンジニアがライブラリなど情報公開している ので、今後どんどん新製品やプログラム開発が進むだろう。 mbedホームページをみてみよう!! ついでに言えば、STM32ディスカバリ(STM32 discovery)なんか 開発環境がイマイチだねー。買わない方がいいよ。 以下、英文資料の拙訳なので、原文もつけてある。おかしい?と思われた部分は原文を読んでちょ。 れーによって、君もしくは君のシステムが壊れ、あるいはふっとんでも、当局は一切関知しないから そのつもりで。なおこのサイトは自動的に消滅する。成功を祈る。mission impossible
Getting Start [0] Optional: Download and Install the P&E OpenSDA USB Drivers found at www.pemicro.com/opensda.
FRDM-KL46Z comes with the mass-storage device (MSD) Flash Programmer OpenSDA Application preinstalled. It will appear as a removable storage drive with a volume label of FRDM-KL46Z
If the USB CDC Serial Port fails to automatically install in Windows, follow the instructions in Step 2. Otherwise, skip to Step 3.
a. Open Device Manager b. Locate and right-click on “OpenSDA ? CDC Serial Port” c. Select “Update Driver Software” d. ”Browse” and select the FRDM-KL46Z drive e. Click “Next” to complete the installation
Running "out of box DEMO" USBをつなぐだけで電源が入り、プリインストされたデモアプリが動き出す。SW1を押していくと 下記のアプリが順に動く。
Introduction to OpenSDA (訳注) FRDM-KL46Zというボードには、Kinetis Cortex-M0のメインMPUだけでなく、これをUSB経由で パソコンに接続するためのシステムも搭載している。FT232のようにUSBシリアル変換だけするような単純なもの ではなく、専用のMCU(回路図中のU7)を使っている。 このMCUのファームウェアも書き換えできるようになっている。この接続するためのシステムに P&E社のOpenSDAというシステムを採用している。OpenSDAシステムは、メインMPUのプログラム空間を Windowsのファイルシステムとして表示させたり、メインMPUとパソコンをつなぐための仮想シリアル ポートを提供したり、またメインMPUに対する強力なデバッグ機能まで提供するという、 3つの役割を果たしている。 この3つの機能を、専用MCUとそのファームウェアで実現しているのだ。なのでライタのような専用の アダプタインタフェース装置やライタ・ソフトも不要。ボードにPCからUSB接続するだけ。 大変すごい機能のように感じるが、将来的にはマイコン・ボードはみんなこのような形態になっていく事 だろう。開発環境もArduino, mbed, GR-SAKURA のようにオンライン・コンパイラで、誰でも使いやすく、 分かりやすいライブラリや解説が整えられていく事だろう。 以下、その説明が続く。 The MSD Flash Programmer is a composite USB application that provides a virtual serial port and an easy and convenient way to program applications into the KL46Z MCU. It emulates a FAT16 file system, appearing as a removable drive in the host file system with a volume label of FRDM-KL46Z. Raw binary and Motorola S-record files that are copied to the drive are programmed directly into the flash of the KL46 and executed automatically. The virtual serial port can be opened with standard serial terminal applications.
[1]Locate the Precompiled Example folder in the FRDM-KL46Z Quick Start Package. [2]Copy & paste or drag & drop one of the .srec files to the FRDM-KL46Z drive. The new application should now be running on the FRDM-KL46Z drive. Program FRDMKL46_Demo_freedom.srec example to replace the out-of-box demo on your FRDM-KL46Z drive.
[1]Determine the symbolic name assigned to the FRDM-KL46Z virtual serial port. In Windows open Device Manager and look for the COM port named “PEMicro/Freescale ? CDC Serial Port”. [2]Open the serial terminal emulation program of your choice. Examples for Windows include Tera Term, PuTTY, and HyperTerminal. [3]Program one of the “serial test” applications from the Precompiled Examples folder using the MSD Flash Programmer. [4]Configure the terminal program. Most embedded examples use Baudrate115200, 8 data bits, no parity bits, and one stop bit (8-N-1). [5]Press and release the Reset button (SW1) at anytime to restart the example application. Resetting the embedded application will not affect the connection of the virtual serial port to the terminal program. NOTE: Refer to the OpenSDA User’s Guide for a description of a known Windows issue when disconnecting a virtual serial port while the COM port is in use.
OpenSDA is an open-standard serial and debug adapter. It bridges serial and debug communications between a USB host and an embedded target processor. OpenSDA software includes a flash-resident USB mass-storage device (MSD) bootloader and a collection of OpenSDA Applications. FRDM-KL46Z comes with the MSD Flash Programmer OpenSDA Application preinstalled. Follow these instructions to run the OpenSDA Bootloader and change the installed OpenSDA Application to P&E Debug Application that provides debugging and a virtual serial port all in one application.
[1]Unplug the USB cable if attached. [2]Press and hold the Reset button [3]Plug in a USB cable(not included) between a USB host and the OpenSDA USB connector(labeled"SDA") while holding the Reset button. [4]Release the Reset button. A removable drive should now be visible in the host file system with a volume label of BOOTLOADER. You are now in OpenSDA Bootloader mode.
[1]Locate the OpenSDA Applications folder in the FRDM-KL46Z Quick Start Package. [2]Copy & paste or drag & drop the Debug Application (DEBUG-APP_Pemicro_v106.SDA) to the BOOTLOADER drive. [3]Unplug the USB cable and plug it in again. The new OpenSDA Application should now be running and now you can debug your application. For more details on Debug mode or Mass storage application refer to the OpenSDA user’s guide “OPENSDAUG.pdf” Use this same procedure to load other OpenSDA Applications
FRDM-KL46Z User's Manual 1 FRDM-KL46Z Overview The Freescale Freedom development platform is a set of software and hardware tools for evaluation and development. It is ideal for rapid prototyping of microcontroller-based applications. The Freescale Freedom KL46Z hardware, FRDM-KL46Z, is a simple, yet sophisticated design featuring a Kinetis L series microcontroller, built on the ARM Cortex-M0+ core. FRDM-KL46Z can be used to evaluate the KL46, KL36, KL26 and KL16 Kinetis L series devices. It features a MKL46Z256VLL4, this device boasting a max operating frequency of 48MHz, 256KB of flash, 32KB RAM, a full-speed USB controller, segment LCD controller, and loads of analog and digital peripherals. The FRDM-KL46Z hardware is form-factor compatible with the Arduino R3 pin layout, providing a broad range of expansion board options. The on-board interfaces includes a 4 digit segment LCD, a 3-axis digital accelerometer, magnetometer, capacitive touch slider, and ambient light sensor. The FRDM-KL46Z features the Freescale open standard embedded serial and debug adapter known as OpenSDA. This circuit offers several options for serial communications, flash programming and run-control debugging.
2 References documents(参考文献) The table below provides a list of reference documents for the FRDM-KL46Z hardware. All of these documents are available online at www.freescale.com/FRDM-KL46Z. ==下表はボードの参考文献リスト。 www.freescale.com/FRDM-KL46Zから全部入手可能。
3 Getting started Refer to the FRDM-KL46Z Quick Start Package for step-by-step instructions for getting started with the FRDM-KL46Z. See the Jump Start Your Design section on http://www.freescale.com/FRDM-KL46Z for the Quick Start Package and software lab guides.
4 FRDM-KL46Z Hardware Overview ・MKL46Z256VLLZ4 MCU (48 MHz, 256KB Flash, 32 KB RAM, Low power, 100LQFP package) ・Dual role USB interface with mini-B USB connector ・Open SDA ・4 digit segment LCD module ・Capacitive touch slider ・Ambient light sensor ・MMA8451Q accelerometer ・MAG3110 Magnetometer ・2 user LEDs ・2 user push buttons ・Flexible power supply options = USB, coin cell battery, external source ・Battery-ready, power-measurement access points ・Easy access to MCU I/O via Arduino R3 compatible I/O connectors ・Programmable OpenSDA debug interface with multiple applications available including: ・Mass storage device flash programming interface ・P&E Debug interface provides run-control debugging and compatibility with IDE tools ・CMSIS-DAP interface: new ARM standard for embedded debug interface ・Data logging application ・Arduino R3 compatibility <Fig1 ブロックダイヤグラム> <Fig2 部品配置> 5 FRDM-KL46Z Hardware Description 5.1.1 Power Supply There are multiple power supply options on the FRDM-KL46Z. It can be powered from either of the USB connectors, the VIN pin on the I/O header, an on-board coin cell battery, or an off-board 1.71-3.6V supply from the 3.3V pin on the I/O header. The USB and VIN supplies are regulated on-board using a 3.3V linear regulator to produce the main power supply. The other two sources are not regulated on-board. Table 2 provides the operational details and requirements for the power supplies. Note that the OpenSDA circuit is only operational when a USB cable is connected and supplying power to OpenSDA USB. However, protection circuitry is in place to allow multiple sources to be powered at once.
5.1.2 Serial and Debug Adapter (OpenSDA) OpenSDA is an open-standard serial and debug adapter. It bridges serial and debug communications between a USB host and an embedded target processor as shown in Figure 4. The hardware circuit is based on a Freescale Kinetis K20 family microcontroller (MCU) with 128 KB of embedded flash and an integrated USB controller. OpenSDA features a mass storage device (MSD) bootloader, which provides a quick and easy mechanism for loading different OpenSDA Applications such as flash programmers, run-control debug interfaces, serial-to-USB converters, and more. Refer to the OpenSDA User’s Guide for more details.
OpenSDA is managed by a Kinetis K20 MCU built on the ARM Cortex-M4 core. The OpenSDA circuit includes a status LED (D8) and a pushbutton (SW2). The pushbutton asserts the Reset signal to the KL46 target MCU. It can also be used to place the OpenSDA circuit into Bootloader mode. SPI and GPIO signals provide an interface to either the SWD debug port of the K20. Additionally, signal connections are available to implement a UART serial channel. The OpenSDA circuit receives power when the USB connector J13 is plugged into a USB host.
Signals with SPI and GPIO capability are used to connect directly to the SWD of the KL46. These signals are also brought out to a standard 10-pin (0.05”) Cortex Debug connector (J11). It is possible to isolate the KL46 MCU from the OpenSDA circuit and use J11 to connect to an off-board MCU. To accomplish this, cut the trace on the bottom side of the PCB that connects J18 pin 2 to J11 pin 2. This will disconnect the SWD_CLK pin to the KL46 so that it will not interfere with the communications to an off-board MCU connected to J11.
Note that J11 is not-populated by default. A Samtec FTSH-105-02-F-D or compatible connector can be added to the J11 through-hole connector. A mating cable, such as a Samtec FFSD IDC cable, can then be used to connect from the OpenSDA of the FRDM-KL46Z to an off-board SWD connector.
MKL46Z4 Microcontroller FRDM-KL46ZボードのマイクロプロセッサはKinetis LシリーズのKL462Z256VLL4だ
5.1.3 Clock source The Kinetis KL46 microcontrollers feature an on-chip oscillator compatible with three ranges of input crystal or resonator frequencies: 32-40 kHz (low freq. mode), 3-8 MHz (high freq. mode, low range) and 8-32 MHz (high freq. mode, high range). The KL46Z256on the FRDM-KL46Z is clocked from an 8 MHz crystal..
5.1.4 USB Interface The Kinetis KL46 microcontrollers feature a dual-role USB controller with on-chip full-speed and low-speed transceivers. The USB interface on the FRDM-KL46Z is configured as a full-speed USB device. VREGIN must be powered to enable the internal circuitry of USB (by jumper J7)
5.1.5 Serial Port The primary serial port interface signals are PTA1 UART0 RX and PTA2 UART0_TX. These signals are connected the OpenSDA
5.1.6 Reset The RESET signal on the K20 is connected externally to a pushbutton, SW2, and also to the OpenSDA circuit. The reset button can be used to force an external reset event in the target MCU. The reset button can also be used to force the OpenSDA circuit into bootloader mode. Please refer to section 5.2, Serial and Debug Adapter (OpenSDA), for more details.
5.1.7 Debug The sole debug interface on all Kinetis L Series devices is a Serial Wire Debug (SWD) port. The primary controller of this interface on the FRDM-KL46Z is the onboard OpenSDA circuit (see section 5.2). However, an unpopulated 10-pin (0.05”) Cortex Debug connector, J11, provides access to the SWD signals. The Samtec FTSH-105-02-F-D or compatible connectors can be added to the J11 through-hole debug connector to allow for an external debug cable to be connected.
5.1.8 Segment LCD FRDM-KL46Z is using a 4 digit display (LUMEX LCD-S401M16KR) 4x8 segments. following table shows connection from KL46 to s401 display.
5.1.9 Capacitive Touch Slider Two Touch Sense Input (TSI) signals, TSI0_CH9/PTB16, and TSI0_CH10/PTB17 are connected to capacitive electrodes configured as a touch slider. Freescale’s Touch Sense Software (TSS) provides a software library for implementing the capacitive touch slider.
5.1.10 Three-axis Accelerometer A Freescale MMA8451Q low-power, three-axis accelerometer is interfaced through an I2C bus and two GPIO signals as shown in Table 5 below. By default, the I2C address is 0x1D (SA0 pulled high).
5.1.11 Three-axis Digital Magnetometer A Freescale MAG3110 Three-Axis, Digital Magnetometer is interfaced through an I2C bus, and one GPIO signals as shown in Table 6 below
5.1.12 LEDs Two LED, Green LED is PWM capable, Signal connections are shown in Table 7.
5.1.13 Visible light sensor The FRDM-KL46Z has a visible light sensor that is connected to ADC0_SE3
5.1.14 Input/Output Connectors The MKL46Z256VLL4 microcontroller is packaged in a 100-pin LQFP. Some pins are utilized in on-board circuitry, but many are directly connected to one of four I/O headers. The pins on the KL46 microcontroller are named for their general purpose input/output port pin function. For example, the 1st pin on Port A is referred to as PTA1. The I/O connector pin names are given the same name as the KL46 pin connected to it, where applicable. Note that all pinout data is available in spreadsheet format in FRDM-KL46Z Pinouts. See the Reference Documents section for details.
5.1.15 Arduino Compatibility The I/O headers on the FRDM-KL46Z are arranged to allow compatibility with peripheral boards (known as shields) that connect to Arduino and Arduino-compatible microcontroller boards. The outer rows of pins (the even numbered pins) on the headers share the same mechanical spacing and placement as the I/O headers on the Arduino Revision 3 (R3) standard.
mbed での利用 mbedとはネット上でプログラムをコンパイルして、それをマイコンボードに ダウロードして、動作させる事ができるサイトだ。<mbed.org> 参照。mbedのサイト でプログラム開発ができるのは、mbed対応のマイコンボードだけ。現状ARM社設計仕様のCortex-M0やM3を コアにした、MPU搭載のボード(MPUメーカ、ボードメーカは色々ある)。 mbed.orgのサイトの[Platforms]ボタンを押して、購入した自分のマイコンボードを選択することから 始める。 FRDM-KL46Zでmbedを利用する概要を書く。まず[Platforms]でFRDM-KL46Zを選び、mbed用ファームウェアを ダウンロードし、ボードのresetSWを押しならパソコンにUSB接続する。するとボードは"bootloaderモード" で立ち上がるので、mbed用ファームウェアをbootloaderドライブにコピー&ペーストする。 そして一旦USBを切り離し、 再度接続するとこのボードはmbed仕様でパソコンにつながり、"mbed"ドライブが見えるようになる。 一旦このようにmbed仕様にすると、デフォルトの"FRDM-KL46Z"ドライブはもはや見えなくなる。 ボードはそのままで、次にmbed.orgのサイトで自分のアカウントを新規登録してログインする。その状態 でmbedドライブの中のmbed.htmをクリックすると、FRDM-KL46Zが自分のアカウント内で、 自分の使っているボードとして登録されて、[compiler] が使えるようになる。mbed.orgの最上段右端の[Compiler]ボタンを押してみよう。 ここから先、mbed上でプログラミング、コンパイラ、ダウンロードなどの方法を確認してくれ。 もどる |