-
Notifications
You must be signed in to change notification settings - Fork 62
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
problems connecting to the BNO080 from Artemis RedBoard #68
Comments
PS: I tried to apply the "ESP32" fix present in the sketch, it did not work. |
Hi JR, |
Hi @PaulZC , Many thanks for your help :) (and sorry for skipping politeness formula etc on most of my post, having busy days :) ). I think this looks quite similar to what I experience indeed. I wonder if this is actually different from #69 , but I can well be wrong. So if I understand correctly, the fix you implemented on the OpenLog_Artemis was to do a "hard" reset. Was it by re-starting the whole chip, or only the I2C bus? Would it be possible to restart only the I2C bus, I have some data in RAM I do not want to loose... Could you show how you did the fix last time? How do you want to proceed further here? Do you think you could push a Thanks in advance! Cheers, JR |
Hi JR, |
The reset function is here: |
Ok, so that means that the way you perform the reset is by resetting the whole board, right? That sounds tough. I can do it, but then I will need to do some dumping to EEPROM first ^^ . |
Or "EEPROM" as this is flash if I understand well :) . |
Thanks for the link :) . |
@PaulZC many thanks for your help, that was very helpful :) With something like this (sorry, using the Adafruit code at the moment, due to the issue #70 ), I always end up being able to log in the end ^^ #include "Arduino.h"
#include "WDT.h"
#include <Adafruit_BNO08x.h>
Adafruit_BNO08x bno08x{};
sh2_SensorValue_t sensorValue;
unsigned long micros_last;
unsigned long micros_crrt;
void setReports(void) {
if (!bno08x.enableReport(SH2_ROTATION_VECTOR), 5000UL) {
Serial.println("Could not enable rotation vector");
}
}
APM3_WDT wdt;
void resetArtemis(void)
{
Wire.end(); //Power down I2C
SPI.end(); //Power down SPI
power_adc_disable(); //Power down ADC. It it started by default before setup().
Serial.end(); //Power down UART
//Force the peripherals off
am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_IOM0);
am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_IOM1);
am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_IOM2);
am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_IOM3);
am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_IOM4);
am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_IOM5);
am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_ADC);
am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_UART0);
am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_UART1);
while (1) // That's all folks! Artemis will watchdog reset in 1.25 seconds
;
}
void setup(void) {
wdt.start();
Serial.begin(115200);
while (!Serial){
delay(10);
}
Serial.println();
Serial.println("------ booted ------");
Serial.println();
// initialize
for (int i=0; i<20;i++){
wdt.restart();
if (bno08x.begin_I2C(0x4B, &Wire, 0)){
break;
}
else{
Serial.print("Failed to find BNO08x chip "); Serial.println(i+1);
if (i == 19){
Serial.println(F("reset Artemis"));
resetArtemis();
}
delay(500);
}
}
Wire.setClock(400000);
delay(50);
setReports();
micros_last = micros();
Serial.println("----- Reading events -----");
delay(100);
}
void loop() {
wdt.restart();
Serial.println(F("start reading"));
while(true){
wdt.restart();
if (bno08x.wasReset()) {
Serial.print("sensor was reset ");
setReports();
continue;
}
if (!bno08x.getSensorEvent(&sensorValue)) {
continue;
}
else{
switch (sensorValue.sensorId) {
case SH2_ROTATION_VECTOR:
micros_crrt = micros();
Serial.print(F("micros: ")); Serial.print(micros_crrt); Serial.println(F(" | micros elapsed: ")); Serial.println(micros_crrt-micros_last);
micros_last = micros_crrt;
Serial.print("Rotation Vector - r: ");
Serial.print(sensorValue.un.rotationVector.real);
Serial.print(" i: ");
Serial.print(sensorValue.un.rotationVector.i);
Serial.print(" j: ");
Serial.print(sensorValue.un.rotationVector.j);
Serial.print(" k: ");
Serial.println(sensorValue.un.rotationVector.k);
break;
}
}
}
} It fails (and reboots) in the two different ways that were described both here and in #69 (not sure if it is the same issue showing up in 2 different ways, or 2 different issues):
But a good watchdog fixes it (I just loose all the data in RAM of course, so I will need to dump useful data to "EEPROM in flash"; any hidden dragons I should know about there? ^^ ) . |
closing in favor of #72 . |
Setup
I am using:
Fail to run example
I have attempted many times to run the
Example1-RotationVector.ino
:I have never managed to get it to work, I get the error message:
'Fix' for the example
However, if I just ignore the check, things work "quite often". I.e., if I run:
I get a valid output.
Question / possible bug
I suppose this means that there is a potential problem / bug using the library with the Artemis RedBoard? Any idea how to fix this?
The text was updated successfully, but these errors were encountered: