Netduino home hardware projects downloads community

Jump to content

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


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

Posts I've Made

In Topic: SPI.configuration and L6470 Stepper Driver

19 October 2012 - 10:39 AM

Thanks Mario, I think I get your point.

I just need to get something clarified

Handshaking the SPI using the managed code is *really* painful: maybe slower than a turtle.

do you refer to the togling of the SS pin (opSS.Write(false) and opSS.Write(true)) in the SendBytes method?
static void SendBytes(byte[] bWrite, byte[] bRead)
    spi.WriteRead(bWrite, bRead);
Actually that's and old implementation, my current SendByte method looks like this:
static void SendByte(byte bWrite)
    var bRead = new byte[1];
    spi.WriteRead(new byte[] {bWrite}, bRead);
But that should almost be the same since the spi.WriteRead(...) automatically toggles the SS pin.

The L6470 needs the SS pin to toggle (...After each byte transmission the CS input must be raised ....)

So the problem is the spi.WriteRead(...) is slow when it toggles the SS pin it's not slow writing bytes?

And what you say, is that this can be done much faster by implementing the hardware fix (just like nakchak suggests earlier in this thread)?

I haven't had any performance issues with my approach and setup so far, and it hasn't been a show stopper. But I can see that it's not "fast" when I send many bytes like in the Setup motor method.

So I will definitely look into your very thoroughly described hardware fix, thanks a lot for you input, it's very much appreciated :)


In Topic: SPI.configuration and L6470 Stepper Driver

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,

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

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_STEP_MODE);

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

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_MIN_SPEED);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_KVAL_HOLD);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_KVAL_ACC);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_KVAL_DEC);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_KVAL_RUN);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_ST_SLP);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_INT_SPD);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_FN_SLP_ACC);

	SendByte(Constants.dSPIN_SET_PARAM | Constants.dSPIN_FN_SLP_DEC);

	//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.

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.


In Topic: ShieldBase Mini?

01 October 2012 - 03:30 PM

Can you share more about the type of size and feature set you'd like to see. How small? 3V3/5V switching? Open drain capabilities? GPIO-only, or including other features like PWM and ADC as on the shield base?

My initial thought was simply a ShieldBase that was small and compact, I know that it wouldn't be a ShieldBase then.

I could use an I/O expander module with as many GPIO's as possible (I could use +100 or 2x50 etc.) simple 3V3/5V switching. I'd prefer that over an "all-in-one" solution like the ShieldBase. What would matter to me was physical size and no. of GPIOS, so if additional features like PWM and ADC wouldn't take up significant space and cost, those features would be relevant as well.

I haven't really checked if any Gadgeteer modules might do the job, but after the Gadgeteer Adapter module revelation :rolleyes: , I'll check them out.


In Topic: ShieldBase Mini?

28 September 2012 - 07:14 AM

Are you thinking of a small IO expander module?


In Topic: Inductive sensor input problem

23 July 2012 - 02:07 PM

Hi Mario I didn't see your great explanation until now, but thank you for making it clear :) 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.