diff --git a/Core/Src/main.c b/Core/Src/main.c index 21f8504..f8d7b02 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -109,14 +109,20 @@ int main(void) /* USER CODE BEGIN 2 */ MX_USART2_UART_Init(); /* USER CODE END 2 */ - example11_init(); - example11_process(); + printf("\n\n####### start 1\n\r"); + printf("\n\n####### start 2\n\r"); + printf("\n\n####### start 3\n\r"); + printf("\n\n####### start 4\n\r"); + + //example11_init(); + //example11_process(); /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ - example11(); + //example11(); + //example11_process(); MX_LoRaWAN_Process(); //MX_TOF_Process(); // MX_TOF_Ranging_Process(); diff --git a/Core/Src/sys_app.c b/Core/Src/sys_app.c index 88f209f..182c229 100644 --- a/Core/Src/sys_app.c +++ b/Core/Src/sys_app.c @@ -123,7 +123,7 @@ void SystemApp_Init(void) /*Initialize the Sensors */ EnvSensors_Init(); #if defined(L8) - //MX_TOF_Init(); + MX_TOF_Init(); #endif #if defined(STS_P2) STS_TOF_VL53LX_PeopleCounting_Process_Init(); diff --git a/Core/Src/usart_if.c b/Core/Src/usart_if.c index 8ac0e4a..7a9a992 100644 --- a/Core/Src/usart_if.c +++ b/Core/Src/usart_if.c @@ -128,7 +128,7 @@ UTIL_ADV_TRACE_Status_t vcom_DeInit(void) /* ##-3- Disable the NVIC for DMA ########################################### */ /* USER CODE BEGIN 1 */ HAL_NVIC_DisableIRQ(DMA1_Channel6_IRQn); - + HAL_NVIC_DisableIRQ(DMA1_Channel7_IRQn); return UTIL_ADV_TRACE_OK; /* USER CODE END 1 */ /* USER CODE BEGIN vcom_DeInit_2 */ diff --git a/STS/TOF/App/app_tof.c b/STS/TOF/App/app_tof.c index 47a149f..99d554a 100644 --- a/STS/TOF/App/app_tof.c +++ b/STS/TOF/App/app_tof.c @@ -114,9 +114,9 @@ void MX_TOF_Init(void) //MX_53L1A2_SimpleRanging_Init(); //STS_TOF_VL53LX_PeopleCounting_Process(); #ifdef L8 - //MX_53L8A1_ThresholdDetection_Init(); - //MX_53L8A1_ThresholdDetection_Process(); - example11_init(); + MX_53L8A1_ThresholdDetection_Init(); + MX_53L8A1_ThresholdDetection_Process(); + //example11_init(); #endif /* USER CODE BEGIN TOF_Init_PostTreatment */ @@ -185,8 +185,8 @@ void MX_TOF_Process(void) //sts_tof_vl53lx_peoplecount_subprocess(); #ifdef L8 //MX_53L8A1_ThresholdDetection_Process(); - //STS_TOF_L8_Process(); - example11_process(); + STS_TOF_L8_Process(); + //example11_process(); #endif /* USER CODE BEGIN TOF_Process_PostTreatment */ @@ -215,15 +215,21 @@ void STS_TOF_L8_Process(void) void STS_Reset_Sensor(void) { /* Sensor reset */ + printf("\r\nSTS_reset_sensor start 1\r\n"); HAL_GPIO_WritePin(VL53L8A1_PWR_EN_C_PORT, VL53L8A1_PWR_EN_C_PIN, GPIO_PIN_RESET); - HAL_Delay(2); + printf("\r\nSTS_reset_sensor start 1.1\r\n"); + //HAL_Delay(50); + printf("\r\nSTS_reset_sensor start 1.2\r\n"); HAL_GPIO_WritePin(VL53L8A1_PWR_EN_C_PORT, VL53L8A1_PWR_EN_C_PIN, GPIO_PIN_SET); - HAL_Delay(2); - + //HAL_Delay(50); + printf("\r\nSTS_reset_sensor start 2\r\n"); HAL_GPIO_WritePin(VL53L8A1_LPn_C_PORT, VL53L8A1_LPn_C_PIN, GPIO_PIN_RESET); - HAL_Delay(2); + printf("\r\nSTS_reset_sensor start 2.1\r\n"); + //HAL_Delay(50); + printf("\r\nSTS_reset_sensor start 2.2\r\n"); HAL_GPIO_WritePin(VL53L8A1_LPn_C_PORT, VL53L8A1_LPn_C_PIN, GPIO_PIN_SET); - HAL_Delay(2); + //HAL_Delay(50); + printf("\r\nSTS_reset_sensor finished \r\n"); } /* VL53L8A1 */ @@ -324,7 +330,7 @@ static void MX_53L8A1_ThresholdDetection_Process(void) printf("-------------------------------------------\n\r"); printf("please put a target between %d and %d millimeters from the sensor\n\r", LOW_THRESHOLD, HIGH_THRESHOLD); -#if 1 +#if 0 //while (1) { /* interrupt mode */ @@ -905,7 +911,7 @@ int example11_init(void) * example, only the I2C address is used. */ Dev.platform.address = VL53L8CX_DEFAULT_I2C_ADDRESS; - + printf("\r\n example11_init: dev =%02x\r\n", Dev.platform.address); /* (Optional) Reset sensor toggling PINs (see platform, not in API) */ //STS_Reset_Sensor(&(Dev.platform)); STS_Reset_Sensor(); @@ -920,19 +926,23 @@ int example11_init(void) /*********************************/ #if 0 /* (Optional) Check if there is a VL53LMZ sensor connected */ - status = vl53lmz_is_alive(&Dev, &isAlive); + printf("\r\n check Alive status \r\n"); + status = vl53l8cx_is_alive(&Dev, &isAlive); + if(!isAlive || status) { printf("VL53LMZ not detected at requested address\n"); - return status; + //return status; } #endif /* (Mandatory) Init VL53LMZ sensor */ + printf("\r\nstart Init \r\n"); status = vl53l8cx_init(&Dev); + printf("\r\nInit status =%d \r\n", status); if(status) { printf("VL53LMZ ULD Loading failed\n"); - return status; + //return status; } else { printf("VL53L8CX ULD good\n"); } @@ -944,6 +954,7 @@ int example11_init(void) /*********************************/ /* Program motion indicator */ /*********************************/ + printf("VL53LMZ program motion indicator\n"); /* Create motion indicator with resolution 8x8 */ status = vl53l8cx_motion_indicator_init(&Dev, &motion_config, VL53L8CX_RESOLUTION_8X8);