[EDITED BY MODERATOR MOVING THE FIGURES TO THE BOTTOM WHERE THEY SEEMED TO BELONG ACCORDING TO THE TEXT]
Hello everyone,
I’ve developed a board that allows levitating a magnet using a feedback control system. It’s powered by a 12V jack and controlled by a Teensy 4.1 microcontroller. Everything works fine with this setup.
For version 2, I decided to replace the external power supply with USB-C to simplify things. After some research, I opted for the FUSB302 and designed my circuit based on the component's datasheet. I had my board printed, and I’ve just received it.
I’m currently testing to ensure the hardware works properly. For that, I’m using the open-source project available here: https://github.com/ReclaimerLabs/FUSB302. I was able to retrieve the USB-C chip ID, check the polarity of the CC pins, and set the CC pins. This leads me to believe the hardware is functioning, but maybe I missed something?
The issue comes after that, when the code gets stuck at the .get_message function. I tried debugging with serial prints, but as my skills are limited, I started digging into the libraries and suspect the problem lies in the following function call:
int FUSB302::tcpc_xfer(const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags) {
Wire1.beginTransmission(FUSB302_I2C_SLAVE_ADDR);
for (; out_size > 0; out_size--) {
Wire1.write(*out);
out++;
}
if (in_size) {
Wire1.endTransmission(false);
Wire1.requestFrom(FUSB302_I2C_SLAVE_ADDR, in_size, (flags & I2C_XFER_STOP));
for (; in_size > 0; in_size--) {
*in = Wire1.read();
in++;
}
} else {
Wire1.endTransmission(flags & I2C_XFER_STOP);
}
}
I can’t seem to pinpoint the root of the problem. Could it be related to a hardware issue, flag configuration, or something else?
You can find the full software part on GitHub. The only change I made was switching from "Wire" to "Wire1" due to my connection choice on the Teensy.
Below is my electrical schematic.
Thanks in advance for your help and advice!


Hello everyone,
I’ve developed a board that allows levitating a magnet using a feedback control system. It’s powered by a 12V jack and controlled by a Teensy 4.1 microcontroller. Everything works fine with this setup.
For version 2, I decided to replace the external power supply with USB-C to simplify things. After some research, I opted for the FUSB302 and designed my circuit based on the component's datasheet. I had my board printed, and I’ve just received it.
I’m currently testing to ensure the hardware works properly. For that, I’m using the open-source project available here: https://github.com/ReclaimerLabs/FUSB302. I was able to retrieve the USB-C chip ID, check the polarity of the CC pins, and set the CC pins. This leads me to believe the hardware is functioning, but maybe I missed something?
The issue comes after that, when the code gets stuck at the .get_message function. I tried debugging with serial prints, but as my skills are limited, I started digging into the libraries and suspect the problem lies in the following function call:
int FUSB302::tcpc_xfer(const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags) {
Wire1.beginTransmission(FUSB302_I2C_SLAVE_ADDR);
for (; out_size > 0; out_size--) {
Wire1.write(*out);
out++;
}
if (in_size) {
Wire1.endTransmission(false);
Wire1.requestFrom(FUSB302_I2C_SLAVE_ADDR, in_size, (flags & I2C_XFER_STOP));
for (; in_size > 0; in_size--) {
*in = Wire1.read();
in++;
}
} else {
Wire1.endTransmission(flags & I2C_XFER_STOP);
}
}
I can’t seem to pinpoint the root of the problem. Could it be related to a hardware issue, flag configuration, or something else?
You can find the full software part on GitHub. The only change I made was switching from "Wire" to "Wire1" due to my connection choice on the Teensy.
Below is my electrical schematic.
Thanks in advance for your help and advice!


Last edited by a moderator:

