Преглед на файлове

【V1.1.1.1】蓝牙模块软件测试完成

CHENJIE-PC\QiXiang_CHENJIE преди 2 години
родител
ревизия
c78f1bae92

+ 1 - 1
generate/include/Flexio_Uart_Ip_Defines.h

@@ -89,7 +89,7 @@ extern "C"{
 #define FLEXIO_UART_IP_NUMBER_OF_SHIFTER_AND_TIMER      (4U)
 
 /* @brief Uart Osif source counter. This parameter is used to select between different OsIf counter implementation */
-#define FLEXIO_UART_IP_TIMEOUT_TYPE                     (OSIF_COUNTER_DUMMY)
+#define FLEXIO_UART_IP_TIMEOUT_TYPE                     (OSIF_COUNTER_SYSTEM)
 
 /* @brief Number of loops before returning FLEXIO_STATUS_TIMEOUT.*/
 #define FLEXIO_UART_IP_TIMEOUT_VALUE_US                 (500000U)

+ 2 - 2
generate/include/Lpuart_Uart_Ip_Defines.h

@@ -83,10 +83,10 @@ extern "C"{
 #define LPUART_UART_IP_NUMBER_OF_INSTANCES          (3U) /*!< Number of available hardware instances */
 
 /* @brief Uart Osif source counter. This parameter is used to select between different OsIf counter implementation */
-#define LPUART_UART_IP_TIMEOUT_TYPE                 (OSIF_COUNTER_DUMMY)
+#define LPUART_UART_IP_TIMEOUT_TYPE                 (OSIF_COUNTER_SYSTEM)
 
 /* @brief Number of loops before returning LPUART_STATUS_TIMEOUT.*/
-#define LPUART_UART_IP_TIMEOUT_VALUE_US             (5U)
+#define LPUART_UART_IP_TIMEOUT_VALUE_US             (500000U)
 
 /* @brief LPUART DMA support */
 #define LPUART_UART_IP_HAS_DMA_ENABLED              (STD_ON)

+ 1 - 1
generate/include/OsIf_Cfg.h

@@ -108,7 +108,7 @@ extern "C"{
 
 #define USING_OS_BAREMETAL
 
-#define OSIF_USE_SYSTEM_TIMER            (STD_OFF)
+#define OSIF_USE_SYSTEM_TIMER            (STD_ON)
 
 #define OSIF_USE_CUSTOM_TIMER            (STD_OFF)
 

+ 1 - 1
generate/include/Uart_Defines.h

@@ -89,7 +89,7 @@ extern "C"
 #define UART_CH_MAX_CONFIG              (3U)
 
 /* @brief UART Osif source counter. This parameter is used to select between different OsIf counter implementation */
-#define UART_TIMEOUT_TYPE               (OSIF_COUNTER_DUMMY)
+#define UART_TIMEOUT_TYPE               (OSIF_COUNTER_SYSTEM)
 
 /* @brief Number of loops before returning Timeout status */
 #define UART_TIMEOUT_VALUE_US           (500000U)

+ 11 - 1
generate/output/Base.epc

@@ -75,10 +75,20 @@
                 </ECUC-NUMERICAL-PARAM-VALUE>
                 <ECUC-NUMERICAL-PARAM-VALUE>
                   <DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF">/TS_T40D2M10I0R0/Base/OsIfGeneral/OsIfUseSystemTimer</DEFINITION-REF>
-                  <VALUE>0</VALUE>
+                  <VALUE>1</VALUE>
                 </ECUC-NUMERICAL-PARAM-VALUE>
               </PARAMETER-VALUES>
               <SUB-CONTAINERS>
+                <ECUC-CONTAINER-VALUE>
+                  <SHORT-NAME>OsIfCounterConfig_0</SHORT-NAME>
+                  <DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/TS_T40D2M10I0R0/Base/OsIfGeneral/OsIfCounterConfig</DEFINITION-REF>
+                  <REFERENCE-VALUES>
+                    <ECUC-REFERENCE-VALUE>
+                      <DEFINITION-REF DEST="ECUC-REFERENCE-DEF">/TS_T40D2M10I0R0/Base/OsIfGeneral/OsIfCounterConfig/OsIfSystemTimerClockRef</DEFINITION-REF>
+                      <VALUE-REF DEST="ECUC-CONTAINER-VALUE">/Mcu/Mcu/McuModuleConfiguration/McuClockSettingConfig_0/McuClockReferencePoint_LPUART0_CLK</VALUE-REF>
+                    </ECUC-REFERENCE-VALUE>
+                  </REFERENCE-VALUES>
+                </ECUC-CONTAINER-VALUE>
                 <ECUC-CONTAINER-VALUE>
                   <SHORT-NAME>OsIfOperatingSystemType</SHORT-NAME>
                   <DEFINITION-REF DEST="ECUC-CHOICE-CONTAINER-DEF">/TS_T40D2M10I0R0/Base/OsIfGeneral/OsIfOperatingSystemType</DEFINITION-REF>

+ 1 - 1
generate/output/Uart.epc

@@ -88,7 +88,7 @@
                 </ECUC-NUMERICAL-PARAM-VALUE>
                 <ECUC-TEXTUAL-PARAM-VALUE>
                   <DEFINITION-REF DEST="ECUC-ENUMERATION-PARAM-DEF">/TS_T40D2M10I0R0/Uart/GeneralConfiguration/UartTimeoutMethod</DEFINITION-REF>
-                  <VALUE>OSIF_COUNTER_DUMMY</VALUE>
+                  <VALUE>OSIF_COUNTER_SYSTEM</VALUE>
                 </ECUC-TEXTUAL-PARAM-VALUE>
                 <ECUC-NUMERICAL-PARAM-VALUE>
                   <DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF">/TS_T40D2M10I0R0/Uart/GeneralConfiguration/UartVersionInfoApi</DEFINITION-REF>

+ 23 - 0
generate/src/OsIf_Cfg.c

@@ -132,6 +132,29 @@ extern "C"{
 *                                      GLOBAL VARIABLES
 ==================================================================================================*/
 
+#define BASE_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Base_MemMap.h"
+
+static const OsIf_ConfigType OsIf_xPredefinedConfig =
+{
+    /*.counterId */         0U,
+    /*.counterFrequency */  4000000U
+};
+
+#define BASE_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Base_MemMap.h"
+
+#define BASE_START_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Base_MemMap.h"
+
+const OsIf_ConfigType *const OsIf_apxPredefinedConfig[OSIF_MAX_COREIDX_SUPPORTED] =
+{
+    &OsIf_xPredefinedConfig
+};
+
+#define BASE_STOP_SEC_CONFIG_DATA_UNSPECIFIED
+#include "Base_MemMap.h"
+
 
 /*==================================================================================================
                                        GLOBAL CONSTANTS

+ 2 - 1
src/AppGlobalVar.c

@@ -16,6 +16,7 @@
 
 #include "AppGlobalVar.h"
 //*全局变量*//
+uint32 BleVersion = 0x01010101;         // ble的软件版本
 uint8 BleMacAddr[6];
 uint8 BleTargetMacAddr[6] = {0xBE, 0x84, 0xCC, 0x29, 0x3B, 0xCB};
 uint8 BleCurrentRole = 0;
@@ -28,7 +29,7 @@ uint8 BleDisconnectFlg = 0;    //
 uint8 BlePwrControlEnable = 0; //蓝牙开关机使能,默认不使能,自动开机
 uint8 BlePwrControlFlg = 0;    //蓝牙开关机控制,1-关机,0-开机,2-重启
 uint8 BlePwrState = 0;         //蓝牙开关机状态
-uint32 BleVersion = 0x0000000F;         // ble的软件版本
+
 uint8 AT_MsgFlag = false; //是否有数据传输需求
 QueueHandle_t McuDataSendHandle;
 QueueHandle_t McuDataRecvHandle;

+ 6 - 10
src/AppTaskBle.c

@@ -33,6 +33,9 @@ void BleTask(void *pvParameters)
 	sint8 ret = -1;
 	QueueDataTrans_Type BleAnsData={0,NULL};
 	QueueDataTrans_Type BleAskData={0,NULL};
+	uint16 ReadLen = 0;
+	uint8 *retptr = NULL;
+	uint8 *pSend = NULL;
 	for (;;)
 	{
 		switch (bleWorkState)
@@ -53,11 +56,8 @@ void BleTask(void *pvParameters)
 					AtcmdTransmit(AT_Conn, BleTargetMacAddr, sizeof(BleTargetMacAddr), AtCmdRead, &ret);
 					if (ret == 0) //连接成功
 					{
-						BleConnectFlg = 1;
-						bleWorkState = 1;
 						BleConnectEnable = 0;
 						BleDisconnectFlg = 0;
-						xSemaphoreGive(ConnSemaphore);
 					}
 					else
 					{
@@ -65,9 +65,6 @@ void BleTask(void *pvParameters)
 					}
 				}
 			}
-			uint8 *retptr = NULL;
-			uint8 *pSend = NULL;
-			uint16 ReadLen = 0;
 			memset(RX_Buffer[UART_LPUART2], 0x00, sizeof(RX_Buffer[UART_LPUART2]));
 			UART_Receive_Data(UART_LPUART2, RX_Buffer[UART_LPUART2],&ReadLen, 100);
 			memcpy(AtCmdRead, RX_Buffer[UART_LPUART2], sizeof(AtCmdRead));
@@ -79,6 +76,7 @@ void BleTask(void *pvParameters)
 					bleWorkState = 1;
 					BleConnectFlg = 1;
 					BleDisconnectFlg = 0;
+					xSemaphoreGive(ConnSemaphore);
 				}
 			}
 			break;
@@ -115,8 +113,6 @@ void BleTask(void *pvParameters)
 			/*已连接状态下的数据交换在此进行
 			UartTramsit;
 			*/
-			uint8 *pSend = NULL;
-			uint16 ReadLen = 0;
 			/*S32K144*/
 			if (BleCurrentRole == 1)//主机蓝牙在连接状态下的蓝牙串口发送功能,从MCU串口0队列得到,发给串口2
 			{
@@ -139,7 +135,7 @@ void BleTask(void *pvParameters)
 					BleAnsData.DataPtr = NULL;
 				}
 			}
-			UART_Receive_Data(UART_LPUART2, RX_Buffer[UART_LPUART2],&ReadLen, 100);
+			UART_Receive_Data(UART_LPUART2, RX_Buffer[UART_LPUART2],&ReadLen, 1000);
 			memcpy(AtCmdRead, RX_Buffer[UART_LPUART2], sizeof(AtCmdRead));
 			memset(RX_Buffer[UART_LPUART2], 0x00, sizeof(RX_Buffer[UART_LPUART2]));
 			if (ReadLen>0)//连接的状态下,蓝牙串口会发送断开状态以及发送的内容
@@ -162,7 +158,7 @@ void BleTask(void *pvParameters)
 						memset(DataSend.DataPtr,0x00,ReadLen+1);
 						memcpy(DataSend.DataPtr,AtCmdRead,DataSend.RealLen);
 						sint8 McuDataRet = -1;
-						McuDataRet= xQueueSend(McuDataRecvHandle,&DataSend,1000*5);//增加数据的有效性判定,主机蓝牙从Uart2->Uart0数据的有效性,len>7?
+						McuDataRet= xQueueSend(McuDataRecvHandle,&DataSend,1000*2);//增加数据的有效性判定,主机蓝牙从Uart2->Uart0数据的有效性,len>7?
 						if(McuDataRet!=pdPASS)
 						{
 							if(DataSend.DataPtr != NULL)

+ 2 - 2
src/AppTaskUart0.c

@@ -113,7 +113,7 @@ sint8 McuAtCallbackFunc(char *Readptr,uint16 ReadLen, McuAtCmd McuAtIdx, char *A
 						BleTargetMacAddr[i] = temp1|temp2;
 					}
 					BleConnectEnable = 1;
-					if( xSemaphoreTake( ConnSemaphore, 2000 ) == pdTRUE )
+					if( xSemaphoreTake( ConnSemaphore, 5000 ) == pdTRUE )
 					{
 						memcpy(AnsPtr, SucAns, strlen(SucAns));
 						*AnsPtrLen = strlen(SucAns);
@@ -224,7 +224,7 @@ sint8 McuAtCallbackFunc(char *Readptr,uint16 ReadLen, McuAtCmd McuAtIdx, char *A
 				BleRecvDataFromUart2 RecvDatabuffer={0,NULL};
 				sint8 QueneRetRev = -1;
 				xQueueReset(McuDataRecvHandle);
-				QueneRetRev = xQueueReceive(McuDataRecvHandle,&RecvDatabuffer,1000*2);
+				QueneRetRev = xQueueReceive(McuDataRecvHandle,&RecvDatabuffer,1000*5);
 				if(QueneRetRev==pdPASS)
 				{
 					uint8 DataLen = RecvDatabuffer.RealLen;

+ 1 - 1
src/hal_adapter.c

@@ -183,7 +183,7 @@ UINT8 UartTramsit(UINT8 *pSend, UINT32 sendLen, UINT8 *pRead, UINT32 readLen, UI
      uint32 retVal = E_NOT_OK;
      //    uint8 Rx_Buffer[MSG_LEN];
      bufferIdx[recvChannel]=0;
-
+     *rxlen = 0;
      if (rxBuffer == NULL)
      {
          return retVal;