Problems with Hexgon Kits Resolver_FOC_Motor_Example1

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi,
I'm working on the Hexgon Kits to drive our own motors, and I try to make the example code Resolver_FOC_Motor_Example1 for XMC4500 work.
I do get the resolver position, and the open loop works fine. But in the closed loop, the motor doesn't rotate and the current in the motor in increasing slowly. Then I found the MCU's current sample results are always near zero and MCU samples phase currents in the wrong time. Here are the sampling time point comparing with the PWM wave form.
991.attach
The upper 3 are the output PWM wave form, and the 4th is the phase currents sample time point(i_measured interrupt).
992.attach
The upper 3 are the output PWM wave form, and the 4th is the bus current sample time point(v_measured interrupt).
And this is just wrong. Because the Kit use shunt resistors to sample phase currents, so the currents should be sampled when the lower bridge arm MOSFET is turned on, e.g. when the output PWM is low. While the wave form shows that the phase currents are sampled when the PWM is high.
Then I thought if I switched interrupt, maybe I can get the result. (in the figure below is the original setting ADCCH001/0 to i_measued, ADCCH001/1 to v_measued). But I got another problem.

I changed the signal connection(ADCCH001/0 to v_measued, ADCCH001/1 to i_measued), pressed the Solve and Save button, then the connection was switched back automatically! I tried many times, and I just can't change the connection.
There are also other problems that confuse me.

In the figure, you can see that the PWMSP001 period match and compare match both trigger the same signal ADC_Trigger, then the ADC_Trigger signal triggers 4 ADC conversions. So does this mean that when the PWM period match and compare match the 4 ADC conversions are all performed? But in the wave form above you can find just one ADC conversion is triggered at the PWM period match or at the PWM compare match. I really don't know how this work and I should say the DAVE is really complex for me.
So please someone tell me what's the problem, many thanks in advance!
0 Likes
1 Reply
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
Hi,

the CCU8 triggers the same ADC at Period and One (or compare?) match. In the picture you see it is period and compare. Not one match. In the Signal flow you should be able to see the connection. There should also be an ADC003 (ADC-Queu app) as sink for the Trigger.

1013.attach

When you have a look at the Channels you can see that the checkbox for 2 channels at “trigger needed” is marked.

1014.attach

This means also for Period and compare the same ADC is triggerd but not all channels are measured.
So the flow is:
Wait for trigger. Measure Channel C and B. wait for trigger. Measure Channel A. Wait for trigger. Measure Channel C and B… and so on.

Without a deeper look I don’t know why the motor is not turning. Please let me know if you need more help.
I guess the problem is not the current measurement. It is that he has to adapt the Code to the motor. As long we don’t
0 Likes