diff Small_CPU/Src/compass.c @ 488:9eeab3fead8f

Added "I2C_DeInit();" in hardware detection routines. It's the recommended way to do and solves potential issues with older OSTC4 hardware generations. Increased RTE and RTE required numbers updated "Current build"
author heinrichsweikamp
date Sat, 27 Jun 2020 18:40:32 +0200
parents f9458e979154
children d9dbfa496f7e
line wrap: on
line diff
--- a/Small_CPU/Src/compass.c	Tue May 26 19:27:07 2020 +0000
+++ b/Small_CPU/Src/compass.c	Sat Jun 27 18:40:32 2020 +0200
@@ -281,8 +281,11 @@
 	// test if both chips of the two-chip solution (gen 1) are present
 	if(hardwareCompass == compass_generation1)			// HMC5883L)
 	{
-		HAL_Delay(10);
+		HAL_Delay(100);
+		I2C_DeInit();
+		HAL_Delay(100);
 		MX_I2C1_Init();
+		HAL_Delay(100);
 		uint8_t data = 0x2A; // CTRL_REG1 of DEVICE_ACCELARATOR_MMA8452Q
 		resultOfOperationHMC_MMA = I2C_Master_Transmit( DEVICE_ACCELARATOR_MMA8452Q, &data, 1);
 		if(resultOfOperationHMC_MMA == HAL_OK)