Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

Kristoffer

Member Since 27 Mar 2012
Offline Last Active Jun 05 2013 10:44 AM
-----

#37376 SPI.configuration and L6470 Stepper Driver

Posted by Kristoffer on 18 October 2012 - 09:57 AM

Hi Kristoffer,
Can you please give us some update about how the usage of this driver L6470 is going?
I am planning to use it in a new project with Netduino Classic and would like to know how was your experience.
Did you develop some kind of driver or library for it?
Thank you,
Igor.


Hi Igor

Certainly I will.

I'm using it and it works fine, it has been a little up-hill, mostly because of my lack of knowledge in electronics, but I managed to get it to work.

This guy, Kurtnelle, has developed a .NET L6470 driver which should be fine, and here's a link to a discussion about it.

If you use the the sparkfun L6470 Breakout board, I'd recommend you read the comments at the Sparkfun L6470 product page, and pay attention to 4 specific advices:

  • An user suggest downloading ST dSpin evaluation software (evaluation software is found at the bottom of tab page “Design support”), it will help you figure out how to set some essential and motor specific parameters.
  • Another user links to a ST presentation of the L6470, watch it, I didn't notice it until today and it makes a lot of things clear to me that I didn't understand earlier.
  • Read the important section in the Arduino example - dSPIN_example.ino, it suggest inserting a SOFTSTOP between motion commands, I found that usefull and saved me some time.
  • There's a known problem about VReg at the Sparkfun L6470 Breakout board

Based on the Arduino example sketch at the Sparkfun L6470 product page and the parameters from the dSpin evaluation software my motorspecific setup looks like this:

private void Setup_MAE_210_24V()
{
	//opReset = L6470 Reset Pin
	opReset.Write(true);
	Thread.Sleep(1);
	opReset.Write(false);
	Thread.Sleep(1);
	opReset.Write(true);
	Thread.Sleep(1);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_STEP_MODE);
	SendByte(Constants.dSPIN_STEP_SEL_1);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_MAX_SPEED);
	SendBytes(MaxSpdCalc(600), 2);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_MIN_SPEED);
	SendByte(0x10);
	SendByte(0x00);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_KVAL_HOLD);
	SendByte(0xC);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_KVAL_ACC);
	SendByte(0x21);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_KVAL_DEC);
	SendByte(0x21);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_KVAL_RUN);
	SendByte(0x21);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_ST_SLP);
	SendByte(0x18);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_INT_SPD);
	SendByte(0x1A);
	SendByte(0xFF);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_FN_SLP_ACC);
	SendByte(0x2D);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_FN_SLP_DEC);
	SendByte(0x2D);

	//These three commands prevented a small but consistent steploss when I called MOVE the first time after initialization
	//I haven't found an explenation nor have I dug into why, actually I don't think you need all three commands, maybe a SOFTSTOP would do.
	SendByte(Constants.dSPIN_RESET_POS);
	SendByte(Constants.dSPIN_GO_HOME);
	SendByte(Constants.dSPIN_HARD_STOP);
}

Notice a significant difference from the Sparkfun Arduino example, I do not set the config register, the default values worked for my setup, so I haven't really dug into the Config parameters (maybe the steploss issue metioned in code is found here :mellow: ).

My success criteria was a precise movement including:
  • no step loss
  • control of acc and dec
  • control of speed
  • control of holding torque

And that's what the L6470 fullfilled. I can see there's a bunch of other possibilities with the chip like attaching a switch, use more complex movement commands based on the position knowledge in the chip and so on.

Let me know if you run into problems or if you have further questions, I might be able to help you.

Regards
Kristoffer


home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.