Tuesday, December 27, 2011

Sanguinololu 1.3a - Part 3:Not Out of The Woods Yet

See Also:
Part 1 - Build
Part 2 -  Trouble in Paradise

After the events of the last 2 parts I thought the Sanguinololu was finally working properly. But that would have been too easy, right? (I wouldn't have called it easy.) Of course not, something's still not right. Now I could upload and download firmware fine, and they seem to work. Except...
  • Both boards seem to reset or reboot at random.
  • One board gets a lot of serial errors, I resoldered the FTDI chip several times. I'm convinced my soldering is OK.
  • I noticed that touching my scope's 10x probe to the resonator pins produced serial errors and seemed to crash the 1284p some times
Turns out the Sanguino, from which I tried to use the bootloader and related software, as per the instructions on the Sanguinololu wiki page, is built with a crystal oscillator, not a ceramic resonator, so the fuse settings may be different. The Mighty 1284p bootloader is also set to a crystal oscillator.

I used http://www.engbedded.com/fusecalc/ to calculate new fuse settings

I burned Mighty 1284p bootloader with new fuse settings (changed in boards.txt):
Low 0xD6
High 0xDC
Ext  0xFD

I ran the controller connected to usb (no motors or external power) for over 3500 lines of g-code without error. Previously it would error some where between when it connected (before the build even started) and definitely before 200 lines of g-code.

I hooked up my motors and ran another build. I haven't built a frame yet, I've got other projects to finish first, but it ran the motors for a full build (11222 lines, the sample build-benchmart.stl), so we'll call it good for now.

From what I have been able to find the fuse settings for the Sanguino and Mighty 1284p are just plain wrong for the Sanguinololu. They are for a external crystal oscillator. Apparently the full sweep oscillator setting is required for a resonator. The above settings seem very stable so far.

UPDTATE: I just got a 644p to play with, I haven't had a lot of time for testing yet, but it seems stable on both the default settings (ext crystal osc) and my modified fuse settings. I think almost everyone uses the 644p and this may be the reason I haven't found anyone else with this problem. I'm inclined to believe that my setting (full swing osc - ceramic resonator) is correct for both micros, but the 644p doesn't mind the wrong setting nearly as much as the 1284p. I've still got more tests to run on it, so I'll update as I go.


  1. Happy Holiday !!!

    Nice articles. I'm just blogwalking and very happy to stop here. And also give you some comment here.

    Dont forget to give us some your comment into my blog too.

  2. So any issues so far with the 1284p? I'm working on some Melzi boards and using your settings.

    1. I have done very little further testing on the 1284p since I wrote this article.

      The only thing I would add is if you use a crystal instead of a ceramic resonator the stock settings should work fine. Crystal's are more stable, produce a cleaner wave, or something, I don't know. Resonators seem to works fine with the 644p, but really act up on the 1284p. The Sanguino calls for a crystal, the Mighty 1284p calls for a crystal, why bother with a resonator?

      I started building a frame for the cnc. I've got 3 axis sliding nicely, a little play to eliminate but not too bad. I haven't attached motors, lead screws or any other control mechanisms yet.

      The whole project is stalled for a while. Unfortunately I have too much stuff to do right now. Hopefully I will get back to it before too long, but it may be a couple weeks or, more likely, next winter before I have time.

  3. OMG. Thank you! That was driving me nuts! I now have a working 1284p.

  4. Dear Sir,

    I have Atmega1284P rectangular or Squared Microcontroller and I have marlin firmware software. How do I bootloader marlin code into 1284P. Please tell me the steps. It would take only few minutes for an experts but for me it may be months and months. I am beginner for this field. I am learning. I have seen some tutorials and also went for some web sites, blogspots and all. I did not get which PROGRAMMER from arduino we should select. Even I see How arduino UNO can be act as Arduino by ARDUNO-ISP for Atmega328. I did not get steps or videos related to ATmega1284P. So, kindly do a favor in telling me that HOW TO BOOTLOAD Atmega1284P with what PROGRAMMER? and what all hardwares needed for it like PROGRAMMER device and all. I needed step by step procedure. Please take your valuable time.