Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]Block in InlineCurrentSense init #281

Open
mailonghua opened this issue Jun 19, 2023 · 3 comments
Open

[BUG]Block in InlineCurrentSense init #281

mailonghua opened this issue Jun 19, 2023 · 3 comments

Comments

@mailonghua
Copy link

mailonghua commented Jun 19, 2023

Describe the bug
After instantiating the InlineCurrentSense object, and calling init() based on the object, it is found that the program will stay in the init function and not return

Describe the hardware setup
For us it is very important to know what is the hardware setup you're using in order to be able to help more directly

  • Which motor:
  • Which driverDRV8313
  • Which microcontroller:ESP32S3FN8
  • Which position sensor:AS5600
  • Current sensing used?:INA240A2

IDE you are using

  • Arduino IDE
  • Platformio

Tried the Getting started guide? - if applicable
yes,use example inline_current_sense_test.ino
block in current_sense.init();

@runger1101001
Copy link
Member

Dear @mailonghua , thank you for reporting it.

Could I ask you to share the initialisation code?
Are you linking the driver to the current sense before the init? currentsense.linkDriver(&driver);

@mailonghua
Copy link
Author

mailonghua commented Jun 19, 2023

thank you for your reply
No, I used the example inline_current_sense_test.ino directly, and only modified A0 and A2 to become my current pins
`
#include <SimpleFOC.h>
InlineCurrentSense current_sense = InlineCurrentSense(0.01f, 50.0f, 8, 9);

void setup() {
current_sense.init();
current_sense.gain_b *= -1;

Serial.begin(115200);
Serial.println("Current sense ready.");
}
void loop() {
PhaseCurrent_s currents = current_sense.getPhaseCurrents();
float current_magnitude = current_sense.getDCCurrent();

Serial.print(currents.a*1000); // milli Amps
Serial.print("\t");
Serial.print(currents.b*1000); // milli Amps
Serial.print("\t");
Serial.print(currents.c*1000); // milli Amps
Serial.print("\t");
Serial.println(current_magnitude*1000); // milli Amps

}
`

@runger1101001
Copy link
Member

Ok, I understand. I have looked at the code, but I don't see the problem. I or one of my colleagues will have to test it out.

If you find out what the problem is, please let us know :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants