Skip to content

Commit

Permalink
Accelerometer: Fix initial garbage on CLK
Browse files Browse the repository at this point in the history
CS was triggered before the SPI was
enabled on the MCU,
resulting in the CLK pin floating for a while.

The accelerometer was ignoring the first command,
which resulted in the "not detected" error.

BFW-6057
  • Loading branch information
CZDanol-prusa authored and CZDanol committed Sep 23, 2024
1 parent 7e50194 commit a810919
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/hw/SparkFunLIS2DH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ LIS2DHCore::LIS2DHCore(const buddy::hw::OutputPin &chip_sel_pin)
}

status_t LIS2DHCore::beginCore(void) {
// Enable SPI now -> make sure the clock is not floating before we do ChipSelect
// BFW-6057
__HAL_SPI_ENABLE(&SPI_HANDLE_FOR(accelerometer));

// Check the ID register to determine if we have an accelerometer
uint8_t readCheck;
readRegister(&readCheck, LIS2DH_WHO_AM_I);
Expand Down

0 comments on commit a810919

Please sign in to comment.