When I connect to my ESP32 Thing Plus’s COM port via MotionCal (I’m in the process of calibrating an Adafruit LIS3MDL magnetometer) everything but the ESP32 loses power. When I dsconnect via MotionCal, power returns to eveything. When I’m connected to the COM port via Arduino IDE everything has power.
Setup:
PC → 200mm USB cable → ESP32 Thing Plus C → 500mm Qwiic Cable → Sparkfun ZED-F9P module → 50mm Qwiic cable → Adafruit LIS3MDL magnetometer.
Any ideas on how to resolve this would be appreciated!
I would guess it’s either a setting in Motioncal that needs to be changed (disable auto-reset, or similar?), or the device is browning out (USB can provide ~500mA)
Try hooking up just the F9P and see if it still behaves the same way (or the LIS3MDL); also try using shorter cables
I’m not sure what you mean when you say “check IOA0”. I only have pins soldered on 3V3, GND, and 19/POCI, but they’re not connected to anything right now. Power is coming from USB and the LIS3MDL is connected via Qwiic cable.
Here’s my code. Let me know if you see anything problematic. It’s a trimmed down version (to remove the accelerometer and gyro stuff) of imucal_nosave from the Adafruit Sensorlab library.
/***************************************************************************
This is an example for the Adafruit SensorLab library
It will look for a supported magnetometer and output
PJRC Motion Sensor Calibration Tool-compatible serial data
PJRC & Adafruit invest time and resources providing this open source code,
please support PJRC and open-source hardware by purchasing products
from PJRC!
This "nosave" version does not save any calibration information, which
means it can be used on boards without an SD card or EEPROM. It sends
raw IMU data to the serial console to be read by the PJRC MotionCal
software (https://www.pjrc.com/store/prop_shield.html) or the Jupyter
Notebook in the SensorLab repository:
https://github.com/adafruit/Adafruit_SensorLab/blob/master/notebooks/Mag_Gyro_Calibration.ipynb.
Written by PJRC, adapted by Limor Fried for Adafruit Industries.
Modified by Shawn Hymel (January 30, 2022).
***************************************************************************/
#include <Adafruit_SensorLab.h>
#include <Adafruit_Sensor_Calibration.h>
Adafruit_SensorLab lab;
Adafruit_Sensor *mag = NULL;
sensors_event_t mag_event;
int loopcount = 0;
void setup(void) {
Serial.begin(115200);
while (!Serial) delay(10); // will pause Zero, Leonardo, etc until serial console opens
Serial.println(F("Sensor Lab - IMU Calibration!"));
lab.begin();
Serial.println("Looking for a magnetometer");
mag = lab.getMagnetometer();
if (! mag) {
Serial.println(F("Could not find a magnetometer, skipping!"));
} else {
mag->printSensorDetails();
}
}
void loop() {
if (mag && ! mag->getEvent(&mag_event)) {
return;
}
// 'Raw' values to match expectation of MOtionCal
Serial.print("Raw:");
Serial.print(int(mag_event.magnetic.x*10)); Serial.print(",");
Serial.print(int(mag_event.magnetic.y*10)); Serial.print(",");
Serial.print(int(mag_event.magnetic.z*10)); Serial.println("");
// unified data
Serial.print("Uni:");
Serial.print(mag_event.magnetic.x); Serial.print(",");
Serial.print(mag_event.magnetic.y); Serial.print(",");
Serial.print(mag_event.magnetic.z); Serial.println("");
}
IOA0 is an I/O pin on the ESP23 Thing Plus that controls power to everything on the qwiic bus. Check the schematics to see which pin on the ESP32 it’s on.
You need a multimeter or oscilloscope connected to that pin to see if it’s changing state when you run the software that’s killing power. If it is changing state something in your code or in one of the libraries you’re using is messing with that pin.
You will either need to modify that piece of code or you will need to clip the power wire off the qwiic connector and connect it to another 3.3 volt power source bypassing the 3.3 volt supply that’s on the things qwiic socket.
It might be easier to use another power source than to modify libraries if that’s the cause.
There is actually no need to line 25 at the beginning & end of the loop. That was just to demonstrate. Enable the QWIIC power only needs to be set once and it is already done in ‘line 17’ in setup.