Welcome! Log In Create A New Profile

Advanced

Sanguinololu Rev 1.3a - how to load firmware

Posted by Dam 
Dam
Sanguinololu Rev 1.3a - how to load firmware
August 06, 2016 07:41AM
Hi all,

I just got a new Sanguinololu Rev 1.3a board for my old Huxley printer. (the old one was broken)

From what I understand I need to load the firmware and possibly a bootloader? I don't know anything about this kind of thing so I am completely in the dark. From what I understand if windows doesn't recognize the board then that means that there isn't a bootloader and I need some sort of programmer.

Though I hope some sort of luck is on my side as windows recognizes the board and is in the device manager as a comp-port. I have installed the FTDI driver too.

I assume now I need to use Arduino.exe to load the firmware (as far as I know that is Marlin) that I have downloaded from Github. Arduino.exe didn't have the board in the board manager but managed to install the Singuino settings and now I can see the board. Though I don't know if I am supposed to choose 8MHz or 16MHz?

From here I am completely stuck. From what I can see I must drag the Marlin directory/files into the Arduino program and then there are things that need to be changed to make it work with a Huxley? I have no idea if this is right and if it is, what needs to be changed or what to do next. I hope I don't have to do the bootloader as then I have to get some sort of programmer thing to burn it? Though this is just from a bunch of reading and I don't really know what I am doing. I just don't want to break anything. smiling smiley

Any help would be greatly appreciated. Sorry for the long post.

Much thanks.

Damian
Dam
Re: Sanguinololu Rev 1.3a - how to load firmware
August 07, 2016 07:49AM
Hi there,

I have been trying to compile and upload the Marlin Firmware via Arduino.

I downloaded the Sanguino board 'preset via the board manager.

However when I try upload I get this error message:

Build options changed, rebuilding all
In file included from sketch\pins.h:61:0,

from sketch\MarlinConfig.h:33,

from D:\Huxley\Marlin-RC\Marlin-RC\Marlin_HuxleyTest1\Marlin_HuxleyTest1.ino:37:

pins_RAMPS.h:48: error: #error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu."

#error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu."

^

exit status 1
#error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu."


I have tried using the Arduino Mega 'preset' and all it does is time out. Any help would be amazing, I am very much in the dark here.

I am using Arduino 1.6.10

Thanks,

D
Re: Sanguinololu Rev 1.3a - how to load firmware
August 07, 2016 11:49PM
I don’t know where you got this Marlin_HuxleyTest1.ino from, but it looks like its designed to work on a arduino mega only.

It has code to check you have selected this as your board and will not compile for other boards such as the SL

most firmware has a motherboard - section in the configuration.h, this is what sets what physical board is expected

from boards.h
#define BOARD_SANGUINOLOLU_11 6 // Sanguinololu < 1.2
#define BOARD_SANGUINOLOLU_12 62 // Sanguinololu 1.2 and above

So you need to set motherboard = BOARD_SANGUINOLOLU_12

or on older firmware motherboard = 62
Dam
Re: Sanguinololu Rev 1.3a - how to load firmware
August 08, 2016 12:19AM
Thanks so much for the response.

I replaced that with BOARD_SAN.. and that problem seems to be solved.

But unfortunately the next issue is I am getting:

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

Any ideas what could cause that? I am stumped and googling as much as possible to find a solution. None yet unfortunately.

A while ago you said I could try replace the 40 pin chip from the old board with the new one. Would this mean that I wouldn't have to to go through the firmware upload? I'd be keen to do this but then again I just want to make sure I wouldn't do any damage by doing so (especially seeing there was something wrong with the old board and it didn't work). Maybe I should just stick it out with this firmware upload.

Much thanks

D
Re: Sanguinololu Rev 1.3a - how to load firmware
August 08, 2016 03:16AM
That error is basically saying, I can't talk to your boot loader

could be several things

1) you don’t have a boot loader on your chip... (sadly some suppliers do this...)
2) your boot loader is expecting different settings (baud rate, protocol etc, so they just cant communicate
3) your auto reboot jumper is off, so it can't reboot the controller and launch the boot loader (check this first)

1) you need a AVR ISP, this is hardware, with this device you can write a new boot loader... this is not simple and many people give up in frustration, should be considered last resort

2) you will find on your machine a boards.txt file
It contains lines like (depends on the cpu you have, but i'm guessing 1284p)
sanguino.menu.cpu.atmega1284p.upload.speed=115200
sanguino.menu.cpu.atmega1284p.upload.protocol=stk500v2

this is the baud rate and protocol for uploading via the boot loader
try the speeds 38400 and 57600
try the protocol stk500, arduino and stk500v2

Its a few combinations, you need to try each, and cross your fingers
I would try 38400 and stk500 first off, its quite common

NB every time you edit boards.txt you need to restart the arduino IDE, or it just doesn’t notice the changed file

3) check your jumper is installed, its between the large black chip and the pololu socket.

Edited 3 time(s). Last edit at 08/08/2016 03:25AM by Dust.
Dam
Re: Sanguinololu Rev 1.3a - how to load firmware
August 08, 2016 03:54AM
Thank you very much. I will give it a go.

Could I not just replace the big 40 pin chip from the old board onto the new one? Or could this damage the new board?

I should learn how to do this at some point but if I don't need to delve into code and possibly (probably) have to try install a boot loader but if I don't need to now. That would be good.

Thanks,

D
Re: Sanguinololu Rev 1.3a - how to load firmware
August 08, 2016 02:51PM
You can try that. It shouldn't be able to damage the board

Just be careful not to bend any pins and work on a anti static environment (wear a anti static strap if you have one)

And make sure to put the chip back in the correct way
Dam
Re: Sanguinololu Rev 1.3a - how to load firmware
August 09, 2016 01:38PM
It worked. I swapped chips and then I was able to connect to the board via pronterface.

I connected the PSU which came from the original kickstarter campaign. It's a generic 19v laptop charger. I was able to move one motor (the only one I tried) but then I noticed the board got quite warm so I disconnected. Sorry maybe I should be posting this in a different thread. Any thoughts? Maybe I need to get a PSU that has a lower voltage or just a different PSU?

Thank you for all your help!
Re: Sanguinololu Rev 1.3a - how to load firmware
August 25, 2016 04:42AM
Hi Dam,

I have been running an eMAKER Huxley clone with Sanguinololu 1.3a compatible controller at DC12V for years long. Your Sanguinololu board will become naturally warm or partially hot when running at DC19V. You don't need to replace your PSU if it works correctly.

Just take a look at your Sanguinololu top surface, and you see three small semiconductor blocks of three pins at both sides - two power MOS-FETs for heaters and one voltage regulator to get DC5V for logic circuits. These parts will become warm, sometime very hot. If you can find small heatsinks to bolt on then it is recommended.

Next, you have four Pololu stepper motor driver modules on board. Those might be correctly tuned already but you'd better recalibrate at this time to get ease. Please read 'Final Check / Pololu drivers current limit configuration' part of Sanguinololu wiki page. Pololu drivers will get hot when running so attaching small heatsinks are also recommended.

Finally, be aware of poor connectors on board - power and heaters. You should connect all four pins for a heated bed, use 2 pins each for + and -.


Genie - designer of bitfab::Hexagon Heatedbed in purple. PM me if you wish to get original one of the best quality.
Re: Sanguinololu Rev 1.3a - how to load firmware
May 20, 2017 03:03PM
Hello, I am trying to install Marlin 1.1.1 onto my Sanguinololu 1.3 1284p board.

Having a ton of trouble, I have installed the correct JSON for the board into Arduino 1.8.2 that I have, but I get the error that I have to select the Sanguino board when I verify the sketch. Of course it is selected.

Eventually I abandon 1.8.x IDE and after messing around with versions I found that Arduino 1.6.13 would verify the Marlin 1.1.1 sketch and supports 250k baud and the Sanguinololu JSON file works there......

But now I get stk500 sync errors...

Can anyone help? Verify says ok, its only the upload I am stuck on now.

Background info:
using Arduino as ISP
com port ftdi works I can query the board for current settings
currently loaded with Marlin 1.0.0
Tried it with and without the RST pins jumped.

Thanx in advance
Re: Sanguinololu Rev 1.3a - how to load firmware
May 20, 2017 09:15PM
bypass the bootloader and use your isp to upload

Use CTRL+SHIFT+U vs upload button.
Re: Sanguinololu Rev 1.3a - how to load firmware
May 20, 2017 09:20PM
Thnx for advise. I am in learning phase here some smiling smiley
What do you mean by "your isp" and how do i bypass the bootloader?

Edited 1 time(s). Last edit at 05/20/2017 09:21PM by JustSumGuy.
Re: Sanguinololu Rev 1.3a - how to load firmware
May 20, 2017 09:49PM
arduino 101:

there are two ways to upload new firmware onto the chip

1) over a usb/serial cable. This reboots the board and runs a bootloader program that allows you to upload over serial
This is the normal way to upload used when you click the upload button. Requires that your boot loader matches the setting in the boards.txt file. If it doesn’t you often get stk500 sync errors.
2) using a AVRISP. This directly puts the data on the chip. It doesn’t reset the board or use the bootloader. This is also the only way to upload a bootloader and set chip fuses (settings)
To use this use the hotkey CTRL+SHIFT+U or use the menu Sketch|Upload using a programmer, not the upload button.


You say you have a "using Arduino as ISP" make sure that is plugged in and wired up to the ISP port
Then use option 2 above.

Edited 2 time(s). Last edit at 05/20/2017 09:51PM by Dust.
Re: Sanguinololu Rev 1.3a - how to load firmware
May 20, 2017 10:56PM
ok first I want to say thank you for taking the time to help me work on this, it is truly appreciated.

However I am not getting any luck sad smiley

when I said I was using Arduino as ISP I am referring to the setting in the IDE the board is simply plugged into my Windows 10 X64 PC via USB.


I changed that setting to AVRISP and AVRISP mkII and tried each one with CTRL+SHIFT+U

no luck sad smiley

It feels like the Arduino IDE is communicating at the wrong baud rate but I cant see where to change that in the system.
Re: Sanguinololu Rev 1.3a - how to load firmware
May 20, 2017 11:44PM
an avrisp is additional hardware, commonly another ardunio running isp firmware


since you don't have this your limited to option 1


Yes baudrate is a possibility

you need to find the boards.txt file it contains a section

###### ATmega1284x

## Sanguino W/ ATmega1284 or ATmega1284P 16MHz
sanguino.menu.cpu.atmega1284p=ATmega1284 or ATmega1284P (16 MHz)

sanguino.menu.cpu.atmega1284p.upload.maximum_size=130048
sanguino.menu.cpu.atmega1284p.upload.maximum_data_size=16384
sanguino.menu.cpu.atmega1284p.upload.speed=115200

sanguino.menu.cpu.atmega1284p.bootloader.file=optiboot/optiboot_atmega1284p.hex

sanguino.menu.cpu.atmega1284p.build.mcu=atmega1284p
sanguino.menu.cpu.atmega1284p.build.f_cpu=16000000L

you can try changing
sanguino.menu.cpu.atmega1284p.upload.speed=115200
to other speeds, I've see bootloaders use 38400 and 57600
NB you need to restart the ardunio IDE program after you change this file. It only reads it on start up.

Sadly there is no way to know what baud rate it expects, no one seems to document their boot loader.
Also some cheap suppliers dont bother installing a bootloader, so there is no way to make it work with avrisp hardware

NB this baud rate is not related to the baud rate you set in marlin configuration.h that is for marlin only.

Edited 1 time(s). Last edit at 05/20/2017 11:48PM by Dust.
Re: Sanguinololu Rev 1.3a - how to load firmware
May 21, 2017 12:02AM
That section is not in the boards.txt file

Can I just cut/paste it in?
Re: Sanguinololu Rev 1.3a - how to load firmware
May 21, 2017 12:17AM
ok, getting way too late here. One thing tho. I have an AVRISP!!!

I forgot all about it, all I ever used it for was flashing F/W into speed controllers for a quadcopter project...

[www.fasttech.com]

can I maybe do something with that?
Re: Sanguinololu Rev 1.3a - how to load firmware
May 21, 2017 12:26AM
there will be multiple boards.txt files

If its in the boards menu it in a boards.txt file somewhere...

yes you can use that device.
It has a 10 pin connector, you need a 6 pin so wire it like


Re: Sanguinololu Rev 1.3a - how to load firmware
May 21, 2017 08:51AM
OI !!! just days and days of headaches here.

Ok, I had the 10pin to 6 pin cable that came with it still in my drawer so all good there. Plugged in the power supply to the Sanguinololu board and the ISP header into the USBISP set the Arduino IDE to use USBISP and selected upload by programer (CTRL+SHIFT+U)- no luck, here is the error.


Arduino: 1.6.13 (Windows 10), Board: "Sanguino, ATmega1284 or ATmega1284P (16 MHz)"

Sketch uses 51,132 bytes (39%) of program storage space. Maximum is 130,048 bytes.
Global variables use 2,694 bytes (16%) of dynamic memory, leaving 13,690 bytes for local variables. Maximum is 16,384 bytes.
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: program enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

the selected serial port
does not exist or your board is not connected

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Re: Sanguinololu Rev 1.3a - how to load firmware
May 21, 2017 09:04PM
how have you wired it? pictures?

as it saying that it can't talk talk to the 1284p

Cable upside down? or non standard 6 pin connector... on your board I would guess
Re: Sanguinololu Rev 1.3a - how to load firmware
May 21, 2017 09:58PM
turned out the cable was wired weird, I made a new one but still issues with that unit. So I got out some old kit and got buzy with an Arduino Nano and made an ISP out of it.
Still had to mess with that for hours and just before the hammer started hitting the Sangunololu I got it to flash.

Ok, I got a lot of learning in smiling smiley Thank you. I still cant flash anything direct via the built in USB port tho.

Question, now that I can flash tho in a clumbsey way, should I flash a new bootloader? Would that maybe fix the flash directly over USB problem?

Caliberation and all the fiddly stuff that goes with a fresh flash is going to take me down a road of many many flashes and haveing to do it via the Nano soulution is going to be a path I can see hateing.

Especially since the ISP header on the Sanguinololu is where the LCD plugs in....

Still I am finally seeing a flicker at the end of this tunnel.

Btw the reason I had to flash in the first place was chageing out the threaded rod on my GeeeTech ME Creator 1 for a proper 8mm feed screw. Different pitch and direction made it necasary so I had to start over.

Thanx again smiling smiley
Re: Sanguinololu Rev 1.3a - how to load firmware
May 22, 2017 12:50AM
hate to tell you thing all you needed was new steps/mm so M92 Z### in the start.gcode or save in eeprom... and direction just needs you to turn the stepper plug around 180 degrees or swap two wires in the plug

if you enable eeprom then you can update most things via gcode and then save with m500 you only need to get your thermisters and endstops working in firmware,
even if eeprom is disabled you can just add gcode to your slicer start file to set almost everything.


With the avrisp you now have full control over the chip. This is good and bad. (the bad being fuses)
Installing a new boot loader should fix your uploading over serial issue. NB Installing bootloader in ardunio ide will also change the fuses (setting) of the chip. You probably want to back these up first (google avrdude command line) Its just 3 or 4 bytes that set configuration data.

in that boards.txt file is
sanguino.bootloader.tool=arduino:avrdude
sanguino.bootloader.low_fuses=0xFF
sanguino.bootloader.high_fuses=0xDE
sanguino.bootloader.extended_fuses=0xFD
sanguino.bootloader.unlock_bits=0x3F
sanguino.bootloader.lock_bits=0x0F

but this is for a generic board not specific to your controller.
In particular you need to ensure that jtag is off, as these pins a redefined and reused as endstops..

NB if you get the fuses totaly wrong, you can stuff accessing the chip, by setting wrong clock divisor etc, so it gets the baud rates wrong.

what would do is, display the current fuses with avrdude
plug the values into [www.engbedded.com] (select atmega1284p)
see what is set, perhaps post it here...
now find out what the above boards.txt sets
make sure JTAG Interface Enabled is off. and the oscillator setting as the same (boot size will change)

Edited 1 time(s). Last edit at 05/22/2017 12:51AM by Dust.
Re: Sanguinololu Rev 1.3a - how to load firmware
May 22, 2017 07:35AM
Ok, after some fuddling this is what I got for an output:
Does this look right?
--------------------------------------------------------------------------------

avrdude -P com5 -b 19200 -c arduino -p m1284p -v

avrdude: Version 6.3, compiled on Feb 17 2016 at 09:25:53
Copyright (c) 2000-2005 Brian Dean, [www.bdmicro.com]
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "C:\Users\dale\Desktop\wtf\avrdude.conf"

Using Port : com5
Using Programmer : arduino
Overriding Baud Rate : 19200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x15
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x15
AVR Part : ATmega1284P
Chip Erase delay : 55000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 10 128 0 no 4096 8 0 9000 9000 0xff 0xff
flash 65 10 256 0 yes 131072 256 512 4500 4500 0xff 0xff
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00

Programmer Type : Arduino
Description : Arduino

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x14

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x02

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x10
Hardware Version: 4669920
Firmware Version: 0.4520867
Topcard : STK502
Vtarget : 1.8 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us

avrdude: stk500_initialize(): (b) protocol error, expect=0x10, resp=0x01
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x10

avrdude done. Thank you.
Re: Sanguinololu Rev 1.3a - how to load firmware
May 24, 2017 03:59PM
Just wanted to say thanx Dust, I have things going well enough to work with it all at this point. I found some indications online that an aruidno board can in some situations work without a bootloader. I am starting to think that either the bootloader on it is missing the USB components OR is just not there at all...

So I am going to do as you suggested in one of your posts and use the M92 commands and save to EEPROM for now to do all the calibration and then take all those settings and put them in configuration.h to do a final flash over the ISP header to finalize it all.

Then having chocked all this up to a great bit of learning I am going to get a Ramps4 board in a few weeks and put the Sanguinololu in the drawer.......


smiling smiley Thank you very much for your help smiling smiley
Sorry, only registered users may post in this forum.

Click here to login