I2C breaks when initializing ESP32_LED_STRIP RMT
Posted: Wed Sep 20, 2017 12:21 am
So this one is a bit hard to describe here goes my best attempt:
a) code uses i2c to read and get raw values from an mpu6050 (accelerometer-gyro)
b) It also uses a led strip (WS2812 type) using https://github.com/Lucas-Bruder/ESP32_LED_STRIP this one was the only library for C i could find for addresable leds
c) i have a task that calculates pitch and roll with a complimentary filter, and another one that prints the values.
so this is what is happening: I initilice i2c and the comunication and start getting some values, proper values. I have timed this loop up to 7 solid minutes with no problemat all but as soon as i initialize the led strip it starts returning garbage.
IMPORTANT: the most vexing part, is that i have the same code running on protoboard on a dev board and it works, but i changed into a pcb and the weird behavoir started.
now i did my best to replicate the devboard on the new pcb, i added pull up resistors to the i2c rails (5k). At this point i already checked and both esp32 are revision 0.
my main code looks like so:
in the code above you can see that after a couple of seconds after addresable leds has been initialized i start losing reliabilty on the data obtained, as i said it seems that if dont set addresable init() i get solid data for minutes
im lost here, maybe is an interrupt that conflicts with the i2c?
a) code uses i2c to read and get raw values from an mpu6050 (accelerometer-gyro)
b) It also uses a led strip (WS2812 type) using https://github.com/Lucas-Bruder/ESP32_LED_STRIP this one was the only library for C i could find for addresable leds
c) i have a task that calculates pitch and roll with a complimentary filter, and another one that prints the values.
so this is what is happening: I initilice i2c and the comunication and start getting some values, proper values. I have timed this loop up to 7 solid minutes with no problemat all but as soon as i initialize the led strip it starts returning garbage.
IMPORTANT: the most vexing part, is that i have the same code running on protoboard on a dev board and it works, but i changed into a pcb and the weird behavoir started.
now i did my best to replicate the devboard on the new pcb, i added pull up resistors to the i2c rails (5k). At this point i already checked and both esp32 are revision 0.
my main code looks like so:
Code: Select all
void app_main()
{
ESP_LOGI("Main tag","starting accelerometer");
print_mux = xSemaphoreCreateMutex();
i2c_master_init();
vTaskDelay(200/portTICK_PERIOD_MS);
xTaskCreate(mpu6050_complimentary_filter, "i2c_mpu6050_complimentary_filter", 1024 * 3, NULL, 90, NULL); //calculate angles
xTaskCreate(angle_print, "angle_print", 1024 * 2, NULL, 4, NULL); //print angles every 500ms else if on main loop we overflow make monitor console
vTaskDelay(30000/portTICK_PERIOD_MS); // wait to see if accelerometer is working properly
init_Addresable_leds();
ESP_LOGI("Main tag","addresable initilalized");
vTaskDelay(500/portTICK_PERIOD_MS);
}
Code: Select all
Angles by complimentary filter... ROLL: 1.868587 PITCH: 4.100168 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.856133 PITCH: 4.101508 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.867535 PITCH: 4.084947 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.877190 PITCH: 4.089179 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.879230 PITCH: 4.099995 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.873662 PITCH: 4.120989 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.844929 PITCH: 4.094360 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.840526 PITCH: 4.108929 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.861139 PITCH: 4.103582 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.837508 PITCH: 4.109424 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.859383 PITCH: 4.109167 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.859133 PITCH: 4.111785 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.858522 PITCH: 4.117200 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.860672 PITCH: 4.129315 Yaw: 0.000000
Angles by complimentary filter... ROLL: 2.821155 PITCH: 5.061262 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.961496 PITCH: 4.222400 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.858341 PITCH: 4.120047 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.882372 PITCH: 4.110199 Yaw: 0.000000
(33213) intr_alloc: Connected src 47 to int 17 (cpu 0)
I (33213) Main tag: addresable initilalized
Angles by complimentary filter... ROLL: 1.856133 PITCH: 4.101508 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.867535 PITCH: 4.084947 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.877190 PITCH: 4.089179 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.879230 PITCH: 4.099995 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.873662 PITCH: 4.120989 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.844929 PITCH: 4.094360 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.840526 PITCH: 4.108929 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.861139 PITCH: 4.103582 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.837508 PITCH: 4.109424 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.859383 PITCH: 4.109167 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.859133 PITCH: 4.111785 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.858522 PITCH: 4.117200 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.860672 PITCH: 4.129315 Yaw: 0.000000
Angles by complimentary filter... ROLL: 2.821155 PITCH: 5.061262 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.961496 PITCH: 4.222400 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.858341 PITCH: 4.120047 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.882372 PITCH: 4.110199 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.876676 PITCH: 4.118143 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.571568 PITCH: 4.339398 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.830631 PITCH: 4.152345 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.830631 PITCH: 4.152345 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.831013 PITCH: 2.172300 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.831013 PITCH: 2.172300 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.831013 PITCH: 2.172300 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.831013 PITCH: 2.172300 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.831391 PITCH: -1.767590 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.831391 PITCH: -1.767590 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.831391 PITCH: -1.767590 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.831391 PITCH: -1.767590 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.831766 PITCH: -5.668081 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.831766 PITCH: -5.668081 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.831766 PITCH: -5.668081 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.831766 PITCH: -5.668081 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.832137 PITCH: -9.529564 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.832137 PITCH: -9.529564 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.832137 PITCH: -9.529564 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.832137 PITCH: -9.529564 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.832504 PITCH: -13.352435 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.832504 PITCH: -13.352435 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.832504 PITCH: -13.352435 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.832504 PITCH: -13.352435 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.832867 PITCH: -17.137077 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.832867 PITCH: -17.137077 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.832867 PITCH: -17.137077 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.832867 PITCH: -17.137077 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.833227 PITCH: -20.883869 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.833227 PITCH: -20.883869 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.833227 PITCH: -20.883869 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.833227 PITCH: -20.883869 Yaw: 0.000000
Angles by complimentary filter... ROLL: 1.833584 PITCH: -24.593201 Yaw: 0.000000
im lost here, maybe is an interrupt that conflicts with the i2c?