Posts Tagged ‘ bootloader

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 :)