diff --git a/Core/Inc/main.h b/Core/Inc/main.h
index 212be1b..66ec458 100644
--- a/Core/Inc/main.h
+++ b/Core/Inc/main.h
@@ -177,14 +177,24 @@ void Error_Handler(void);
#define A111_ENABLE_Pin GPIO_PIN_5
#define A111_ENABLE_GPIO_Port GPIOB
#endif
-#ifdef YUNHORN_STS_WLE5CCxx
+
+#if defined(YUNHORN_STS_WLE5CCxx) && defined(RM2)
+#define A111_SENSOR_INTERRUPT_Pin GPIO_PIN_5
+#define A111_SENSOR_INTERRUPT_GPIO_Port GPIOB
+#define A111_SENSOR_INTERRUPT_EXTI_IRQn EXTI9_5_IRQn
+#define A111_ENABLE_Pin GPIO_PIN_3
+#define A111_ENABLE_GPIO_Port GPIOB
+#endif
+
+#if defined(YUNHORN_STS_WLE5CCxx) && defined(RM2_1)
#define A111_SENSOR_INTERRUPT_Pin GPIO_PIN_3 // SWITCH TO PB-3, 2024-05-06
#define A111_SENSOR_INTERRUPT_GPIO_Port GPIOB
#define A111_SENSOR_INTERRUPT_EXTI_IRQn EXTI3_IRQn // SWITCH TO PB-3, 2024-05-06
-#define A111_ENABLE_Pin GPIO_PIN_5 // SWITCH TO PB-5, 2024-05-06
-#define A111_ENABLE_GPIO_Port GPIOB
+#define A111_ENABLE_Pin GPIO_PIN_5 // SWITCH TO PB-5, 2024-05-06
+#define A111_ENABLE_GPIO_Port GPIOB
#endif
+
#define A111_SPI_HANDLE hspi1
#ifndef A111_USE_SPI_DMA
#define A111_USE_SPI_DMA
diff --git a/Core/Inc/sys_conf.h b/Core/Inc/sys_conf.h
index bcb45b4..0271316 100644
--- a/Core/Inc/sys_conf.h
+++ b/Core/Inc/sys_conf.h
@@ -47,7 +47,7 @@ extern "C" {
/**
* @brief Verbose level for all trace logs
*/
-#define VERBOSE_LEVEL VLEVEL_L
+#define VERBOSE_LEVEL VLEVEL_H
/**
* @brief Enable trace logs
diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c
index c24b8dc..92da7ad 100644
--- a/Core/Src/gpio.c
+++ b/Core/Src/gpio.c
@@ -61,6 +61,12 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+ GPIO_InitStruct.Pin = MEMS_POWER_Pin;
+ GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
+ HAL_GPIO_Init(MEMS_POWER_GPIO_Port, &GPIO_InitStruct);
+
/*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = A111_ENABLE_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
@@ -78,6 +84,7 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Pin = A111_SENSOR_INTERRUPT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(A111_SENSOR_INTERRUPT_GPIO_Port, &GPIO_InitStruct);
#ifdef STS_O7
@@ -112,6 +119,10 @@ void MX_GPIO_Init(void)
HAL_NVIC_SetPriority(HALL2_EXTI_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(HALL2_EXTI_IRQn);
+
+ HAL_NVIC_SetPriority(A111_SENSOR_INTERRUPT_EXTI_IRQn, 0, 0);
+ HAL_NVIC_EnableIRQ(A111_SENSOR_INTERRUPT_EXTI_IRQn);
+
#else
/* EXTI interrupt init*/
HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);
@@ -123,6 +134,9 @@ void MX_GPIO_Init(void)
HAL_NVIC_SetPriority(EXTI9_5_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
+ HAL_NVIC_SetPriority(EXTI3_IRQn, 0, 0);
+ HAL_NVIC_EnableIRQ(EXTI3_IRQn);
+
}
/* USER CODE BEGIN 2 */
diff --git a/Core/Src/stm32wlxx_it.c b/Core/Src/stm32wlxx_it.c
index 9b75e47..4164172 100644
--- a/Core/Src/stm32wlxx_it.c
+++ b/Core/Src/stm32wlxx_it.c
@@ -361,7 +361,7 @@ void EXTI9_5_IRQHandler(void)
/* USER CODE END EXTI9_5_IRQn 0 */
//HAL_GPIO_EXTI_IRQHandler(BUT3_Pin);
/* USER CODE BEGIN EXTI9_5_IRQn 1 */
- //HAL_GPIO_EXTI_IRQHandler(A111_SENSOR_INTERRUPT_Pin);
+ HAL_GPIO_EXTI_IRQHandler(A111_SENSOR_INTERRUPT_Pin);
/* USER CODE END EXTI9_5_IRQn 1 */
}
diff --git a/Core/Src/yunhorn_sts_presence_rss_bring_up_test.c b/Core/Src/yunhorn_sts_presence_rss_bring_up_test.c
index 173282c..659a6de 100644
--- a/Core/Src/yunhorn_sts_presence_rss_bring_up_test.c
+++ b/Core/Src/yunhorn_sts_presence_rss_bring_up_test.c
@@ -91,6 +91,8 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
acc_rss_assembly_test_configuration_communication_write_read_test_disable(configuration);
// Enable and run: Interrupt Test
+ APP_LOG(TS_OFF, VLEVEL_H,"-- Interrupt Test --- Start ********************\r\n");
+
acc_rss_assembly_test_configuration_communication_interrupt_test_enable(configuration);
if (!run_test(configuration))
{
@@ -102,10 +104,12 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
test_result[t++] = 1;
}
+ APP_LOG(TS_OFF, VLEVEL_H,"-- Interrupt Test --- End ********************\r\n");
acc_rss_assembly_test_configuration_communication_interrupt_test_disable(configuration);
// Enable and run: Hibernate Test
+ APP_LOG(TS_OFF, VLEVEL_H,"-- Hibernate Test --- Start ********************\r\n");
acc_rss_assembly_test_configuration_communication_hibernate_test_enable(configuration);
if (!run_test(configuration))
{
@@ -118,9 +122,12 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
test_result[t++] = 1;
}
+ APP_LOG(TS_OFF, VLEVEL_H,"-- Hibernate Test --- End ********************\r\n");
+
acc_rss_assembly_test_configuration_communication_hibernate_test_disable(configuration);
// Enable and run: Supply Test
+ APP_LOG(TS_OFF, VLEVEL_H,"-- Supply Test --- Start ********************\r\n");
acc_rss_assembly_test_configuration_supply_test_enable(configuration);
if (!run_test(configuration))
{
@@ -133,9 +140,12 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
test_result[t++] = 1;
}
+ APP_LOG(TS_OFF, VLEVEL_H,"-- Supply Test --- End ********************\r\n");
+
acc_rss_assembly_test_configuration_supply_test_disable(configuration);
// Enable and run: Clock Test
+ APP_LOG(TS_OFF, VLEVEL_H,"-- Clock Test --- Start ********************\r\n");
acc_rss_assembly_test_configuration_clock_test_enable(configuration);
if (!run_test(configuration))
{
@@ -147,10 +157,12 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
test_result[t++] = 1;
}
-
+ //APP_LOG(TS_OFF, VLEVEL_H,"-- test step: [%d] --result=%d \n", t-1, test_result[t-1]);
acc_rss_assembly_test_configuration_clock_test_disable(configuration);
+ APP_LOG(TS_OFF, VLEVEL_H,"-- Clock Test --- end ********************\r\n");
// Enable and run: Power cycle test
+ APP_LOG(TS_OFF, VLEVEL_H,"-- Power cycle test --- Start ********************\r\n");
acc_rss_assembly_test_configuration_power_cycle_test_enable(configuration);
if (!run_test(configuration))
{
@@ -165,6 +177,7 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
acc_rss_assembly_test_configuration_power_cycle_test_disable(configuration);
+ APP_LOG(TS_OFF, VLEVEL_H,"-- Power cycle test --- end ********************\r\n");
APP_LOG(TS_OFF, VLEVEL_H,"-- 10 -- Bring up test: All tests passed\n");
test_result[t++] = 1; //(10)
diff --git a/Core/Src/yunhorn_sts_presence_sensor.c b/Core/Src/yunhorn_sts_presence_sensor.c
index 27f1376..b367b8b 100644
--- a/Core/Src/yunhorn_sts_presence_sensor.c
+++ b/Core/Src/yunhorn_sts_presence_sensor.c
@@ -542,12 +542,9 @@ void STS_SENSOR_Power_ON(uint8_t cnt)
case 0:
case 1:
case 2:
-#ifdef YUNHORN_STS_M7_ENABLED
- HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_SET);
-#endif
-#ifdef YUNHORN_STS_O7_ENABLED
- PME_ON;
-#endif
+
+ PME_ON;
+
break;
default:
break;
@@ -560,12 +557,9 @@ void STS_SENSOR_Power_OFF(uint8_t cnt)
case 0:
case 1:
case 2:
-#ifdef YUNHORN_STS_M7_ENABLED
- HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_RESET);
-#endif
-#ifdef YUNHORN_STS_O7_ENABLED
- PME_OFF;
-#endif
+
+ PME_OFF;
+
break;
default:
break;
@@ -578,12 +572,9 @@ void STS_SENSOR_MEMS_Reset(uint8_t cnt)
case 0:
case 1:
case 2:
-#ifdef YUNHORN_STS_M7_ENABLED
- HAL_GPIO_WritePin(MEMS_RESET_GPIO_Port, MEMS_RESET_Pin, GPIO_PIN_SET);
-#endif
-#ifdef YUNHORN_STS_O7_ENABLED
+
HAL_GPIO_TogglePin(MEMS_RESET_GPIO_Port, MEMS_RESET_Pin);
-#endif
+
break;
default:
break;
diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c
index 8143dcb..833ec05 100644
--- a/LoRaWAN/App/lora_app.c
+++ b/LoRaWAN/App/lora_app.c
@@ -2271,7 +2271,7 @@ void OnRestoreSTSCFGContextProcess(void)
if ((sts_version == sts_cfg_nvm.version)&& (NVM_CFG_PARAMETER_SIZE == sts_cfg_nvm.length))
{
STS_PRESENCE_SENSOR_Init();
- STS_PRESENCE_SENSOR_RSS_Init();
+ //STS_PRESENCE_SENSOR_RSS_Init();
}
#endif
diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject
index 22be140..0ceadee 100644
--- a/STM32CubeIDE/.cproject
+++ b/STM32CubeIDE/.cproject
@@ -153,6 +153,7 @@