Просмотр исходного кода

mirroch skoro-fix (still testing)

Juraj Ďuďák 1 месяц назад
Родитель
Сommit
a48116c8cb
4 измененных файлов с 15 добавлено и 15 удалено
  1. 0 2
      .cproject
  2. 11 9
      Core/Src/main.c
  3. 1 1
      baModule-slave Debug.launch
  4. 3 3
      baModule-slave.ioc

+ 0 - 2
.cproject

@@ -49,7 +49,6 @@
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Modules/dataframe/src}&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Modules/one-wire-memory/Inc}&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Modules/nbus/include}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Modules/icm20948/src}&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Modules/DMP-ICM20948/inc}&quot;"/>
 								</option>
 								<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.139895820" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
@@ -66,7 +65,6 @@
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Modules/dataframe/src}&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Modules/one-wire-memory/Inc}&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Modules/nbus/include}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Modules/icm20948/src}&quot;"/>
 									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Modules/DMP-ICM20948/inc}&quot;"/>
 								</option>
 								<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.definedsymbols.1846472396" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">

+ 11 - 9
Core/Src/main.c

@@ -114,7 +114,8 @@ inline void uart_receive(uint8_t *dataNBUS, int n)
 	dataL = 0;
 	dataI = 0;
 	data[0] = 0;
-	uart_timeout = HAL_GetTick();
+//	uart_timeout = HAL_GetTick();
+	uart_timeout = MAX_SYSTICK;
 	HAL_UARTEx_ReceiveToIdle_DMA(&huart1, data, n);
 }
 
@@ -135,12 +136,12 @@ inline void app_delay(uint8_t ms){
 }
 
 static inline uint8_t loop_callback(nBusStateCallbackType_t state_check) {
-// traba kontrolovat kazdu stav (state_check) zvmlast. Moznost doplnit dalsie kontroly
+// traba kontrolovat kazdu stav (state_check) zvlast. Moznost doplnit dalsie kontroly
 	if (state_check == CallbackType_SENSOR) {
 #if MODULE == MODULE_IMU || MODULE == MODULE_DMP
 		if(icm_data_ready == 1){
 			icm_data_ready = 0;
-			return 1;  // interrupt from external sensor: data ready
+			return 0;  // TEMPORARY DISABLED STATE. interrupt from external sensor: data ready
 		}
 #endif
 
@@ -148,13 +149,12 @@ static inline uint8_t loop_callback(nBusStateCallbackType_t state_check) {
 	}
 
 	if (state_check == CallbackType_UART) {
-		// timemout: 1 - 2 ms
-		if(HAL_GetTick() - 1 > uart_timeout) {
+		// timeout: 1 - 2 ms
+		if(HAL_GetTick() - 1 > uart_timeout || uart_timeout == MAX_SYSTICK) {
 			dataL = 0;
 			dataI = 0;
 			data[0] = 0;
 			uart_timeout = MAX_SYSTICK;
-//			led_off();
 			HAL_UARTEx_ReceiveToIdle_DMA(&huart1, data, BUFF_SIZE);
 			return 1;  // UART receive timeout
 		}
@@ -198,7 +198,9 @@ void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart){
 
 void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
 #if MODULE == MODULE_IMU || MODULE == MODULE_DMP
-	icm_data_ready = 1;
+	if (GPIO_Pin == SPI_INT_Pin) {
+		icm_data_ready = 1;
+	}
 #endif
 }
 
@@ -275,7 +277,6 @@ int main(void)
 #endif
 
 #if MODULE == MODULE_DMP
-
   nbus_init(getImuDriver(), &hw_platform);
   nbus_init_app(NULL, NULL);
 #endif
@@ -300,9 +301,10 @@ int main(void)
 	 config.mag.mode = mag_mode_power_down;
 
 	 nbus_init(getImuDriver(), &hw_platform);
-	 nbus_init_app(&hspi1, &config);
+	 nbus_init_app(NULL, NULL);
 #endif
 
+
   nBus_MemoryDriver memory_ec20 = {
   		DS28EC20_init,
   		DS28EC20_readData4B,

+ 1 - 1
baModule-slave Debug.launch

@@ -42,7 +42,7 @@
     <stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
     <stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
     <booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkenable_rtos" value="false"/>
-    <stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{&quot;fVersion&quot;:1,&quot;fItems&quot;:[{&quot;fDisplayName&quot;:&quot;Reset&quot;,&quot;fIsSuppressible&quot;:false,&quot;fResetAttribute&quot;:&quot;Software system reset&quot;,&quot;fResetStrategies&quot;:[{&quot;fDisplayName&quot;:&quot;Software system reset&quot;,&quot;fLaunchAttribute&quot;:&quot;system_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Hardware reset&quot;,&quot;fLaunchAttribute&quot;:&quot;hardware_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset hardware\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Core reset&quot;,&quot;fLaunchAttribute&quot;:&quot;core_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset core\r\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;None&quot;,&quot;fLaunchAttribute&quot;:&quot;no_reset&quot;,&quot;fGdbCommands&quot;:[],&quot;fCmdOptions&quot;:[&quot;-g&quot;]}],&quot;fGdbCommandGroup&quot;:{&quot;name&quot;:&quot;Additional commands&quot;,&quot;commands&quot;:[]},&quot;fStartApplication&quot;:true}]}"/>
+    <stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{&quot;fVersion&quot;:1,&quot;fItems&quot;:[{&quot;fDisplayName&quot;:&quot;Reset&quot;,&quot;fIsSuppressible&quot;:false,&quot;fResetAttribute&quot;:&quot;Software system reset&quot;,&quot;fResetStrategies&quot;:[{&quot;fDisplayName&quot;:&quot;Software system reset&quot;,&quot;fLaunchAttribute&quot;:&quot;system_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Hardware reset&quot;,&quot;fLaunchAttribute&quot;:&quot;hardware_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset hardware\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Core reset&quot;,&quot;fLaunchAttribute&quot;:&quot;core_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset core\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;None&quot;,&quot;fLaunchAttribute&quot;:&quot;no_reset&quot;,&quot;fGdbCommands&quot;:[],&quot;fCmdOptions&quot;:[&quot;-g&quot;]}],&quot;fGdbCommandGroup&quot;:{&quot;name&quot;:&quot;Additional commands&quot;,&quot;commands&quot;:[]},&quot;fStartApplication&quot;:true}]}"/>
     <booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.enableRtosProxy" value="false"/>
     <stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyCustomProperties" value=""/>
     <stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriver" value="threadx"/>

+ 3 - 3
baModule-slave.ioc

@@ -97,8 +97,8 @@ Mcu.PinsNb=26
 Mcu.ThirdPartyNb=0
 Mcu.UserConstants=
 Mcu.UserName=STM32L082KZTx
-MxCube.Version=6.15.0
-MxDb.Version=DB.6.0.150
+MxCube.Version=6.16.1
+MxDb.Version=DB.6.0.161
 NVIC.ADC1_COMP_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
 NVIC.DMA1_Channel1_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true
 NVIC.DMA1_Channel2_3_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true
@@ -200,6 +200,7 @@ ProjectManager.DeletePrevious=true
 ProjectManager.DeviceId=STM32L082KZTx
 ProjectManager.FirmwarePackage=STM32Cube FW_L0 V1.12.3
 ProjectManager.FreePins=false
+ProjectManager.FreePinsContext=
 ProjectManager.HalAssertFull=false
 ProjectManager.HeapSize=0x200
 ProjectManager.KeepUserCode=true
@@ -280,4 +281,3 @@ VP_SYS_VS_Systick.Signal=SYS_VS_Systick
 VP_TIM21_VS_ClockSourceINT.Mode=Internal
 VP_TIM21_VS_ClockSourceINT.Signal=TIM21_VS_ClockSourceINT
 board=custom
-isbadioc=false