Problems to measure current using CSA - TLE

Announcements

Webinar: Integrated solutions for smaller, simpler low-voltage motor control design.
Join the webinar to experience!

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

cross mob
AndreaIodice
Level 1
Level 1
First reply posted First question asked Welcome!

I'm trying to control by myself a BLDC motor using sensorless scheme. To do it I need the measures about the phases' current that I can obtain using the Shunt resistence and the associated currents I1 and I2 (as Infineon explains). I would like to get the exact information about the current on Shunt resistance in A or mA. I tried using CSA. I imposed, using Config WIzard, the gain 10 and I enabled CSA. After getting the offset:

CSA->CTRL.bit.VZERO = 0;
CSA_Offset = (CSA_Offset_Get())>>2;

ADC1_Sequencer_Mode_Sel();

I tried to map, after having given to the branches of the bridge a duty cycle for HS and LS different from 50% (such that a current pass through the phases), the bit information to a voltage value, and then I computed the current in this way:

sint16 variab = (ADC1 -> RES_OUT1.bit.OUT_CH1)>>2;

float meas = (float)(variab - CSA_Offset)*5.0  /(1023 * OpGain * Rshunt) ; //with Rshunt = 0.005

My problem is that the detected current is always 0 or a very tiny value. Is it normal? How can I have the right value of the current?

0 Likes
1 Solution
RupakC
Moderator
Moderator
Moderator
100 solutions authored 250 sign-ins 25 likes received

Hello @AndreaIodice 

Below is  the block diagram for the CSA

RupakC_0-1659349027703.png

For Offset Calibration, please follow the following steps :

connect the CSA output to the ADC1 Channel 1 input by closing the switch, CSA->CTRL.VZERO=0
• set desired CSA gain, CSA->CTRL.GAIN=x
• ensure 0A current flowing through the shunt, therefore 0V differential voltage at the CSA input
• perform an ADC1 Channel 1 measurement, using the software mode, would be suitable
• the ADC1 Channel 1 digital output, RES_OUT1, holds the CSA output offset including the CSA input offset
• repeat the measurement for other CSA gain settings if needed

For ADC code calculation, you may take help from the following figure:

RupakC_1-1659349580210.png

 

I hope this helps you to work with your CSA block. 

Regards

RupakC

View solution in original post

0 Likes
4 Replies
RupakC
Moderator
Moderator
Moderator
100 solutions authored 250 sign-ins 25 likes received

Hi @AndreaIodice 

Thank you for posting on Infineon community.
Could you please let me know exactly which board you are using ? 

Also, have you gone through the offset calibration process that is explained in page 875 of 
https://www.infineon.com/dgdl/Infineon-TLE987x-UserManual-v01_60-EN.pdf?fileId=5546d4624e24005f014e5... ??

You can set the offset using different gain settings. 
After this process, you may check for nonzero motor current sensing using the CSA and if the problem persists, kindly let me know and I will be happy to help you. 
Thanks and regards

RupakC
0 Likes
I'm using TLE9879QXA40. Following the explained procedure, I set
CSA->CTRL.bit.VZERO = 0 such that the ADC1 can measure VZERO + GVin, and I
set every possible gain using CSA_Gain_Set(x). From RES_OUT1 I always read
in the bit 11-2 the value 0x19C. Now, if I make the current pass through
the phases by enabling the bridge driver and setting for the channels a
duty cycle slightly different from 50%, the current that is sent by the
supply is higher (+50 mA) but if I look at RES_OUT1 the value is always
0x19C ( or 0x19C+-1). Theoretically, from the value of ADC1 (using the
formula in page 876 of the manual) I should obtain GVin = ADC1out *
5.0/1023 - Vzero. Obviously, this formula is valid also for the offset
measure. So, GVoffset = ADC1out_withoutcurrent*5.0/1023 - Vzero. In every
moment, to get the voltage along the shunt resistence I believe I have to
do this :
Vmeas =(GVin - GVoffset)/G = (ADC1out - ADC1out_withoutcurrent)*5.0/1023/G
Obviously, at the end, to obtain the current I have to compute : I = Vmeas
/ Rshunt
Is this procedure correct? How can I verify this? In my case the detected
voltage is always 0 (or a little bit higher or lower) . Thanks
0 Likes
RupakC
Moderator
Moderator
Moderator
100 solutions authored 250 sign-ins 25 likes received

Hello @AndreaIodice 

Your explanation seems correct. So when you sense some current, what is the value to the Vin input voltage to the CSA block? Once you get some voltage here, you can check for the voltage VCSAout = Vzero +(Vin*G). 

Let me know if you are getting some voltage at the input to the CSA and then if the CSA outputs some voltage corresponding to the input ? Thereafter, we can close in on where the problem lies. 

Thanks and Regards

RupakC
0 Likes
RupakC
Moderator
Moderator
Moderator
100 solutions authored 250 sign-ins 25 likes received

Hello @AndreaIodice 

Below is  the block diagram for the CSA

RupakC_0-1659349027703.png

For Offset Calibration, please follow the following steps :

connect the CSA output to the ADC1 Channel 1 input by closing the switch, CSA->CTRL.VZERO=0
• set desired CSA gain, CSA->CTRL.GAIN=x
• ensure 0A current flowing through the shunt, therefore 0V differential voltage at the CSA input
• perform an ADC1 Channel 1 measurement, using the software mode, would be suitable
• the ADC1 Channel 1 digital output, RES_OUT1, holds the CSA output offset including the CSA input offset
• repeat the measurement for other CSA gain settings if needed

For ADC code calculation, you may take help from the following figure:

RupakC_1-1659349580210.png

 

I hope this helps you to work with your CSA block. 

Regards

RupakC
0 Likes