2008-01-27 08:09 PM
AK-ST7FMC2 Position regulation; Hold Position
2011-05-17 01:14 AM
Hi there,
I`m using the AK-ST7FMC2 in sensor mode and voltage mode. The basic of my software ist the ST7MC demokit and the included frequency regulation with modifications. My frequency regulator is an position regulator overlayed. When the motor reach the target position => the motor will be stopped and the engin will turn of. This mechanism is working very well. This is the problem: If I reach the target position, this position should be hold up, when a User try to relocate the carriage. solution suggestions: - don't stop the position engine: => the frequency regulator gets ths target frequency 0 => controller makes a reset - don't stop the position engine and don't allow the frequency = 0: => the carriage is wobble. - stop the engine after reaching the target position and start it again when the position is changed. => the controller makes a reset(sometimes), because it's not possible to start when the rotor is in motion. - stop the engine, EnableDirectAccess and then force PWM on the low side switches. => not strong enough what can I do? thx [ This message was edited by: andreas.knogl on 21-01-2008 15:46 ]2011-05-17 01:14 AM
Hi Andreas,
I think that best solution to reach the required torque at zero speed is to keep the wanted step using the direct access and applyng the maximum PWM dutycycle allowable (keeping under control the maximum current allowable by the hardware) Moreover is possible to check the position and run the controller if it is required. Ofcourse there is a maximum torque that can be applied (based on the maximum current allowable by the hardware) Another point is the poor precision in the position detection due to the sensor used. I think that you are using three hall sensor so you have an uncertainty in the position inside a step of 60° of electrical degree. You have also a poor control of the stator magnetic flux generated by the hardware (only 6 spatial position to set the magnetic flux). To increase the maximum torque at zero speed to be provided can be required to switch to other solution like vecrot control (for instance STM32 MCKit) Best regards Gigi2011-05-17 01:14 AM
Hey Gigi,
I have problems, to set the duty cycle. This is, what I do: MCRA &= (u8)(~SWA_MSK); MIMR = 0; MTC_EnableDirectAccess(); MPHST = PHASE_CONFIG[StepIndex]; ToCMPxL(MCPUL,(u16)(Min_Duty)); ToCMPxH(MCPUH,(u16)(Min_Duty)); what's wrong? Of course, I know the current position. The problem is, when I try to start the motor while the rotor is in motion, a reset happens sometimes. I think the reason of this reset is an endless loop in the motor peripheri and then comes the watchdog. what can I do, to prevent this reset? thanks for help2011-05-17 01:14 AM
Andreas,
is very difficult to understand which is the problem. First of all you need to know in which interrupt service routine the code is looped. I sususpect in C ISR. You can try to disable the watch dog and run the code in debug mode and when it is stuck you can break the code and see in wich part of the code the program is blocked. But you have to be carefull. Use low values of duty cycle because when you break the execution the step is freezed and the PWM is still applied with the last walue of dutycycle applied so a certain value of current is still flowing in to the hardware and in to the motor. When we are sure about the cause of the reset we can perform a deeper analisys. rgd Gigi2011-05-17 01:14 AM
Hi Gigi,
1.) I have this problem in a lot of different cases. For example, when the motor have to start with a heavy weight and the torque is not enough. As well in the case, the motor is stopped, in motion and I like to start the motor. The software stucks in the R_Z ISR and is waiting for a changing hall. When the edge come, software runs again. For me is the problem, that when I start the motor while the rotor is in movement, I read the halls and put the duty cycle on the windings after a certain time. In this time, magnet - hall relation has changed,so the wrong windigs are on. The controller is waiting for the next Z event endlessly. 2.) What is my mistake in setting the duty in direkt access mode? thx2011-05-17 01:14 AM
Andreas
I think your are right, it is possible that the control stuck in a fixed position because the next waiting Z don't occurs. This condition can occurs if the load is to big and the duty cycle applied is not sufficient to move the rotor, or if during the start-up the motor have been moved on and the Z event (transition of the hall sensor) expected is already occurred. In the first case I don't see much to do. The load is to big for the hardware. In the second you can try to arrange the firmware to avoid the start when the motor is not still or a time out, less than the watchdog reset time, beyond the one if the control is stuck it repeat the starting sequence (reading the hall and set the related step condition). Regarding the setting of duty cycle I haven't understand what is the problem that you get. I will comment your code: MCRA &= (u8)(~SWA_MSK); This disable the autoswitch function of the peripheral. This means that the commutation between one step and the other is not more performed using the Z event information (Step time measured) but a fixed interval related to Prescaler and MCOM value set by the firmware. MIMR = 0; This disable the interrupt service routine. So event inside the peripheral occurs (Commutation, Zero crossing) but the related routine is not served. MTC_EnableDirectAccess(); This allows you to enter in Direct Access Mode. So when you write the MPHST register the output values becomes active instantaneously (and not after the Commutation event) MPHST = PHASE_CONFIG[StepIndex]; With this instruction you set the 6 output (Active or inactive) 1 means active 0 means inactive. When active, the output can assume a fixed value (for instance 1 for a low side) or a PWM value (high side). It depend on other register configuration. ToCMPxL(MCPUL,(u16)(Min_Duty)); ToCMPxH(MCPUH,(u16)(Min_Duty)); At the end, this set the value of duty cycle applied to the active output signal. For the six step normally we have for each step only one high side in which is applied the PWM. In this case you set the Min_Duty value. The duty cycle that you apply with this instruction is Min_Duty/MCP0. ToCMPxL and ToCMPxH is two macro used to set the value in the 16bit register.2011-05-17 01:14 AM
Hi,
you are right, when I prevent the start, if the motor is not still, the endless loop will not occure. But I have to prevent, that a User is possible to change the position of the motor. So, this solution will not work. My Problem in the setting of the duty cycle is: The right outputs are high, but the duty cycle is not 5% (like MinDuty), the duty cycle is about 60% if I run my code when the target position is reached. Maybe, is the best solution for me a combination of both. Fix the position in direct access mode and position regulation. Do you have some Ideas?2011-05-17 01:14 AM
Andreas,
try to shift the value of min_duty 3 bit on the right (or divide by 8) before to pass it to ToCMPx function. Maybe you need this compensation when use this two function for setting the duty. Also for me direct access and control positioning is the best solution. Regards Gigi2011-05-17 01:14 AM
Hello,
so far so good. Now I`m able to hold the position with a fix duty cycle in direct access. When I use a duty more then 30 %, the motor is going very hot. I use a 24V motor and at 30 % there are about 700 mA current. What is the limit? Second, the problem with the endless loop in the Z ISR is not solved. I there no possibility to disable the interrupt during the code in the ISR? I tried MIMR = 0; It didn`t work. regards