Browse Source

V0.1.0.2 新增LED指示

LAPTOP-KB7QFH2U\ChenJie-PC 1 year ago
parent
commit
b4c92261dc

+ 1 - 1
FreeRTOS/Source/include/FreeRTOSConfig.h

@@ -29,7 +29,7 @@
 #ifndef FREERTOS_CONFIG_H
 #define FREERTOS_CONFIG_H
 //#define SEGGER_SYSTEMVIEW //选择SYSTEM查看
-#define SEGGER_RTT_PRINTF 	//选择RTT打印
+//#define SEGGER_RTT_PRINTF 	//选择RTT打印
 #ifdef SEGGER_SYSTEMVIEW
 	#include "SEGGER_SYSVIEW_FreeRTOS.h"
 #endif

+ 12 - 17
Project_Settings/Linker_Files/linker_flash_s32k146.ld

@@ -31,18 +31,13 @@
 
 MEMORY
 {         
-    int_flash_interrupts    : ORIGIN = 0x00014200, LENGTH = 0x00000400    /* 1K */    /* Do not change this section */
-   /* int_flash_config        : ORIGIN = 0x00000400, LENGTH = 0x00000010    /* 16bytes */ /* Do not change this section */
-     int_flash               : ORIGIN = 0x00014600, LENGTH = 0x000EBA00    /* ~1.0MB */ 
-/*	int_flash_interrupts    : ORIGIN = 0x00080200, LENGTH = 0x00000400	/**/
-/*	int_flash               : ORIGIN = 0x00080600, LENGTH = 0x0007FA00	/**/
-	
-	m_flexram				: ORIGIN = 0x14000000, LENGTH = 0x00001000	
+    int_flash_interrupts    : ORIGIN = 0x00000000, LENGTH = 0x00000400    /* 1K */    /* Do not change this section */
+    int_flash_config        : ORIGIN = 0x00000400, LENGTH = 0x00000010    /* 16bytes */ /* Do not change this section */
+    int_flash               : ORIGIN = 0x00000410, LENGTH = 0x000FFBF0    /* ~1.0MB */ 
     int_sram_results        : ORIGIN = 0x1FFF0000, LENGTH = 0x00000100    /* 256bytes */
     int_sram                : ORIGIN = 0x1FFF0100, LENGTH = 0x0001DF00    /* ~120K */
-    int_sram_stack_c0       : ORIGIN = 0x2000E000, LENGTH = 0x00001000 - 0x10    /* 4K  */
-    ram_rsvd2               : ORIGIN = 0x2000EFF0, LENGTH = 0             /* End of SRAM */
-    ExchangeInfo            : ORIGIN = 0x2000EFF0, LENGTH = 0x10          
+    int_sram_stack_c0       : ORIGIN = 0x2000E000, LENGTH = 0x00001000    /* 4K  */
+    ram_rsvd2               : ORIGIN = 0x2000F000, LENGTH = 0             /* End of SRAM */
 }
 
 
@@ -56,19 +51,20 @@ SECTIONS
    {						
     	*(.eeprom)			
     } >m_flexram			
+    
 	.flash_interrupts :
 	{
-		. = ALIGN(512);
+		. = ALIGN(4096);
         __interrupts_rom_start = .;
         KEEP(*(.intc_vector))    
-        . = ALIGN(512);
+        . = ALIGN(4);
         __interrupts_rom_end = .;
 	} > int_flash_interrupts
 	
-/*	.flash_config :				*/
-/*	{							*/
-/*		KEEP(*(.flash_config))	*/
-/*	} > int_flash_config		*/
+	.flash_config :
+	{
+		KEEP(*(.flash_config))
+	} > int_flash_config
 	
 	.flash :
 	{
@@ -115,7 +111,6 @@ SECTIONS
 		__DATA_ROM = .;
 	} > int_flash
     
-    
     . = ALIGN(4);
     PROVIDE(__exidx_start = .);
     .ARM.exidx :

+ 17 - 12
Project_Settings/Linker_Files/linker_flash_s32k146.ldfls → Project_Settings/Linker_Files/linker_flash_s32k146.ldota

@@ -31,13 +31,18 @@
 
 MEMORY
 {         
-    int_flash_interrupts    : ORIGIN = 0x00000000, LENGTH = 0x00000400    /* 1K */    /* Do not change this section */
-    int_flash_config        : ORIGIN = 0x00000400, LENGTH = 0x00000010    /* 16bytes */ /* Do not change this section */
-    int_flash               : ORIGIN = 0x00000410, LENGTH = 0x000FFBF0    /* ~1.0MB */ 
+    int_flash_interrupts    : ORIGIN = 0x00014200, LENGTH = 0x00000400    /* 1K */    /* Do not change this section */
+   /* int_flash_config        : ORIGIN = 0x00000400, LENGTH = 0x00000010    /* 16bytes */ /* Do not change this section */
+     int_flash               : ORIGIN = 0x00014600, LENGTH = 0x000EBA00    /* ~1.0MB */ 
+/*	int_flash_interrupts    : ORIGIN = 0x00080200, LENGTH = 0x00000400	/**/
+/*	int_flash               : ORIGIN = 0x00080600, LENGTH = 0x0007FA00	/**/
+	
+	m_flexram				: ORIGIN = 0x14000000, LENGTH = 0x00001000	
     int_sram_results        : ORIGIN = 0x1FFF0000, LENGTH = 0x00000100    /* 256bytes */
     int_sram                : ORIGIN = 0x1FFF0100, LENGTH = 0x0001DF00    /* ~120K */
-    int_sram_stack_c0       : ORIGIN = 0x2000E000, LENGTH = 0x00001000    /* 4K  */
-    ram_rsvd2               : ORIGIN = 0x2000F000, LENGTH = 0             /* End of SRAM */
+    int_sram_stack_c0       : ORIGIN = 0x2000E000, LENGTH = 0x00001000 - 0x10    /* 4K  */
+    ram_rsvd2               : ORIGIN = 0x2000EFF0, LENGTH = 0             /* End of SRAM */
+    ExchangeInfo            : ORIGIN = 0x2000EFF0, LENGTH = 0x10          
 }
 
 
@@ -51,20 +56,19 @@ SECTIONS
    {						
     	*(.eeprom)			
     } >m_flexram			
-    
 	.flash_interrupts :
 	{
-		. = ALIGN(4096);
+		. = ALIGN(512);
         __interrupts_rom_start = .;
         KEEP(*(.intc_vector))    
-        . = ALIGN(4);
+        . = ALIGN(512);
         __interrupts_rom_end = .;
 	} > int_flash_interrupts
 	
-	.flash_config :
-	{
-		KEEP(*(.flash_config))
-	} > int_flash_config
+/*	.flash_config :				*/
+/*	{							*/
+/*		KEEP(*(.flash_config))	*/
+/*	} > int_flash_config		*/
 	
 	.flash :
 	{
@@ -111,6 +115,7 @@ SECTIONS
 		__DATA_ROM = .;
 	} > int_flash
     
+    
     . = ALIGN(4);
     PROVIDE(__exidx_start = .);
     .ARM.exidx :

+ 2 - 2
code/app/AppGlobalVar.c

@@ -20,7 +20,7 @@
 
 #define EEP_START_SEC_VAR_INIT_8_NO_CACHEABLE
 #include "Eep_MemMap.h"
-AppConfigBody AppConfigInfo = {false, true, {defaultSn}, {0}};
+AppConfigBody AppConfigInfo = {false, false, {defaultSn}, {0}};
 #define EEP_STOP_SEC_VAR_INIT_8_NO_CACHEABLE
 #include "Eep_MemMap.h"
 
@@ -35,7 +35,7 @@ uint16 WebSitePort = 8812;
 #endif
 
 //*全局变量*//
-const uint32 AppSwVersion = 0x00010001;
+const uint32 AppSwVersion = 0x00010002;
 const uint8 DataModuleType = 0x02; // 01=NB,02-4G
 const uint16 HwVersion = 0x0101;
 const uint32 BlSwVersion = 0x00000001;

+ 20 - 2
code/app/AppTaskCan.c

@@ -653,12 +653,12 @@ static void UDSAnsFunc(uint8 *rawData)
 				if (Data[3] < 0x04)
 				{
 					memcpy(&AppConfigInfo.deviceSn[Data[3] * 4], &Data[4], 4);
-					UdsAns(true, UdsService, UdsSubService, 0x00, &Data[3], 1);
+					UdsAns(true, UdsService, UdsSubService, 0x00, &Data[4], 4);
 				}
 				else if (Data[3] == 0x04)
 				{
 					memcpy(&AppConfigInfo.deviceSn[Data[3] * 4], &Data[4], 1);
-					UdsAns(true, UdsService, UdsSubService, 0x00, &Data[3], 1);
+					UdsAns(true, UdsService, UdsSubService, 0x00, &Data[4], 4);
 				}
 				if (deviceSnRecvFlg == 0x1F)
 				{
@@ -668,6 +668,24 @@ static void UDSAnsFunc(uint8 *rawData)
 				}
 				break;
 			}
+			case 0x02://出厂检测联网测试
+			{
+				if(Data[4]==0x01)
+				{
+					AppConfigInfo.eolFlg = true;
+					AppConfigInfo.appSaveFlg = false;
+				}
+				else
+				{
+					AppConfigInfo.eolFlg = false;
+					AppConfigInfo.appSaveFlg = true;
+				}
+				UdsAns(true, UdsService, UdsSubService, 0x00, &Data[4], 1);
+				break;
+			}
+			default:
+				UdsAns(false, UdsService, UdsSubService, 0x00, NULL, 0);
+				break;
 			}
 		}
 		else

+ 8 - 4
code/app/AppTaskGps.c

@@ -14,7 +14,8 @@ uint32 location_handle(char *in1);
 void GpsDataDecode(uint8 *msg);
 uint8 GpsRecvPtr[1024];
 uint32 timerCounterGetdata = 0;
-uint32 LedCounter  = 0;
+uint32 ledCounterTmp = 0;
+uint32 triaxiCounterTmp = 0;
 static void vtimerCallback(TimerHandle_t pxTimer)
 {
 	uint32 ulTimerID;
@@ -46,9 +47,10 @@ void GpsTask(void *pvParameters)
 			GpsDataDecode(GpsRecvPtr);
 		}
 		/*LED控制*/
-		if(timerCounterGetdata - LedCounter>200)
+		if((timerCounterGetdata - ledCounterTmp) > 200)
 		{
-			LedCounter = timerCounterGetdata;
+			Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_OFF);
+			ledCounterTmp = timerCounterGetdata;
 			if(SocketId>=0)//网络连接成功
 			{
 				Dio_FlipChannel(DioConf_DioChannel_PTE1_GPIO_OUT_MCU_LED2);
@@ -66,8 +68,10 @@ void GpsTask(void *pvParameters)
 				Dio_WriteChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3,STD_OFF);
 			}
 		}
-		if (timerCounterGetdata % 10 == 0)
+		/*三轴计算*/
+		if ((timerCounterGetdata - triaxiCounterTmp)> 10)
 		{
+			triaxiCounterTmp = timerCounterGetdata;
 			SL_SC7A20_Read_XYZ_Data(xyzData);
 			S0[fftIdx] = (real_T)xyzData[0];
 			S1[fftIdx] = (real_T)xyzData[1];

+ 0 - 1
code/main.c

@@ -82,7 +82,6 @@ int main(void)
 	cm_backtrace_init(APPNAME, HARDWARE_VERSION, SOFTWARE_VERSION);
 	SEGGER_RTT_printf("boot\n");
 #endif
-	Dio_WriteChannel(DioConf_DioChannel_PTE0_GPIO_OUT_MCU_LED1, STD_ON);
 	UartInit();
 	xTaskCreate(MainTask, (const char *const)"MainTask", 4096, (void *)0, main_TASK_PRIORITY + 6, MainTask_Handle);
 	//xTaskCreate(Uart0Task, (const char *const)"Uart0_Bms_Task", 512, (void *)0, main_TASK_PRIORITY + 2, Uart0Task_Handle);