Posts Tagged ‘ instructables

Burning an Arduino Bootloader, reflashing Grbl

X-Carve has been working great, other than the fact the limit-switches only worked for one day:  On day one, they worked as expected.  But on day two, I installed Chilipeppr (which I’ve been continuing to use successfully), and they switches suddenly stopped working.  You can see my thread on the forums here talking about the issue.

After much discussion on that thread and others, it sounded like something was wrong with the Arduino Uno that shipped with the X-Carve.  No problem, I have two other Uno’s, I’ll just upload Grbl to them.  But the problem was, via the “Compile Grbl to the Arduino” page (based on this Inventables Grbl fork), it wouldn’t load.  Note, I’m on OSX 10.10.5

I would get these errors constantly:

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x0d
avrdude: stk500_cmd(): programmer is out of sync

And sometimes this:

avrdude: stk500_recv(): programmer is not responding

Super frustrating.  After more searching, it sounded like the bootloader on the older Uno’s was out of date, and I needed to update it.  I’ve done a lot of Arduino programming in the past, but never had to burn a bootloader.

Arduino has a tutorial here:  Arduino as an ISP  :  It shows how you can use Arduino A to act as an ISP (in-system programmer) for Arduino B.  Problem is, I couldn’t get it to work.  Followed the directions perfectly, but would constantly get errors.

After more searching online, I found reference to “Atmega bootloader program by Nick Gammon”:

I downloaded the source sketch, followed the directions, and it worked!  The only gotcha was, after I uploaded the sketch, I had to open the Serial Monitor to see all the text listed under the “Example Output for Uno” section (that wasn’t terrible obvious for me to do based on the instructions).  I was then able to issue the remainder of the commands, and complete the burn.  So a huge thanks to Nick Gammon!

Once the bootloader was re-burned, I was able to “compile Grbl to Arduino” per the above link, and it actually worked.

But, querying the default grbl values via the $$ command looked really weird.  I learned you need to issue this command to reset to factory defaults:

$RST=$

In addition, programs like Chlipeppr and UGS won’t send the ‘?’ command to grbl over their serial connection (which you need to print your limit switch settings) : I had to issue that via the Arduino IDE’s Serial Monitor.

I was able to test voltage on the digital pins for the limit-switches (D9, D10, D12), and they all had positive voltage, meaning they now work.

But unfortunately, it wouldn’t work in the X-Carve.  From my forum thread above:

Update on this: I checked the digital pins on the new grbl loaded uno: They all read close to 5v, which tells me they should actually support the limit switches. So that’s good…

However, the whole thing doesn’t work: Even though (on the ‘old but updated Uno’) I can query the grbl firmware vals from both the Arduino IDE & from the ‘Advanced settings’ in Easel, when I go to do the machine setup, I can’t jog the steppers at all. No sounds, nothing. I unplugged the limit-switches, but that didn’t make a difference. Swap for the ‘shipped with x-carve’ uno\gshield combo and it scoots all over. Swap back to the ‘old but updated’ uno\gshield, and dead in the water.

Comparing my ‘old but updated’ uno to the ‘shipped with x-carve’ uno, I notice the x-carve one has more header pins the gshield plugs into. At this point I’m guessing that Arduino Uno’s aren’t created equal, and the other ones I have are ‘just too old’.

Maybe I’ll get around to buying a ‘newfangled uno’ eventually, but since right now I’m cutting just fine without the limit-switches, that’ll be a future project. Thanks for all the help though!

SOOOOOooo… no limit-switches for me right now.  But at least I can still carve :)

X-Carve : Configuration & troubleshooting

This page will be an evolving repository for myself, to collect bits and pieces of X-Carve configuration, troubleshooting, etc.


Configuration

Steps per mm

After I built the X-Carve and got a few test cuts in, I found it odd there was no tuning step.  With 3d printers, it’s important to make sure you get their “steps per mm” set so when you say “make this 10cm”, it really is 10cm.  I found the “Calibration Test Pattern” project and started cutting.  Immediately I noticed something was wrong:  The circle (labeled #13) it started with was an oval, not a circle.  After searching the forums, I found this great vid showing how to calculate the steps per mm (just about the exact same process as on a 3d printer), and how to update the settings via Easel:

As it turns out, my Y & Z seemed pretty spot on, but my X was way off.  Fixed!

Motor current

Just like on 3D printers, you need to tune the steppers current so it’s not too little (so that you miss steps) or too great (so you miss steps).    All three of my stepper pots were off from the factory (which is normal, really), and to get started I manually twisted the pots until they started behaving correctly.  But I figured there was a more accurate way, like tuning the stepper drivers on my C-Bot.  And there is: Again, another great vid:

I have the Nema 23’s from inventables, which are 2.8A per phase.  Using the method from the above vid I set them all to 2V.   Seems to work just fine so far.

Troubleshooting

Forum post with a variety of troubleshooting videos:

https://discuss.inventables.com/t/x-carve-maintenance-troubleshooting-videos-add-your-own/13405/5

Understanding GRBL

I somehow got my limit switches broken.  Follow the thread here for the nitty gritty.  As of this authoring they still don’t work:  Worked fine for a day, and then… dead:  Those pins on the Arduino constantly read 0v.  But in the process of debugging this I learned a lot about grbl.

This forum post got me started on talking to grbl.

The easiest way for me to talk with grbl is through the Arduino IDE.  It was a little twichy at first, here’s what I had to go through:

  • Make sure your board is set to Arduino Uno (since right now grbl requires an Uno).
  • Make sure you have the right port selected (obviously).
  • When the serial monitor is up, make sure your baud rate is 115200.
  • If it connects properly, you should see it say something like > Grbl 0.9j [‘$’ for help]
  • You issue commands to grbl by prefixing them with the dollar sign: $.  If you issue the $ command and nothing happens, change the baude rate to 115200 again.  I had to connect a few times before it would let me issue commands to it.

grbl links: