INA240A2 failed to initialize the current sensor with a sampling resistor of 0.001R

Hey guys, everyone give us some opinions. The high-power board we are currently working on is driven by a 2808 motor (with a pole number of 7 and an aircraft model motor with a phase resistance of around 0.3R). The MCU uses ESP32 s3, the development environment uses vscode+PIO, and the FOC library uses 2.3.1. Additionally, there is a bug in the S3 ADC that caused the initialization of the current converter to fail. I consulted another post to modify the ADC reading function, which is now normal.

  1. The current detection uses 240A2 with 50 times the gain, and the sampling resistor uses 0.01R. When the current sensor is self checked on power, everything is normal. However, with this resistor, the current detection can only be between±3.3A, which is too small,

  2. So I changed the sampling resistor and used 0.003R. The current detection range is±11A, but at this time, the self check of the powered on current sensor failed.

  3. Later, the sampling resistor was changed to 0.005R, and the current detection range was±6.6A. At this time, the self check of the power on current sensor sometimes failed, sometimes succeeded

So it’s unclear where the problem is.

Adriver.pwm_frequency = 100000; //
Adriver.voltage_power_supply = 8; //
Amotor.voltage_sensor_align = 0.5; //
Adriver.init(); //
Acurrent_sense.linkDriver(&Adriver); //
Amotor.linkDriver(&Adriver); //

// Limits
// voltage_limit
Amotor.velocity_limit = 500.0; //
Amotor.voltage_limit = 3.0; //
Amotor.current_limit = 2.0; //

MOT: Init
MOT: Enable driver.
MOT: Align sensor.
MOT: sensor_direction==CW
MOT: PP check: OK!
MOT: Zero elec. angle: 6.02
MOT: Align current sense.
MOT: Align error!
MOT: Init FOC failed.
Amotor ready.
Set the target angle using serial terminal:
Motor commands sketch | Initial motion control > torque/voltage : target 2V.

I assume what is happening is that with the lower value resistors, the amount of signal for the alignment voltage is not sufficient for reliable detection.

So you could try to increase the alignment voltage → careful!! too much and you can burn the motor/driver/cables etc…

Or, if you know that the alignment is correct (e.g. if the result of the alignment with the higher resistor is that no phases are swapped and no phases are inverted), then you could skip the alignment:

current_sense.skip_align = true;

  1. Increase the alignment voltage, I have tried it before, from 0.5 to 2, and the situation is the same. During the power on self-test, it all fails.

  2. Skip self check, this has also been tried. After jumping, the motor can start normally, but when using the current loop to control speed and torque, it is abnormal. The function of the current loop is not functional.

  3. I have also replaced the 240 chip, and the situation is still the same. The current loop is still abnormal.

Also, let me clarify the situation with my FOC board. My board is now dual channel, defined as follows,

  1. Channel A can work with sampling resistors of 0.005 and 0.01, but cannot work with 0.003

  2. Channel B can work at sampling resistance 0.01, but cannot work at 0.005 and 0.003


InlineCurrentSense Current_ Sense=InlineCurrentSense (0.005, 50.0, 01, _NC, 02)//***** Channel A

InlineCurrentSense Bcurrent_ Sense=InlineCurrentSense (0.005, 50.0, 19, _NC, 20)//***** Channel B


I have also used an ammeter to measure the current of one phase of the motor. During the power on self-test, the current is always 1.25A, so this current should not be small. So I really can’t figure it out, where the problem lies…

From the performance perspective, it seems that the abnormality is caused by the small sampling resistance of 0.005 and 0.003. But based on the above data, the current is 1.25A, which doesn’t seem too small, right…

No, you are right!

I have to think about this, and how it could happen. Its a strange error…