stancecoke
1 MW
Have you looked on the phase wires with the Oszi? Would be really interesting. Or are you willing to send me the not working 12FET, then I will take a look.12FET is either faulty
Have you looked on the phase wires with the Oszi? Would be really interesting. Or are you willing to send me the not working 12FET, then I will take a look.12FET is either faulty
I looked at all three phases with an oscilloscope. Everything is as it should be: PWM 50%, 16 kHz, amplitude 40 volts.
You are definitely reading only the last message.
Hm, you can look at the variable values at the point that interests you by setting a breakpoint to the interested line of code. But a breakpoint will pause the execution, so you should not do that while the PWM is on. To debug when the motor is running, you better print out the interested variables to UART.If possible, explain how to see what comes to the controller inputs in Eclipse.
If possible, a little more detail. I understand the idea. Start the motor with self-determination without current feedback and, accordingly, without a PI controller. Simply by controlling the magnetic field using the voltage on the phases. In static mode and when slowly turning the motor without load, this works. In dynamics, the current in the windings can grow infinitely, destroying everything in its path.I would start open loop with constant ud and constant uq, to check if the rotor is turning without bouncing then.
The autodetect worked in this way in an early phase of the project, but I switched to current control some day, as no control of the current may lead into magic smoke....
In the new generation branch, you can set the commutation mode to Sensorless_openloop and try to start the motor by the throttle without the autodetect active. If this option is implemented already in the commit that you are using:But I still haven’t figured out how to practically start the engine in an open circuit.
MP.com_mode=Sensorless_openloop;
if(!MS_FOC->hall_angle_detect_flag){
MS_FOC->u_d = 200;
MS_FOC->u_q = 0;
}
Hm, strange. The start looks good. No idea, why the rotor jumps back.The engine's behavior has changed little.
printf_("%d \n",(int16_t) (((q31_rotorposition_absolute >> 23) * 180) >> 8));
HAL_Delay(5);
for (i = 0; i < 1080; i++) {
q31_rotorposition_absolute += 11930465; //drive motor in open loop with steps of 1 deg
HAL_Delay(5);
//printf_("%d, %d, %d, %d\n", temp3>>16,temp4>>16,temp5,temp6);
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
printf_("%d \n",(int16_t) (((q31_rotorposition_absolute >> 23) * 180) >> 8));
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
if (ui8_hall_state_old != ui8_hall_state) {
printf_("angle: %d, hallstate: %d, hallcase %d \n",
(int16_t) (((q31_rotorposition_absolute >> 23) * 180) >> 8),
ui8_hall_state, ui8_hall_case);
Hm, this didn't work as expected.printf_("%d \n"
HAL_Delay(5);
for (i = 0; i < 1080; i++) {
q31_rotorposition_absolute += 11930465; //drive motor in open loop with steps of 1 deg
//printf_("%d, %d, %d, %d\n", temp3>>16,temp4>>16,temp5,temp6);
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
printf_("%d \n",(int16_t) (((q31_rotorposition_absolute >> 23) * 180) >> 8));
HAL_Delay(20);
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
indeed. Let's print the dutycycle of each phase also, Maybe, you have to increase the delay a little more...It worked. The behavior is incomprehensible.
HAL_Delay(5);
for (i = 0; i < 1080; i++) {
q31_rotorposition_absolute += 11930465; //drive motor in open loop with steps of 1 deg
//printf_("%d, %d, %d, %d\n", temp3>>16,temp4>>16,temp5,temp6);
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
printf_("%d, %d, %d ,%d\n",(int16_t) (((q31_rotorposition_absolute >> 23) * 180) >> 8),TIM1->CCR1,TIM1->CCR2,TIM1->CCR3);
HAL_Delay(50);
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
for (i = 200; i < 1080; i++) { //i = 0
q31_rotorposition_absolute += 11930465; //drive motor in open loop with steps of 1 deg
HAL_Delay(5);
//printf_("%d, %d, %d, %d\n", temp3>>16,temp4>>16,temp5,temp6);
//
//printf_("%d \n",(int16_t) (((q31_rotorposition_absolute >> 23) * 180) >> 8));
printf_("%d, %d, %d ,%d\n",(int16_t) (((q31_rotorposition_absolute >> 23) * 180) >> 8),TIM1->CCR1,TIM1->CCR2,TIM1->CCR3);
HAL_Delay(50);
The log looks like something out of the textbookto what we see in the log

| signed 32 bit integer | degree |
| 2147483648 | 180 |
| 1431655765 | 120 |
| 715827883 | 60 |
| 0 | 0 |
| -715827883 | -60 |
| -1431655765 | -120 |
| -2147483648 | -180 |
I don't start anything. It just works that way. Can I influence it?I can't understand why you are starting at 200 with the loop counter, not at zero, but that doesn't matter.
I have no doubt about that.So I think we have to search the fault on the hardware side...
I don't know, if you made the 200 from the zero accidently.for (i = 200; i < 1080; i++)
for (i = 0; i < 1080; i++)
Yes, exactly.I don't know, if you made the 200 from the zero accidently.
Here it is?I have no doubt about that.
When the motor is switched off, there is nothing at any fixed angle on one of the phases.
But if the motor is connected, there is PWM.
No, it was a bad contact.
Still, there is zero on one phase.