haitao 11 meses atrás
pai
commit
8d000c1f1b

+ 15 - 21
app/MDKProject/lora_gateway.uvoptx

@@ -117,6 +117,11 @@
         <pMon>Segger\JL2CM3.dll</pMon>
       </DebugOpt>
       <TargetDriverDllRegistry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>DLGUARM</Key>
+          <Name></Name>
+        </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
           <Key>JL2CM3</Key>
@@ -137,11 +142,6 @@
           <Key>ARMDBGFLAGS</Key>
           <Name></Name>
         </SetRegEntry>
-        <SetRegEntry>
-          <Number>0</Number>
-          <Key>DLGUARM</Key>
-          <Name></Name>
-        </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
           <Key>CMSIS_AGDI</Key>
@@ -157,18 +157,18 @@
         <Bp>
           <Number>0</Number>
           <Type>0</Type>
-          <LineNumber>24</LineNumber>
+          <LineNumber>41</LineNumber>
           <EnabledFlag>1</EnabledFlag>
-          <Address>0</Address>
+          <Address>134247892</Address>
           <ByteObject>0</ByteObject>
           <HtxType>0</HtxType>
           <ManyObjects>0</ManyObjects>
           <SizeOfObject>0</SizeOfObject>
           <BreakByAccess>0</BreakByAccess>
-          <BreakIfRCount>0</BreakIfRCount>
-          <Filename>..\System\source\sys_http.c</Filename>
+          <BreakIfRCount>1</BreakIfRCount>
+          <Filename>C:\Users\16936\Desktop\Lora_gateway_sx1278\app\System\source\task.c</Filename>
           <ExecCommand></ExecCommand>
-          <Expression></Expression>
+          <Expression>\\lora_gateway\../System/source/task.c\41</Expression>
         </Bp>
       </Breakpoint>
       <WatchWindow1>
@@ -238,12 +238,6 @@
       <pszMrulep></pszMrulep>
       <pSingCmdsp></pSingCmdsp>
       <pMultCmdsp></pMultCmdsp>
-      <SystemViewers>
-        <Entry>
-          <Name>System Viewer\FSMC</Name>
-          <WinId>35905</WinId>
-        </Entry>
-      </SystemViewers>
       <DebugDescription>
         <Enable>1</Enable>
         <EnableFlashSeq>0</EnableFlashSeq>
@@ -256,7 +250,7 @@
 
   <Group>
     <GroupName>USER</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
@@ -1104,7 +1098,7 @@
 
   <Group>
     <GroupName>UCOSII_CORE</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
@@ -2024,7 +2018,7 @@
 
   <Group>
     <GroupName>DLT645</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
@@ -2092,7 +2086,7 @@
 
   <Group>
     <GroupName>MODBUS</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
@@ -2100,7 +2094,7 @@
       <GroupNumber>16</GroupNumber>
       <FileNumber>144</FileNumber>
       <FileType>1</FileType>
-      <tvExp>0</tvExp>
+      <tvExp>1</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
       <PathWithFileName>..\modbus\mmodbus.c</PathWithFileName>

BIN
app/OBJ/lora_gateway.axf


Diferenças do arquivo suprimidas por serem muito extensas
+ 2426 - 18406
app/OBJ/lora_gateway.hex


+ 1 - 0
app/System/includes/node_data_acquisition.h

@@ -5,4 +5,5 @@
 #include "dlt645_port.h"
 void data_acquisition(void);
 extern uint8_t protocol_485;
+void rs_485_test();
 #endif

+ 0 - 6
app/System/includes/sys_http.h

@@ -5,12 +5,6 @@
 void http_getDemo(void);
 
 void http_postDemo(void);
-extern uint8_t load_http_config;  //httpÓÐÎÞ»ñÈ¡ÐÂÊý¾ÝµÄÒÀ¾Ý
-typedef Http_config
-{
-	
-}
-
 #endif 
 
 

+ 11 - 1
app/System/source/node_data_acquisition.c

@@ -1,5 +1,6 @@
 #include "node_data_acquisition.h"
 #include "node_message.h"
+#include "malloc.h"
 
 #include <math.h>
 uint8_t protocol_485;                      //485回调函数会调用那个callback dlt645还是modbus dlt645为2 modbus为1
@@ -97,4 +98,13 @@ void data_acquisition(void)
 		}
 		i++;
 	}
-}
+}
+void rs_485_test()
+{
+	uint16_t *data=mymalloc(SRAMEX,50);
+	bool success = mmodbus_readHoldingRegisters16i(0x01,0x00,0x0C,data);
+	if(success)
+	{
+		int i=0;
+	}
+}

+ 3 - 7
app/System/source/task.c

@@ -37,11 +37,11 @@ void data_task(void *pdata)
 {
 	OS_CPU_SR cpu_sr;
 	pdata = pdata;
-	
+	uint16_t data;
+	mmodbus_readHoldingRegister16i(0x01,0x00,&data);
 	Radio = RadioDriverInit();
 	Radio->Init();
-#ifdef MASTER
-	__load_file:
+#if 0
 	char *lora_config_json = mymalloc(SRAMEX, 9 * 1024);
 	read_file("lora_json.txt", lora_config_json);
 	addGatewayParams(lora_config_json);
@@ -58,10 +58,6 @@ void data_task(void *pdata)
 	uint8_t err;
  	while (current_node!=NULL)
 	{
-		if(load_http_config!=0)
-		{
-			goto __load_file;
-		}
 		while(!masterSendNodeString(nodeIndex,string,&bufferLength))       //ÂÖѯ¶Á³ö
 		{
 			master_task(string,bufferLength);

+ 3 - 6
app/USER/main.c

@@ -16,7 +16,7 @@
 #include "sys_http.h"
 #include "task.h"
 #include "sys_sx1278.h"
-
+#include "node_data_acquisition.h"
 
 
 #define UNIQUE_ID 0x1fff7a10
@@ -82,11 +82,12 @@ int main(void)
 	USART_485_config();	
   USART_232_config();	
 	NAND_Init();
-	
 	OSInit();
+	#if 0
 	//OSTaskCreate(start_task,(void*)0,(OS_STK*)&START_TASK_STK[START_STK_SIZE-1],START_TASK_PRIO);
 	OSTaskCreate(period_taskFuntcion,(void*)0,(OS_STK*)&PERIOD_TASK_STK[PERIOD_STK_SIZE-1],PERIOD_TASK_PRIO);
 	OSTaskCreate(led_taskFuntcion,(void*)0,(OS_STK*)&LED_TASK_STK[LED_STK_SIZE-1],LED_TASK_PRIO);
+	#endif
 	OSTaskCreate(data_task,(void*)0,(OS_STK*)&DATA_TASK_STK[DATA_STK_SIZE-1],DATA_TASK_PRIO);
 	OSTaskCreate(sx1278_send_task,(void *)0,(OS_STK*)&SX1278_TASK_STK[SX1278_STK_SIZE-1],SX1278_TASK_PRIO);
 	printf("system start \r\n");
@@ -223,7 +224,3 @@ void load_unique(void)
  *  函数作用:加载本地存储配置如果上位机配置过则不走http配置路线,防止两线冲突
  */
 
-void load_232_config()
-{
-	
-}

+ 4 - 2
app/modbus/mmodbus.c

@@ -3,6 +3,7 @@
 #include "mmodbus.h"
 #include "usart.h"
 #include "delay.h"
+
 MModBus_t mmodbus;
 
 // #####################################################################################################
@@ -117,16 +118,17 @@ bool mmodbus_sendRaw(uint8_t *data, uint16_t size, uint32_t timeout)
 	mmodbus.txBusy = 1;
 	memset(mmodbus.rxBuf, 0, _MMODBUS_RXSIZE);
 	mmodbus.rxIndex = 0;
+//	OSIntEnter();
 	uint32_t startTime = gettick();
 	GPIO_WriteBit(_MMODBUS_CTRL_GPIO, _MMODBUS_CTRL_PIN,1);
 	mmodbus_delay(1);
 	for (uint16_t i = 0; i < size; i++)
 	{
 		USART_SendData(_MMODBUS_USART,data[i]);
-		
+		while (USART_GetFlagStatus(_MMODBUS_USART, USART_FLAG_TXE) == RESET);
 	} 
 	while (RESET == USART_GetFlagStatus(_MMODBUS_USART, USART_FLAG_TC));
-	
+//	OSIntExit();
 	GPIO_WriteBit(_MMODBUS_CTRL_GPIO, _MMODBUS_CTRL_PIN,0);
 	mmodbus.done=0;
 	mmodbus.txBusy = 0;

+ 1 - 1
app/modbus/mmodbusConfig.h

@@ -4,7 +4,7 @@
 #define _MMODBUS_FREERTOS         0
 #define _MMODBUS_RTU              1
 #define _MMODBUS_ASCII            0 //  not implemented yet
-#define _MMODBUS_USART            USART1             
+#define _MMODBUS_USART            USART3            
 #define _MMODBUS_RXSIZE           64  
 #define _MMODBUS_TXDMA            0