2017年11月4日土曜日

[Arduino]Keyes_CNC基板のgrblファームを書き込む

GRBLファームの書き方

3軸動かせるCNCシールドを買ったのはいいけど、ファームが入っていない事態が発生。。

自分で書き込まないといけないからどうやるのか調べてみました。

必要なもの
grbl controller(2014年で更新が止まっているのでv0.8用)
UGS(grbl controllerの後継)


【ファーム書込み編】
Step1.上の2つをダウンロードします。
ソースコードはArduino/liblaryフォルダに展開します。
フォルダ1つ開いたらソースコードになるようにしてください。

Step2.ArduinoIDEを使ってgrblファームをアップロードする。

nano版は[cpu_map.h]を一部修正があります。

修正箇所「cpu_map.h」

アップロードする時は、
 ファイル→スケッチ例→grbl→grblUpload
を選んでアップロードします。



Step3.Arduino IDEを起動してシリアルモニターを起動して、「$」を送信。
「$」送信した後「$$」送信した図


応答があればファーム書き換え成功。

その次にUGS起動。
注意する事といえばボーレート設定を「115200」にすることくらい。


他の資料ですが、必要な時に参照できるように下に置いておきます。

【日本語マニュアル】


【ジャンパー説明】
ジャンパー設定(オープンでLOW)

【設定一覧】

$0=10 (ステップパルス, μ秒)
$1=25 (ステップアイドル時間, m秒)
$2=0 (ステップポート反転マスク:00000000)
$3=6 (方向ポート反転マスク:0000110)
$4=0 (ステップ有効反転, bool)
$5=0 (リミットpin反転, bool)
$6=0 (探針pin反転, bool)
$10=3 (状態リポートマスク:00000011)
$11=0.020 (接続偏差, mm)
$12=0.002 (円弧寛容性, mm)
$13=0 (リポートインチ, bool)
$20=0 (ソフトリミット, bool)
$21=0 (ハードリミット, bool)
$22=0 (ホーミングサイクル, bool)
$23=1 (ホーミング反転マスク:00000001)
$24=50.000 (ホーミングフィード, mm/min)
$25=635.000 (ホーミングシーク, mm/min)
$26=250 (ホーミング非跳ね返り, msec)
$27=1.000 (ホーミングpull-off, mm)
$100=314.961 (x, step/mm)
$101=314.961 (y, step/mm)
$102=314.961 (z, step/mm)
$110=635.000 (x 最大レート, mm/min)
$111=635.000 (y 最大レート, mm/min)
$112=635.000 (z 最大レート, mm/min)
$120=50.000 (x 加速, mm/sec^2)
$121=50.000 (y 加速, mm/sec^2)
$122=50.000 (z 加速, mm/sec^2)
$130=225.000 (x 最大移動量, mm)
$131=125.000 (y 最大移動量, mm)
$132=170.000 (z 最大移動量, mm)

【エラーリスト】

  "error:1"  : _("G-code words consist of a letter and a value. Letter was not found."),
"error:2"  : _("Numeric value format is not valid or missing an expected value."),
"error:3"  : _("Grbl '$' system command was not recognized or supported."),
"error:4"  : _("Negative value received for an expected positive value."),
"error:5"  : _("Homing cycle is not enabled via settings."),
"error:6"  : _("Minimum step pulse time must be greater than 3usec"),
"error:7"  : _("EEPROM read failed. Reset and restored to default values."),
"error:8"  : _("Grbl '$' command cannot be used unless Grbl is IDLE. Ensures smooth operation during a job."),
"error:9"  : _("G-code locked out during alarm or jog state"),
"error:10" : _("Soft limits cannot be enabled without homing also enabled."),
"error:11" : _("Max characters per line exceeded. Line was not processed and executed."),
"error:12" : _("(Compile Option) Grbl '$' setting value exceeds the maximum step rate supported."),
"error:13" : _("Safety door detected as opened and door state initiated."),
"error:14" : _("(Grbl-Mega Only) Build info or startup line exceeded EEPROM line length limit."),
"error:15" : _("Jog target exceeds machine travel. Command ignored."),
"error:16" : _("Jog command with no '=' or contains prohibited g-code."),
"error:20" : _("Unsupported or invalid g-code command found in block."),
"error:21" : _("More than one g-code command from same modal group found in block."),
"error:22" : _("Feed rate has not yet been set or is undefined."),
"error:23" : _("G-code command in block requires an integer value."),
"error:24" : _("Two G-code commands that both require the use of the XYZ axis words were detected in the block."),
"error:25" : _("A G-code word was repeated in the block."),
"error:26" : _("A G-code command implicitly or explicitly requires XYZ axis words in the block, but none were detected."),
"error:27" : _("N line number value is not within the valid range of 1 - 9,999,999."),
"error:28" : _("A G-code command was sent, but is missing some required P or L value words in the line."),
"error:29" : _("Grbl supports six work coordinate systems G54-G59. G59.1, G59.2, and G59.3 are not supported."),
"error:30" : _("The G53 G-code command requires either a G0 seek or G1 feed motion mode to be active. A different motion was active."),
"error:31" : _("There are unused axis words in the block and G80 motion mode cancel is active."),
"error:32" : _("A G2 or G3 arc was commanded but there are no XYZ axis words in the selected plane to trace the arc."),
"error:33" : _("The motion command has an invalid target. G2, G3, and G38.2 generates this error, if the arc is impossible to generate or if the probe target is the current position."),
"error:34" : _("A G2 or G3 arc, traced with the radius definition, had a mathematical error when computing the arc geometry. Try either breaking up the arc into semi-circles or quadrants, or redefine them with the arc offset definition."),
"error:35" : _("A G2 or G3 arc, traced with the offset definition, is missing the IJK offset word in the selected plane to trace the arc."),
"error:36" : _("There are unused, leftover G-code words that aren't used by any command in the block."),
"error:37" : _("The G43.1 dynamic tool length offset command cannot apply an offset to an axis other than its configured axis. The Grbl default axis is the Z-axis."),
"error:38" : _("An invalid tool number sent to the parser"),

"ALARM:1" : _("Hard limit triggered. Machine position is likely lost due to sudden and immediate halt. Re-homing is highly recommended."),
"ALARM:2" : _("G-code motion target exceeds machine travel. Machine position safely retained. Alarm may be unlocked."),
"ALARM:3" : _("Reset while in motion. Grbl cannot guarantee position. Lost steps are likely. Re-homing is highly recommended."),
"ALARM:4" : _("Probe fail. The probe is not in the expected initial state before starting probe cycle, where G38.2 and G38.3 is not triggered and G38.4 and G38.5 is triggered."),
"ALARM:5" : _("Probe fail. Probe did not contact the workpiece within the programmed travel for G38.2 and G38.4."),
"ALARM:6" : _("Homing fail. Reset during active homing cycle."),
"ALARM:7" : _("Homing fail. Safety door was opened during active homing cycle."),
"ALARM:8" : _("Homing fail. Cycle failed to clear limit switch when pulling off. Try increasing pull-off setting or check wiring."),
"ALARM:9" : _("Homing fail. Could not find limit switch within search distance. Defined as 1.5 * max_travel on search and 5 * pulloff on locate phases."),

"Hold:0" : _("Hold complete. Ready to resume."),
"Hold:1" : _("Hold in-progress. Reset will throw an alarm."),
"Door:0" : _("Door closed. Ready to resume."),
"Door:1" : _("Machine stopped. Door still ajar. Can't resume until closed."),
"Door:2" : _("Door opened. Hold (or parking retract) in-progress. Reset will throw an alarm."),
"Door:3" : _("Door closed and resuming. Restoring from park, if applicable. Reset will throw an alarm."),




Androider