Add A/D - multiple use of GPIO pin


#1

Hey,

I have a project where I would like to add an A/D converter to measure a voltage and use a stepper motor with the Slushengine X LT to adapt variable condensators accordingly.
However, I don’t find any information on what GPIO pins the Slushengine uses or how I could use the same GPIO pin for both the A/D converter and the Slushengine (I2C).

Could someone help me?
Thank you in advance


#2

Hi Kristof,

There’s a schematic project for the SlushEngine X LT on GitHub, which has the pin layout diagram.

It would be nice if Roboteurs could generate and upload a PDF document of the schematics.

Here’s the pin layout of the RPi and SlushEngine


#3

Great, thank you very much


#4

Did anyone of you use the GPIO13 and GPIO16-19 and other GPIO to control the slushengine? The default Board.py didn’t initialize the MTR0_Busy as well as MTR_Flag. I am using the HAT version and they don’t have the schematic for the board and not sure what GPIO they use. I would like to use the Busy and Flag signal to catch the error from the L6470 instead of using the getStatus(). Any suggestion?


#5

Hi Skyice,

I have used GPIO13 and GPIO16-19, the STATUS register just mirrors these.

What exactly are you trying to achieve?


#6

rraghvani,

I am trying to monitor the status of the motor the whole time. If i am using the getParam(LReg.STATUS), i will need to put this logic in the cyclic on top of the command to move the motor, and wonder if this is practical method as this will burden up the SPI com.

On the other hand, I can use RPi.GPIO event instead to monitor the alarm flag before sending getParam to read the status.

I believe both way work, just wonder which way is better.

my motor keep loosing step when I get the current set above 50, even using m.softStop() will cause it to loos step.


#7

Either way, you will still have to perform a read on either MTR_FLAG or STATUS to check if an error has occurred.

If any motor fails, the MTR_FLAG will be raised. You will then need to read each motor STATUS to see which one failed.

Or you could, just read each motor STATUS into separate variables and check each condition via AND/OR.

If the motor is losing steps, try reducing the speed. Play around with the setCurrent() and setMicroSteps() parameters until you find something that works for you.


#8

rraghvani,

I am using the HAT version now and not even sure if the Flag and busy signal is connected anymore. I cannot get anything back from the gpio 13,16 and 17. I probably will need to use the SPI for this purpose.

Do you know the current parameter range is 0-255? that what i understand from the ST documentation. I can drive the motor no more than 800 steps/seconds no matter what microsteps setup i got. Do you enable the voltage compensation in the configuration? I like to get the motor to spin as fast as it can because i am building an XY table.

Thanks!!


#9

I’m not familiar with the HAT version, but for the time being just use SPI. The parameters do range from 0 to 255, and I suggest you start with e.g. motor.setCurrent(10, 10, 10, 10).

Originally, I thought my stepper motors could reach 2000 step/s, but after spending sometime reading various materials, I’ve concluded that my stepper motors are built for torque and not speed. Here’s a really good guide to watch Coordinated stepper motor control (arduino).

Tip: when you pass parameters to methods, verify the parameters match up with what you are settings in the code. Some of the document help files are incorrect and should be double checked.


#10

rraghvani,

Just an update.

using the Spin evaluation board and software from ST, i was able to get the stepper to run smoothly up to 2000 steps/s. I will try to setup the Slush with the same parameter and see if i can run it at that speed.


#11

Hi Skyice,

Any joy with setting up the SlushEngine to run the stepper motors at 2000 steps/s? It would be interesting to know what settings you need to modify.