I have some issues programming a nucleo-STM32F401RE.
-
When connected to a AMT103-v encoder, the board seems unresponsive. If i disconnect the wires, it works as intended. Checked the wires, everything is ok. What is the main cause of this unresponsiveness?
This is how i setup it up
QEI encoder(PG_11, PC_14, PF_2, 2084, QEI::X4_ENCODING);
This is how i read
printf(“PULSURI: %d \t\t\t REVOLUTIE: %d \t\t\t INDEX: %d\r\n”, encoder.getPulses(), encoder.getRevolutions(), encoder.getIndex()); -
I have a setup where a Raspberry PI is connected via wires to the STM32. The raspberry is transmitting the PWM motor values via a PWM signal and the STM32 picks up the values and powers the motor.
Sometimes, the STM32 is pickup half the values (eg. i send value 20 and the STM reads 10), or sometimes the STM32 generates full power (suddently). I guess the main problem is generated by misreads (noisy rise and falls). Any suggestion on what can i do?
Code:
PwmIn RPIengine(PD_12);
engine.period(0.0002f);
while (true)
{
speed = RPIengine.dutycycle();
engine.write(speed);
}