diff --git a/Core/Src/acc_hal_integration_a111.c b/Core/Src/acc_hal_integration_a111.c index 0bcdf24..c13c274 100644 --- a/Core/Src/acc_hal_integration_a111.c +++ b/Core/Src/acc_hal_integration_a111.c @@ -122,7 +122,8 @@ static void acc_hal_integration_sensor_transfer(acc_sensor_id_t sensor_id, uint8 static void acc_hal_integration_sensor_power_on(acc_sensor_id_t sensor_id) { (void)sensor_id; // Ignore parameter sensor_id - + PME_ON; + HAL_Delay(5); HAL_GPIO_WritePin(A111_ENABLE_GPIO_Port, A111_ENABLE_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(A111_CS_N_GPIO_Port, A111_CS_N_Pin, GPIO_PIN_SET); diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c index 6047302..d4ead0b 100644 --- a/Core/Src/gpio.c +++ b/Core/Src/gpio.c @@ -83,7 +83,7 @@ void MX_GPIO_Init(void) /*Configure GPIO pin : PtPin */ GPIO_InitStruct.Pin = A111_SENSOR_INTERRUPT_Pin; GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; - GPIO_InitStruct.Pull = GPIO_PULLDOWN; + GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(A111_SENSOR_INTERRUPT_GPIO_Port, &GPIO_InitStruct); @@ -123,6 +123,9 @@ void MX_GPIO_Init(void) HAL_NVIC_SetPriority(A111_SENSOR_INTERRUPT_EXTI_IRQn, 0, 0); HAL_NVIC_EnableIRQ(A111_SENSOR_INTERRUPT_EXTI_IRQn); + HAL_NVIC_SetPriority(EXTI3_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(EXTI3_IRQn); + #else /* EXTI interrupt init*/ HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0); diff --git a/Core/Src/main.c b/Core/Src/main.c index 0608242..a2bf45b 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -102,12 +102,7 @@ int main(void) MX_LoRaWAN_Init(); - do - { - STS_SENSOR_Function_Test_Process(); - } while(0); - - STS_Lamp_Bar_Self_Test_Simple(); + //STS_Lamp_Bar_Self_Test_Simple(); /* USER CODE BEGIN 2 */ diff --git a/Core/Src/stm32wlxx_it.c b/Core/Src/stm32wlxx_it.c index dc32780..46f3b01 100644 --- a/Core/Src/stm32wlxx_it.c +++ b/Core/Src/stm32wlxx_it.c @@ -356,6 +356,7 @@ void DMA1_Channel7_IRQHandler(void) /** * @brief This function handles EXTI Lines [9:5] Interrupt. */ +#if 1 void EXTI9_5_IRQHandler(void) { /* USER CODE BEGIN EXTI9_5_IRQn 0 */ @@ -368,7 +369,7 @@ void EXTI9_5_IRQHandler(void) #endif /* USER CODE END EXTI9_5_IRQn 1 */ } - +#endif /** * @brief This function handles SPI1 Interrupt. */ 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 659a6de..75fa886 100644 --- a/Core/Src/yunhorn_sts_presence_rss_bring_up_test.c +++ b/Core/Src/yunhorn_sts_presence_rss_bring_up_test.c @@ -43,7 +43,7 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result); int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) { uint8_t t=0; - uint8_t test_result[12]={0x0}; + uint8_t test_result[20]={0x0}; APP_LOG(TS_OFF, VLEVEL_H,"-- 0 -- Acconeer software version %s\n", acc_version_get()); @@ -62,8 +62,6 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) // Enable and run: Read Test acc_rss_assembly_test_configuration_communication_read_test_enable(configuration); - - if (!run_test(configuration)) { test_result[t++] = 0; //(3) @@ -104,9 +102,45 @@ 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); + APP_LOG(TS_OFF, VLEVEL_H,"-- Interrupt Test --- End ********************\r\n"); + + // 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)) + { + test_result[t++] = 0; // (8) + acc_rss_assembly_test_configuration_destroy(&configuration); + acc_rss_deactivate(); + //return EXIT_FAILURE; + } else { + + 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)) + { + test_result[t++] = 0; //(9) + acc_rss_assembly_test_configuration_destroy(&configuration); + acc_rss_deactivate(); + //return EXIT_FAILURE; + } else { + + test_result[t++] = 1; + } + + acc_rss_assembly_test_configuration_power_cycle_test_disable(configuration); + APP_LOG(TS_OFF, VLEVEL_H,"-- Power cycle test --- end ********************\r\n"); + // Enable and run: Hibernate Test APP_LOG(TS_OFF, VLEVEL_H,"-- Hibernate Test --- Start ********************\r\n"); @@ -122,9 +156,8 @@ 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); + APP_LOG(TS_OFF, VLEVEL_H,"-- Hibernate Test --- End ********************\r\n"); // Enable and run: Supply Test APP_LOG(TS_OFF, VLEVEL_H,"-- Supply Test --- Start ********************\r\n"); @@ -140,9 +173,8 @@ 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); + APP_LOG(TS_OFF, VLEVEL_H,"-- Supply Test --- End ********************\r\n"); // Enable and run: Clock Test APP_LOG(TS_OFF, VLEVEL_H,"-- Clock Test --- Start ********************\r\n"); @@ -157,7 +189,7 @@ 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"); @@ -175,14 +207,14 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result) test_result[t++] = 1; } - 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) - memcpy(rss_self_test_result, test_result, t); + memcpy(rss_self_test_result, test_result, 12); APP_LOG(TS_OFF, VLEVEL_H,"--Bring up test result #=%d \r\n", t); acc_rss_assembly_test_configuration_destroy(&configuration); acc_rss_deactivate(); diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 833ec05..e11131a 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -2301,6 +2301,7 @@ void STS_SENSOR_Function_Test_Process(void) tstbuf[i++] = (uint8_t) sts_hardware_ver; tstbuf[i++] = (uint8_t) (99*((GetBatteryLevel()/254)&0xff)); + APP_LOG(TS_OFF, VLEVEL_H, "\r\nStart Function Test \r\n"); STS_SENSOR_MEMS_Get_ID(mems_Dev_ID); if ((mems_Dev_ID[0]==0X0) && (mems_Dev_ID[1]==0x0)) { @@ -2309,7 +2310,7 @@ void STS_SENSOR_Function_Test_Process(void) else { tstbuf[i++] = (uint8_t)14; //length of following data - #ifdef YUNHORN_STS_O7_ENABLED +#ifdef YUNHORN_STS_O7_ENABLED uint8_t self_test_result[10]={0,0,0,0,0, 0,0,0,0,0}; STS_PRESENCE_SENSOR_Function_Test_Process(self_test_result, count); @@ -2323,7 +2324,7 @@ void STS_SENSOR_Function_Test_Process(void) tstbuf[i++] = (uint8_t) ((((uint16_t)sts_distance_rss_distance)/100)%10+0x30)&0xff; tstbuf[i++] = (uint8_t) ((((uint16_t)sts_distance_rss_distance)/10)%10+0x30)&0xff; tstbuf[i++] = (uint8_t) (((uint16_t)sts_distance_rss_distance)%10+0x30)&0xff; - #endif +#endif } memset((void*)outbuf,sizeof(outbuf),0x30); diff --git a/STM32CubeIDE/Release/STS_O7.bin b/STM32CubeIDE/Release/STS_O7.bin index 91b9dcc..b2bd8ed 100644 Binary files a/STM32CubeIDE/Release/STS_O7.bin and b/STM32CubeIDE/Release/STS_O7.bin differ