Pārlūkot izejas kodu

Workaround for BNO080 errors on Teensy 4.0

main
PaulStoffregen pirms 5 gadiem
vecāks
revīzija
c93e869a96
1 mainītis faili ar 9 papildinājumiem un 0 dzēšanām
  1. +9
    -0
      WireIMXRT.cpp

+ 9
- 0
WireIMXRT.cpp Parādīt failu

// TODO: is this correct if the prior use didn't send stop? // TODO: is this correct if the prior use didn't send stop?
port->MSR = LPI2C_MSR_PLTF | LPI2C_MSR_ALF | LPI2C_MSR_NDF | LPI2C_MSR_SDF | LPI2C_MSR_FEF; // clear flags port->MSR = LPI2C_MSR_PLTF | LPI2C_MSR_ALF | LPI2C_MSR_NDF | LPI2C_MSR_SDF | LPI2C_MSR_FEF; // clear flags


// these delays are an ugly kludge for BNO080
// https://forum.pjrc.com/threads/58268
// TODO: need more robust error recovery!!
if (status & (LPI2C_MSR_ALF | LPI2C_MSR_NDF)) {
delayMicroseconds(300); // min=120
} else if (status & (LPI2C_MSR_PLTF | LPI2C_MSR_FEF)) {
delayMicroseconds(60); // min=30
}

//printf("MSR=%lX, MCR:%lx, MFSR=%lX\n", status, port->MCR, port->MFSR); //printf("MSR=%lX, MCR:%lx, MFSR=%lX\n", status, port->MCR, port->MFSR);


// Wonder if MFSR we should maybe clear it? // Wonder if MFSR we should maybe clear it?

Notiek ielāde…
Atcelt
Saglabāt