S12ZVM BLDC Adc Problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S12ZVM BLDC Adc Problem

1,114 Views
dmeng1
Contributor II

Hi,I use AN4718SW develop BLDC.Now the motor can run well. But I have a problem about ADC sample.

Based on AN4718SW demo, I can sample DC current , DC voltage , phase voltage , but beside these analog

input, I want to sample fouth analog input. I tried a lot of  manners , but all failed . I read the demo AN5168SW

, but it is different from AN4718SW. could you tell me how to sample the fouth or the fifth analog input? based

on AN4718SW. Thanks very much.

0 Kudos
4 Replies

908 Views
pachamatej
NXP Employee
NXP Employee

Hi,

it seems ok to me, the 0x00 command at the second line says "normal conversion", thus the 0xCB (HD pin voltage) is measured first and then the 0xC8 (internal temperature sensor) is measured as a part of this sequence. This way it will work. In case you need to set precise timing of the ADC sampling for your additional channel (e.g. if it should be synchronized with the PWM signal), please follow my original post.

In any case, just make sure the ADC results array is defined for 6 results according to your example (most probably it is).

Best regards,

Matej

0 Kudos

908 Views
dmeng1
Contributor II

Dear matej:

Thanks very very much for your replay. I have success run the motor and sample the fourth ADC data use your method.

0 Kudos

908 Views
pachamatej
NXP Employee
NXP Employee

Hello,

the answer is not so simple.

The thing is, the BLDC motor control is a combination of synchronous events (driven by the PWM switching) and asynchronous commutation (driven by the hall sensors or backEMF zero-crossing events). Therefore, at certain points, the ADC acquisition may be aborted in order to re-schedule and restart the PWM-PTU-ADC chain once the asynchronous commutation event occurs.

Once the concerns about the sample timing and asynchronous conversion abort are discussed and resolved, there are several steps to do:

- The ADC triggers are programmed using the PTUTriggerEventList. There are two sub-lists, one for ADC0 - PTUTriggerEventList[0], the other one for ADC1 - PTUTriggerEventList[1]. The delays between the LOADOK and the triggers is not fixed and is moving with the PWM edges - updated within void UpdateDutycycle(void). Any subsequent trigger needs to be placed after the last trigger in the list with an additional delay (to let the ADC channel complete the conversion and be prepared for the next conversion - approx. 2.5 us). This means, that any additional trigger delay would change every time the previous trigger delays are changed. The easiest way would be to define a delay between the last BLDC-related and your custom sample trigger "myDelay" and then simply do something like:

PTUTriggerEventList[0][0][2] = PTUTriggerEventList[0][0][1] + myDelay;

- The ADC commands have to be programmed, matching the trigger. In other words - every single non-zero trigger should have corresponding non-void ADC command record and also ADC result register value.

- the program should consider that the sampling might be aborted and that the value might not be available periodically (e.g. when the commutation event overlaps with the PWM edge).

Best regards,

Matej

0 Kudos

908 Views
dmeng1
Contributor II

Dear matej:

Thanks very much for your replay. I am not very clear about your explain.but I tried another way to solve the problem.

I just modify the array ADC0CommandList. like this:

volatile char ADC0CommandList[6][4] =
{
{0x40,0xD0,0x00,0x00}, // end of sequence + int [41], current sense channel [D0], 4 clock cycles sample time [00],
{0x00,0xCB,0x00,0x00}, // end of list + no int [C0], HD voltage [CB], 4 clock cycles sample time [00]
{0xC0,0xC8,0x00,0x00},
{0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00}
};

and then I read the ADC0ResultList[2] value in ADC0done_ISR. and motor can run normal.

besides I didn't change anything.

I can read the value from ADC0ResultList[2] .but I don't know if I am right .

could you tell me if I can modify the program like this?

Best regards,

David 

0 Kudos