Today I wanted to try AccelStepper library with F407. Stepper is not moving! Do I need declare pins to PWM or what?
I am using PWM pins PE14(for steps) and PE15(for dir).
Simple code example:#include <AccelStepper.h>
AccelStepper stepper(1,PE14,PE15); // driver, step, dir
void setup()
{
stepper.setMaxSpeed(2000);
}
void loop()
{
stepper.setSpeed(1000);
stepper.runSpeed();
}
So why it is not working on F407VE?
Perhaps try SteveStrongs fork of Roger’s core which has better F4 support?
void setup()
{
pinMode(PE14, OUTPUT);
pinMode(PE15, OUTPUT);
stepper.setMaxSpeed(2000);
}
to stevestrong:
First didn’t change a thing.
Second solution – pins not declared in this scope. I tried this with stepper.enableOutputs(); :
int stepPin = PE14;
int dirPin = PE15;
AccelStepper stepper(1, stepPin, dirPin); // step, dir
Same story, pins not declared?
AccelStepper stepper(1,PE14,PE15); // driver, step, dirIt compiles ok with first and second example, but stepper won’t run.
use disableDebugPorts(); // in setup
use enableDebugPorts(); // in the code that terminates execution maybe on a button press … … …
if its HAL you may need to check which mode debug is set to ? i use CubeMX and then in the sys device i select the debug mode, generate code & report to see the values and masks etc
usual questions btw
os, version, arduino version, which core, from where & when, download method & target is f407ve ?
stephen
[zmemw16 – Wed Jan 24, 2018 3:38 pm] –
how are you downloading to target ? if st-link or jtag, pretty sure the low bits of PB and a couple in PA get messed with.use disableDebugPorts(); // in setup
use enableDebugPorts(); // in the code that terminates execution maybe on a button press … … …if its HAL you may need to check which mode debug is set to ? i use CubeMX and then in the sys device i select the debug mode, generate code & report to see the values and masks etc
usual questions btw
os, version, arduino version, which core, from where & when, download method & target is f407ve ?stephen
Downloading with ST-Link V2. On f103 it works. Other thing like relays, i2c ,serial with bluetooth works normal on f407 after ST-Link.
That debug and HAL is new to me. For now I’l skip that part.
Win10, Arduino 1.8.5, STM32Generic, Today, ST-Link v2, STM32F407VE.
Same way and code works with F103 bluebill and Arduino Mega.
void setup() {
pinMode(PE14, OUTPUT); // Direction
pinMode(PE15, OUTPUT); // Step
digitalWrite(PE14, LOW); // Direction
digitalWrite(PE15, LOW); // Step
}
void loop() {
digitalWrite(PE15, HIGH);
delay(1);
digitalWrite(PE15, LOW);
delay(1);
}

