2018-07-31 04:17 PM
Hello all, a consulting firm has started to use the Nucleo F302R8 and the X-nucleo IHM07M1 to run our two brushless DC motors for a medical device my company makes. For my project I simply need to make the motors run back and forth for a specified amount of time at specified RPM's. However, I am brand new to C-programming and thus I am wondering: (1) where would I input code to make the motors run back and forth and at specific RPM's (not talking about the ramping options, I need the motors to run continuously back and forth); (2) what commands can I use to specify these parameters once I am in the right place (sample code would be very, very helpful).
2018-07-31 04:30 PM
You assign a pin name in the CubeMX. you make your board in Kicad, then you do the software..
I use VisualStudio but paid the $150 for GDB
"Motor" on say pin 47 (is PA2),
you can choose most any pin,
some are reserved by those hardware guys.
void Motor_ON(void){
HAL_GPIO_WritePin(Motor_GPIO_Port, Motor_Pin, GPIO_PIN_SET);
}
void Motor_OFF(void){
HAL_GPIO_WritePin(Motor_GPIO_Port, Motor_Pin, GPIO_PIN_RESET);
}
when would you call those functions ?
2018-07-31 04:40 PM
is this what you are after ?
page17
then you need PWM output
you have to configure a timer/counter to Output compare mode, set your period and set your dutyCycle. The PWM will come out only some pins, that's why we use the cube to decide the schematic for the PCB.
you can search for PWM examples
we are here to help,