Sahara's WebLog

日記のような、備忘録のような、うらみつらみのような、自慢のような…。

mbed LPC1114FN28 mbedでコンパイルしたbinファイルを書き込む

mbed LPC1114FN28 開発環境」の続き。

[Compile]をクリックしてコンパイルする。
mbed_bin_write_01
こんな窓が出て。
mbed_bin_write_02
出来上がったbinファイルをダウンロードする窓が出るので、lpc21ispと同じフォルダに保存する。
mbed_bin_write_03
この後、「追加投資255円(税込み、送料別)でIchigoJamを試す。(ファームウェア書き込みまで)」に書いたのと同じ接続をする。

IchigoJamではhexファイルが与えられているのでFlashMagicだけで書き込めたが、mbedはbinファイルしか吐かないので、FlashMagicの前段にbinからhexへの変換が必要になる。
それにはHexToolというのを使ってみて、問題なく書き込めたが、なにせ2度手間になる。
そこで登場するのがlpc21ispで、コマンドラインからの実行になるが、手間は1回で済む。
lpc21ispの準備は別記事に書いたので「lpc21ispの準備」を参照のこと。
ここでは、すでにlpc21ispの実行ファイルが準備できている前提で話が進む。

binファイルと lpc21isp.exe のあるフォルダで、コマンドプロンプトから以下のように実行する。
lpc21isp -bin mbed_blinky_LPC1114-2.bin com7 28800 12000
これは、binファイルの名前が「mbed_blinky_LPC1114-2.bin」、COMポートが7番、ボーレートを28800baud、マイコンのクロックが12MHzの場合。
mbed_bin_write_04
一見面倒そうだが、コマンドプロンプトは開きっぱなしにしておいて、必要な部分だけ書き換えてEnterをクリックするだけなので、実は楽だ。
覚えておくと便利なファンクションは「F3」だ。
コマンドプロンプトで[F3]を押すと、直前のコマンドがもう一度入力できる。
あと、コピペも出来るので、知っていると重宝だ。
タイトルバーを右クリック > 編集 > 貼り付け
mingw-18

lpc21isp [[Options]] [file[ file[] [comport] [baudrate][Oscillator_in_kHz]
OPTIONS
-bin : for uploading binary file
-hex : for uploading file in intel hex format (default)
-term : for starting terminal after upload
-termonly : for starting terminal without an upload
-localecho : for local echo in terminal
-detectonly : detect only used LPC chiptype (PHILIPSARM only)
-debug0 : for no debug
-debug3 : for progress info only
-debug5 : for full debug
-donotstart : do not start MCU after download
-try : try n times to synchronise
-wipe: Erase entire device before upload
-control : for controlling RS232 lines for easier booting (Reset = DTR,EnableBootLoader = RTS)
-controlswap : swap RS232 control lines (Reset = RTS, EnableBootLoader = DTR)
-controlinv : Invert state of RTS & DTR (0=true/assert/set,1=false/deassert/clear).
-verify : Verify the data in Flash after every writes to sector. To detecterrors in writing to Flash ROM
-logfile : for enabling logging of terminal output to lpc21isp.log
-halfduplex : use halfduplex serial communication (i.e. with K
-Line)
-ADARM : for downloading to an Analog Devices ARM microcontrollerADUC70xx
-PHILIPSARM : for downloading to a microcontroller from NXP(Philips)LPC13xx/LPC17xx/LPC2000 family (default)

お決まりのLチカ動画。
点滅が速すぎてカメラのフレームが拾えてないが、実際にはパパッと短く2度点滅している。

このエントリーをはてなブックマークに追加

Posted under: mbed系


コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

Time limit is exhausted. Please reload CAPTCHA.