From 6126f6a78b14297cefb02f06ba58806767d424b5 Mon Sep 17 00:00:00 2001 From: QuakeGod <QuakeGod@sina.com> Date: 星期三, 01 二月 2023 12:05:29 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/FP0' into kNet --- MDK-ARM/.vscode/keil-assistant.log | 2 Src/FP0.c | 30 Src/KBus.c | 242 +++--- Src/KMachine.c | 50 Inc/KMachine.h | 310 ++++--- MDK-ARM/F030C8T6_KLink.uvprojx | 94 ++ Src/PLCfunctions.c | 24 Inc/KBus.h | 48 Inc/functions.h | 6 Src/KLink.c | 197 +++- MDK-ARM/JLinkLog.txt | 36 MDK-ARM/RTE/_F030C8T6_Ext_FP0/RTE_Components.h | 20 MDK-ARM/.vscode/c_cpp_properties.json | 101 ++ Src/functions.c | 48 Inc/GlobalDef.h | 41 MDK-ARM/DebugConfig/F030C8T6_Ext_FP0_STM32F030C8Tx.dbgconf | 42 + Src/debug.c | 5 Src/BSP.c | 3 Src/main.c | 93 +- MDK-ARM/pemicro_connection_settings.ini | 3 MDK-ARM/.vscode/uv4.log.lock | 0 Inc/KLink.h | 7 MDK-ARM/F030C8T6_Ext_FP0.uvprojx | 749 ++++++++++++++++++++ Src/stm32f0xx_it.c | 16 24 files changed, 1,692 insertions(+), 475 deletions(-) diff --git a/Inc/GlobalDef.h b/Inc/GlobalDef.h index 03f09b6..df1ea22 100644 --- a/Inc/GlobalDef.h +++ b/Inc/GlobalDef.h @@ -36,17 +36,24 @@ BOARD_V42_SLAVE, //10 New V4.2 Slave 8 in 8 o BOARD_V30_MINI =11, //11 Mini Board - BOARD_V45_NET = 13, - BOARD_EXT_FP0 = 14, + BOARD_V50_RADIO_16 = 15, + BOARD_V50_RADIO_8 = 16, - BOARD_V50_RADIO = 15, }; #define BOARD_TYPE 9 #define XLAT_FREQ 8 +#define BOARD_VER 1 +#if (BOARD_TYPE == 11) +#define XLAT_FREQ 12 +#elif (BOARD_TYPE == 14) +#define XLAT_FREQ 12 +#else +#define XLAT_FREQ 8 +#endif #define GetBoardType() (BOARD_TYPE) @@ -54,13 +61,13 @@ typedef struct tagUartStat { - volatile int Inited; - volatile int RecvBytes; volatile int SendBytes; - volatile int Sending; - volatile int Recving; - volatile int UseAltRecvBuf; - volatile int IntCount; + volatile int RecvBytes; + volatile char bInited; + volatile char bSending; + volatile char bRecving; + volatile char bUseAltRecvBuf; + volatile int IRQCount; volatile int RXNECount; volatile int TXECount; volatile int PECount; @@ -91,21 +98,21 @@ extern unsigned char Uart1RecvBuf1[128]; extern int Uart1RecvBuf1DataLen; -extern unsigned char Uart1RecvBuf2[128]; -extern int Uart1RecvBuf2DataLen; +//extern unsigned char Uart1RecvBuf2[128]; +//extern int Uart1RecvBuf2DataLen; extern unsigned char Uart2RecvBuf1[128]; extern int Uart2RecvBuf1DataLen; -extern unsigned char Uart2RecvBuf2[128]; -extern int Uart2RecvBuf2DataLen; +//extern unsigned char Uart2RecvBuf2[128]; +//extern int Uart2RecvBuf2DataLen; extern volatile int Uart1BaudGot; extern volatile int Uart1BaudFirstGot; -extern volatile int Uart2BaudGot; -extern volatile int Uart2BaudFirstGot; +//extern volatile int Uart2BaudGot; +//extern volatile int Uart2BaudFirstGot; -extern volatile int Uart1DmaInts; -extern volatile int Uart2DmaInts; +//extern volatile int Uart1DmaInts; +//extern volatile int Uart2DmaInts; struct stSysConfig{ int bInited:1; diff --git a/Inc/KBus.h b/Inc/KBus.h index 0bee8da..aef83a4 100644 --- a/Inc/KBus.h +++ b/Inc/KBus.h @@ -41,25 +41,38 @@ extern unsigned char PacketBuf1[128]; extern unsigned char PacketBuf2[128]; +typedef struct tagKBusRunStat +{ + unsigned char bMaster; + unsigned char nStationID; + unsigned char nChildren; + unsigned char nCurPollId; + unsigned char nSeq; + + unsigned char bMasterRecved; + unsigned char bMasterRecvOK; + unsigned char bSlaveRecved; + unsigned int nSendTimeuS; + +}stKBusRunStat , * pstKBusRunStat; + extern unsigned char BufferIn[16]; extern unsigned char BufferOut[16]; -extern unsigned char nAddr; +extern unsigned char nStationID; extern unsigned char nChilds; extern int ChildStat[16]; extern unsigned char nCurPollId; extern unsigned char nSeq; -extern volatile unsigned char MasterRecved; -extern volatile unsigned char MasterRecvOK; -extern volatile unsigned char SlaveRecved; -extern unsigned int SendTimeuS; -extern volatile int RecvTimeuS; -extern int DelayuS; -extern int MaxDelayuS; +extern volatile unsigned char KBusMasterRecved; +extern volatile unsigned char KBusMasterRecvOK; +extern volatile unsigned char KBusSlaveRecved; +extern unsigned int KBusSendTimeuS; +extern volatile int KBusRecvTimeuS; +extern int KBusDelayuS; +extern int KBusMaxDelayuS; extern volatile unsigned int nSlaveTick; - - typedef struct tagVerInfo { @@ -107,8 +120,7 @@ unsigned char OutPutCount; unsigned char InDWCount; unsigned char OutDWCount; - - unsigned char Online; + unsigned char bOnline; }; #pragma anon_unions @@ -144,7 +156,7 @@ }; } stChnStat; -extern stChnStat ChnStats[8]; +extern stChnStat KBusChnStats[8]; typedef struct tagSlaveStat { @@ -188,7 +200,7 @@ evClosed = 4, }; -typedef struct tagPacket +typedef struct tagKBPacket { unsigned char Sign; //璧峰鏍囪 unsigned char DstHost; //鐩爣鍦板潃 @@ -197,7 +209,7 @@ unsigned char nSEQ; //搴忓垪鍙� unsigned char PacketLen; //鏁版嵁杞借嵎闀垮害 涓嶅寘鎷ご閮�5涓瓧鑺傦紝涓嶅寘鎷熬閮˙CC銆� unsigned char data[1]; //鏁版嵁杞借嵎,鏈�鏈熬鏄疊CC锛屾暟鎹暱搴︿负0鏃讹紝瀹為檯涔熸湁涓�涓暟鎹�� - }stPacket,* pPacket; + }stKBPacket,* pKBPacket; enum eResult { @@ -210,13 +222,13 @@ unsigned char KBusBCC(void * pData, int nSize); // /* Make a Packet and return Packet Length */ -int KBusMakePacket(pPacket p1,uchar Src, uchar Dst, uchar nType, uchar nSEQ, uchar DataLen, void *pData ); +int KBusMakePacket(pKBPacket p1,uchar Src, uchar Dst, uchar nType, uchar nSEQ, uchar DataLen, void *pData ); /* */ -int KBusCheckPacket(int nChn, pPacket p1, int len1); +int KBusCheckPacket(int nChn, pKBPacket p1, int len1); /* */ -int KBusParsePacket(int nChn, pPacket p1, int Len1); +int KBusParsePacket(int nChn, pKBPacket p1, int Len1); typedef struct tagMachineConfig { int bKBusMaster; diff --git a/Inc/KLink.h b/Inc/KLink.h index d86948c..20a10ef 100644 --- a/Inc/KLink.h +++ b/Inc/KLink.h @@ -85,6 +85,8 @@ KLCmdReadData = 0x35, KLCmdWriteData = 0x36 , + KLCmdStopBlinkLED = 0x4F, + KLCmdBlinkLED = 0x50, KLCmdReadProg = 0x51, KLCmdWriteProg, @@ -93,6 +95,7 @@ KLCmdSaveSysCfg, KLCmdSaveRunStat, KLCmdReadRunStat, + KLCmdClearRunStat, KLCmdEraseFlashPage = 0x61, KLCmdWriteToFlash = 0x62, @@ -131,7 +134,7 @@ extern unsigned char KLBufferIn[16]; extern unsigned char KLBufferOut[16]; -extern unsigned char nKLAddr; +extern unsigned char nKLStationId; extern unsigned char nKLSeq; extern int KLThisuS; @@ -224,7 +227,7 @@ // /* Make a Packet and return Packet Length */ -int KLMakeReqPacket(void * pBuf1,uchar Src, uchar Dst, uchar nType, uchar nSEQ, uchar DataLen, void *pData ); +int KLMakeReqPacket(void * pBuf1, uchar Src, uchar Dst, uchar nType, uchar nSEQ, uchar DataLen, void *pData ); int KLMakeRplyPacket(void * pBuf1, uchar Dst, uchar Status, uchar nCmd, uchar DataLen, const void *pData ); /* */ diff --git a/Inc/KMachine.h b/Inc/KMachine.h index e3fb8a4..15e119e 100644 --- a/Inc/KMachine.h +++ b/Inc/KMachine.h @@ -49,18 +49,24 @@ #define LoHofB(x) ((x)&0xf) #define HiHofB(x) (((x)>>4)&0xf) -// 信息块 -// 工厂参数配置块 -// 用户/系统参数配置块 +// 淇℃伅鍧� +// 宸ュ巶鍙傛暟閰嶇疆鍧� +// 鐢ㄦ埛/绯荤粺鍙傛暟閰嶇疆鍧� // // -typedef struct tagInfoBlock +typedef struct tagInfoBlock // 20 bytes { - USHORT nDeviceType; - USHORT ProgVer; - USHORT KLinkVer; - USHORT nCapacity; +// USHORT nBlockLenth; + USHORT nDeviceTypeVer; //device type x.y +// UCHAR nDevierVer; + USHORT ProgVer; //prog version x.y + USHORT KLinkVer; //x.y + USHORT KBusVer; //x.y + + UCHAR nCapacity1; // ? K + UCHAR nCapacity2; // ? k + UCHAR nDInput; UCHAR nDOutput; UCHAR nAInput; @@ -69,8 +75,47 @@ UCHAR nHOutput; UCHAR nExt1; UCHAR nExt2; + UCHAR nLogSize; + UCHAR nPorts; + UCHAR nManSize; + UCHAR nAbility; + UCHAR nSwitchBits; }stKMInfoBlock; + +/* +typedef struct tagFactData +{ + USHORT Sign; // + USHORT nLength; // + UCHAR LOT_NO[16]; // + UINT MANDate; // + UINT SN; // + UINT REV1[24]; // + USHORT rev9; + USHORT CRC; + +}stFactData; +*/ +typedef struct tagFactoryData //宸ュ巶閲忎骇鍙傛暟锛屾暟鎹� +{ + USHORT Sign1; + USHORT Seq1; + USHORT nModelNo; + USHORT nModelVer; + UINT nLotNo; + UINT nProductDateTime; + UINT SN1; + UINT nProtocalVer; + UINT nDefaultFunc; + UCHAR ModelStr[16]; + UCHAR LOT_NO[16]; // + UCHAR SNStr[16]; + unsigned short CRC1; + unsigned short EndSign1; + +}stFactoryData,* pFactoryData; + enum enStoreCfg { @@ -78,7 +123,6 @@ START_SIGN = 0x55aa, END_SIGN = 0x5aa5, }; - enum enInputFilter { @@ -101,74 +145,66 @@ Output_Set_1 = 2, }; +typedef struct tagPortStatus +{ + USHORT porttype; //232,485,net , wireless// KLink, KBus, KNet, KWireless + UCHAR StationID; + UCHAR MaxStations; + UCHAR CurStations; + UCHAR Running; + UCHAR Health; +}; + enum enPortType { - PortType_Com = 0, //计算机通讯 - PortType_Gen = 1, //通用通讯,自由口 - PortType_KLink = 2, //Klink通讯 - PortType_KBus = 3, //KBus通讯 - PortType_KNet = 4, // KNet通讯 - PortType_ModbusRTU = 5, //Modbus RTU 通讯 + PortType_Default = 0, //榛樿 + PortType_KLink = 1, //KLink閫氳 + PortType_KBus = 2, //KBus閫氳 + PortType_KNet = 3, // KNet閫氳 + PortType_ModbusRTU = 4, //Modbus RTU 閫氳 + PortType_Com = 5, // 璁$畻鏈洪�氳 + PortType_Gen = 6, //閫氱敤閫氳锛岃嚜鐢卞彛 }; - -//每个模块有 0/1/2/3/4/5/6/7/8个 通讯port -//不限于 UART, 网口,无线,单总线等,都是port -//甚至可以有虚拟的port - -typedef struct tagPortStat -{ - UCHAR nWorking; //工作中 - UCHAR nStation; //自己站号 - UCHAR bBus; //总线?,,全双工? - UCHAR bMaster; //主机 - UCHAR PortType; //端口工作模式 - UCHAR nDevices; //连接的设备数量//不包括自己 //device list; - -}stPortStat,*pPortStat; - -enum enKeventType -{ - EventTypeNone = 0, - EventTypePowerUp = 1, - EventTypePowerDown = 2, - EventTypePowerRecover = 3, - EventTypeConnected = 4, - EventTypeLostCon = 5, - EventTypeSetTime = 6, - EventTypeSysCfg = 7, - EventTypeProg = 8, - EventTypeForce = 9, - EventTypeClearEvent = 10, - - - EventType -}; - -typedef struct tagKMFuncParam -{ - USHORT EnablePLC:1; //使能内部PLC功能 - USHORT RunMode; //工作模式 -}stKMFuncParam; - -// 输入输出地址映射 typedef struct tagComPortParam //4 Bytes { + USHORT WorkMode; /* 0-5=Default,KLink,KBus,KNet,RTU,Com,Gen */ USHORT Station; /* 0=From jumper */ - USHORT WorkMode; /* 0-5=Com,Gen,KLink,KBus,KNet,RTU */ USHORT BaudRate; /* =*100 Baudrate at which running */ -// USHORT PortType:4; /* 0-5=Com,Gen,KLink,KBus,KNet,RTU */ USHORT ByteSize:2; /* 0-1=Number of bits/byte, 7-8 */ USHORT Parity:4; /* 0-4=None,Odd,Even,Mark,Space */ USHORT StopBits:2; /* 0,1,2 = 1, 1.5, 2 */ USHORT EndType:2; /* 0=ByChar, 1= ByTime */ USHORT EofChar:4; /* 0,1,2 = None, CR, CR+LF, ETX; End of character */ USHORT SofChar:2; /* 0,1,2 = None, STX */ - USHORT EndTime; + USHORT EndTime; /*(*0.01mS) */ USHORT RecvAddr; USHORT RecvSize; + +}stComPortParam, *pstComPortParam; + +//姣忎釜妯″潡鏈� 0/1/2/3/4/5/6/7/8涓� 閫氳port +//涓嶉檺浜� UART, 缃戝彛锛屾棤绾匡紝鍗曟�荤嚎绛夛紝閮芥槸port +//鐢氳嚦鍙互鏈夎櫄鎷熺殑port + +typedef struct tagPortStat +{ + UCHAR PortType; //绔彛宸ヤ綔妯″紡 + UCHAR nStation; //鑷繁绔欏彿 + UCHAR bWorking; //宸ヤ綔涓� + UCHAR bBus; //鎬荤嚎?,,鍏ㄥ弻宸�? + UCHAR bMaster; //涓绘満 + UCHAR nDevices; //杩炴帴鐨勮澶囨暟閲�//涓嶅寘鎷嚜宸� //device list; -}stComPortParam; +}stPortStat,*pPortStat; + +typedef struct tagKMFuncParam +{ + USHORT EnablePLC:1; //浣胯兘鍐呴儴PLC鍔熻兘 + USHORT RunMode; //宸ヤ綔妯″紡 +}stKMFuncParam; + +// 杈撳叆杈撳嚭鍦板潃鏄犲皠 typedef struct tagInputFilterParam // 1 Bytes { @@ -189,12 +225,12 @@ USHORT Version; // SC0 // 2 Bytes USHORT workmode; // SC1 // 2 Bytes 0=From jumper USHORT SwitchFunc; // SC2 // 2 Bytes - - USHORT OutMappings[6]; //12 Bytes //输出映射 + USHORT pad1; // 2 Bytes stComPortParam PortParams[2]; // 8 Bytes - stOutputHoldParam OutputParams[16]; //16 Bytes stInputFilterParam InputParams[16]; //16 Bytes + stOutputHoldParam OutputParams[16]; //16 Bytes + USHORT OutMappings[6]; //12 Bytes //杈撳嚭鏄犲皠 UINT cfgvar3; // 4 Bytes UINT cfgvar4; // 4 Bytes @@ -206,11 +242,11 @@ UINT cfgvar10; // 4 Bytes UINT cfgvar11; // 4 Bytes UINT cfgvar12; // 4 Bytes - UINT cfgvar13; // 4 Bytes - UINT cfgvar14; // 4 Bytes - UINT cfgvar15; // 4 Bytes - UINT cfgvar16; // 4 Bytes - UINT Space1[5]; //20 Bytes +// UINT cfgvar13; // 4 Bytes +// UINT cfgvar14; // 4 Bytes +// UINT cfgvar15; // 4 Bytes +// UINT cfgvar16; // 4 Bytes +// UINT Space1[4]; //16 Bytes }stKMSysCfg,* pKMSysCfg; @@ -223,38 +259,23 @@ unsigned short EndSign1; }stStoredKMSysCfg,*pStoredKMSysCfg; -/* -typedef struct tagFactData +enum enKeventType { - USHORT Sign; // - USHORT nLength; // - UCHAR LOT_NO[16]; // - UINT MANDate; // - UINT SN; // - UINT REV1[24]; // - USHORT rev9; - USHORT CRC; + EventTypeNone = 0, + EventTypePowerUp = 1, + EventTypePowerDown = 2, + EventTypePowerRecover = 3, + EventTypeConnected = 4, + EventTypeLostCon = 5, + EventTypeSetTime = 6, + EventTypeSysCfg = 7, + EventTypeProg = 8, + EventTypeForce = 9, + EventTypeClearEvent = 10, -}stFactData; -*/ -typedef struct tagFactoryData //工厂量产参数,数据 -{ - USHORT Sign1; - USHORT Seq1; - USHORT nModelNo; - USHORT nModelVer; - UINT nLotNo; - UINT nProductDateTime; - UINT SN1; - UINT nProtocalVer; - UINT nDefaultFunc; - UCHAR ModelStr[16]; - UCHAR LOT_NO[16]; // - UCHAR SNStr[16]; - unsigned short CRC1; - unsigned short EndSign1; -}stFactoryData,* pFactoryData; + EventType +}; typedef struct tagEventLog { @@ -278,7 +299,8 @@ volatile unsigned short WorkMode2; volatile unsigned short nBinProgBank; volatile unsigned short nBinProgSize; - unsigned int Reserved2[1]; + unsigned short bLEDFlick; + unsigned short Reserved2[1]; unsigned short CRC1; unsigned short EndSign1; }stRunStat, *pRunStat; @@ -324,40 +346,11 @@ KLDataTypeLD = 13 | TYPEDATA, KLDataSysCfg = 25 | TYPEDATA, KLDataTypeFlash = 33 | TYPEDATA, + KLDataTypeWDT = 41 | TYPEDATA, + KLDataTypeKBD = 51 | TYPEDATA, KLDataTypeTest = 254 | TYPEDATA, }; -enum enKLDataCounts - { - KLDataDTCount = 256, - KLDataSDTCount = 256, - - KLDataWXCount = 16, - KLDataWYCount = 16, - KLDataWRCount = 16, - KLDataLDCount = 64, - KLDataWLCount = 8, - - KLCoilXCount = KLDataWXCount * 16, - KLCoilYCount = KLDataWYCount * 16, - KLCoilRCount = KLDataWRCount * 16, - - KLCoilTCount = 64, - KLCoilCCount = KLCoilTCount, - - KLDataSVCount = KLCoilTCount, - KLDataEVCount = KLCoilTCount, - - KLCoilLXCount = 128, - KLCoilLYCount = 128, - KLCoilLRCount = 128, - KLCoilSRCount = 128, - - }; -#define TOTAL_WDFS (16) //Total DF Count -#define TOTAL_CurVAL (16) // -#define TOTALTIMERS (64) - typedef struct tagTimerStat { unsigned short nScale:2;//Time Scale, 0:1ms 1:10ms 2:100ms 3:1S @@ -388,6 +381,40 @@ }; }stTimer; +#define TOTAL_WDFS (32) //Total DF Count +#define TOTAL_CurVAL (16) // +#define TOTALTIMERS (64) + +enum enKLDataCounts + { + + KLDataWXCount = 16, + KLDataWYCount = 16, + KLDataWRCount = 16, + KLDataLDCount = 64, + KLDataWLCount = 8, + + KLCoilXCount = KLDataWXCount * 16, + KLCoilYCount = KLDataWYCount * 16, + KLCoilRCount = KLDataWRCount * 16, + + KLCoilTCount = 64, + KLCoilCCount = KLCoilTCount, + + KLDataSVCount = KLCoilTCount, + KLDataEVCount = KLCoilTCount, + + KLCoilLXCount = 128, + KLCoilLYCount = 128, + KLCoilLRCount = 128, + KLCoilSRCount = 128, + + KLDataDTCount = 128, + KLDataSDTCount = 128, + KLDataWDTCount = 128, + + }; + typedef struct tagKMem { unsigned short WDFs[TOTAL_WDFS]; @@ -396,12 +423,12 @@ stTimer Timers[TOTALTIMERS]; union { - unsigned short WX[KLDataWXCount]; //本机的X和Y + unsigned short WX[KLDataWXCount]; //鏈満鐨刋鍜孻 unsigned char WXB[KLDataWXCount*2]; }; union { - unsigned short WY[KLDataWYCount]; //本机的X和Y - unsigned char WYB[KLDataWYCount*2]; //本机的X和Y + unsigned short WY[KLDataWYCount]; //鏈満鐨刋鍜孻 + unsigned char WYB[KLDataWYCount*2]; //鏈満鐨刋鍜孻 }; unsigned short WR[KLDataWRCount]; @@ -412,21 +439,21 @@ unsigned short SV[KLDataSVCount]; - unsigned short WLX[16]; //虚拟的X和Y,远程通讯时映射用。 + unsigned short WLX[16]; //铏氭嫙鐨刋鍜孻锛岃繙绋嬮�氳鏃舵槧灏勭敤銆� unsigned short WLY[16]; unsigned short WLR[16]; unsigned short WSR[16]; union { - unsigned int DTD[KLDataDTCount]; + unsigned int DTD[KLDataDTCount/2]; unsigned short DT[KLDataDTCount]; unsigned char DTB[KLDataDTCount*2]; }; - // 配置寄存器 - // 系统状态寄存器 - // 特殊寄存器 - // 调试,监控寄存器 + // 閰嶇疆瀵勫瓨鍣� + // 绯荤粺鐘舵�佸瘎瀛樺櫒 + // 鐗规畩瀵勫瓨鍣� + union { unsigned int SDD[KLDataSDTCount/2]; unsigned short SDT[KLDataSDTCount]; @@ -455,6 +482,13 @@ unsigned short ADCValues[20]; }; }; + // 璋冭瘯锛岀洃鎺у瘎瀛樺櫒 + union { + unsigned int WDD[KLDataWDTCount/2]; + unsigned short WDT[KLDataWDTCount]; + unsigned char WDB[KLDataWDTCount*2]; + }; + }stKMem; diff --git a/Inc/functions.h b/Inc/functions.h index c03fa01..6ce84e7 100644 --- a/Inc/functions.h +++ b/Inc/functions.h @@ -31,7 +31,7 @@ int InituS(int TickFreq1); unsigned int GetuS(void); - +void logData(unsigned char d); int InitUartstat(stUartStat * pUartstat,void * pBufRx, int nSizeRx, void * pBufTx, int nSizeTx); int Uart1SendDMA(void * pData, int nSize); int Uart1TriggerSendDMA(void ); @@ -54,13 +54,15 @@ int PutStr(char * str1, int len1); int SendPacket(int nChn, void * pBuf,int len1); //int SendPacket1(void * pBuf,int len1); -//int SendPacket2(pPacket p1,int len1); +//int SendPacket2(pKBPacket p1,int len1); void ToggleRunLed(void ); void ToggleErrLed(void ); +void ToggleErr2Led(void ); void ToggleOutStat(void ); int ReadJumperSW(void ); void SetRunLed(uchar bOn); void SetErrLed(uchar bOn); +void SetErr2Led(uchar bOn); void SetOutStat(uchar bOn); void Enable595(uchar bEnable); unsigned int GetInput(void ); diff --git a/MDK-ARM/.vscode/c_cpp_properties.json b/MDK-ARM/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..774f3ec --- /dev/null +++ b/MDK-ARM/.vscode/c_cpp_properties.json @@ -0,0 +1,101 @@ +{ + "configurations": [ + { + "name": "F030C8T6_Test2", + "includePath": [ + "d:\\WORK\\MCU&PCB\\DIST_IO\\F030C8T6_FP0\\Inc", + "d:\\WORK\\MCU&PCB\\DIST_IO\\F030C8T6_FP0\\Src", + "d:\\WORK\\MCU&PCB\\DIST_IO\\F030C8T6_FP0\\Drivers\\STM32F0xx_HAL_Driver\\Inc", + "d:\\WORK\\MCU&PCB\\DIST_IO\\F030C8T6_FP0\\Drivers\\CMSIS\\Device\\ST\\STM32F0xx\\Include", + "d:\\WORK\\MCU&PCB\\DIST_IO\\F030C8T6_FP0\\Drivers\\CMSIS\\Include", + "d:\\WORK\\MCU&PCB\\DIST_IO\\F030C8T6_FP0\\Drivers\\STM32F0xx_HAL_Driver\\Inc\\Legacy", + "D:\\Keil_v5\\ARM\\ARMCC\\include", + "D:\\Keil_v5\\ARM\\ARMCC\\include\\rw", + "d:\\WORK\\MCU&PCB\\DIST_IO\\F030C8T6_FP0\\MDK-ARM", + "d:\\WORK\\MCU&PCB\\DIST_IO\\F030C8T6_FP0\\Drivers\\STM32F0xx_HAL_Driver\\Src", + "d:\\WORK\\MCU&PCB\\DIST_IO\\F030C8T6_FP0\\Src\\Ethernet", + "d:\\WORK\\MCU&PCB\\DIST_IO\\F030C8T6_FP0\\Src\\Internet\\DNS", + "d:\\WORK\\MCU&PCB\\DIST_IO\\F030C8T6_FP0\\Src\\Internet\\DHCP", + "d:\\WORK\\MCU&PCB\\DIST_IO\\F030C8T6_FP0\\Src\\Ethernet\\W5500" + ], + "defines": [ + "USE_FULL_LL_DRIVER", + "USE_HAL_DRIVER", + "__CC_ARM", + "__arm__", + "__align(x)=", + "__ALIGNOF__(x)=", + "__alignof__(x)=", + "__asm(x)=", + "__forceinline=", + "__restrict=", + "__global_reg(n)=", + "__inline=", + "__int64=long long", + "__INTADDR__(expr)=0", + "__irq=", + "__packed=", + "__pure=", + "__smc(n)=", + "__svc(n)=", + "__svc_indirect(n)=", + "__svc_indirect_r7(n)=", + "__value_in_regs=", + "__weak=", + "__writeonly=", + "__declspec(x)=", + "__attribute__(x)=", + "__nonnull__(x)=", + "__register=", + "__breakpoint(x)=", + "__cdp(x,y,z)=", + "__clrex()=", + "__clz(x)=0U", + "__current_pc()=0U", + "__current_sp()=0U", + "__disable_fiq()=", + "__disable_irq()=", + "__dmb(x)=", + "__dsb(x)=", + "__enable_fiq()=", + "__enable_irq()=", + "__fabs(x)=0.0", + "__fabsf(x)=0.0f", + "__force_loads()=", + "__force_stores()=", + "__isb(x)=", + "__ldrex(x)=0U", + "__ldrexd(x)=0U", + "__ldrt(x)=0U", + "__memory_changed()=", + "__nop()=", + "__pld(...)=", + "__pli(...)=", + "__qadd(x,y)=0", + "__qdbl(x)=0", + "__qsub(x,y)=0", + "__rbit(x)=0U", + "__rev(x)=0U", + "__return_address()=0U", + "__ror(x,y)=0U", + "__schedule_barrier()=", + "__semihost(x,y)=0", + "__sev()=", + "__sqrt(x)=0.0", + "__sqrtf(x)=0.0f", + "__ssat(x,y)=0", + "__strex(x,y)=0U", + "__strexd(x,y)=0", + "__strt(x,y)=", + "__swp(x,y)=0U", + "__usat(x,y)=0U", + "__wfe()=", + "__wfi()=", + "__yield()=", + "__vfp_status(x,y)=0" + ], + "intelliSenseMode": "${default}" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/MDK-ARM/.vscode/keil-assistant.log b/MDK-ARM/.vscode/keil-assistant.log new file mode 100644 index 0000000..a56fa0a --- /dev/null +++ b/MDK-ARM/.vscode/keil-assistant.log @@ -0,0 +1,2 @@ +[info] Log at : 2022/10/21|09:22:30|GMT+0800 + diff --git a/MDK-ARM/.vscode/uv4.log.lock b/MDK-ARM/.vscode/uv4.log.lock new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/MDK-ARM/.vscode/uv4.log.lock diff --git a/MDK-ARM/DebugConfig/F030C8T6_Ext_FP0_STM32F030C8Tx.dbgconf b/MDK-ARM/DebugConfig/F030C8T6_Ext_FP0_STM32F030C8Tx.dbgconf new file mode 100644 index 0000000..7e622bf --- /dev/null +++ b/MDK-ARM/DebugConfig/F030C8T6_Ext_FP0_STM32F030C8Tx.dbgconf @@ -0,0 +1,42 @@ +// File: STM32F030_070.dbgconf +// Version: 1.0.0 +// Note: refer to STM32F030x4/x6/x8/xC, STM32F070x6/xB Reference manual (RM0360) +// refer to STM32F030x4 STM32F030x6, STM32F030x8 STM32F030xC datasheet +// STM32F070CB STM32F070RB, STM32F070C6 STM32F070F6 datasheet + +// <<< Use Configuration Wizard in Context Menu >>> + +// <h> Debug MCU configuration register (DBGMCU_CR) +// <o.2> DBG_STANDBY <i> Debug standby mode +// <o.1> DBG_STOP <i> Debug stop mode +// </h> +DbgMCU_CR = 0x00000006; + +// <h> Debug MCU APB1 freeze register (DBGMCU_APB1_FZ) +// <i> Reserved bits must be kept at reset value +// <o.21> DBG_I2C1_TIMEOUT <i> I2C1 SMBUS timeout mode stopped when core is halted +// <o.12> DBG_IWDG_STOP <i> Independent watchdog stopped when core is halted +// <o.11> DBG_WWDG_STOP <i> Window watchdog stopped when core is halted +// <o.10> DBG_RTC_STOP <i> RTC stopped when core is halted +// <o.8> DBG_TIM14_STOP <i> TIM14 counter stopped when core is halted +// <o.5> DBG_TIM7_STOP <i> TIM7 counter stopped when core is halted +// <o.4> DBG_TIM6_STOP <i> TIM6 counter stopped when core is halted +// <o.1> DBG_TIM3_STOP <i> TIM3 counter stopped when core is halted +// </h> +DbgMCU_APB1_Fz = 0x00000000; + +// <h> Debug MCU APB2 freeze register (DBGMCU_APB2_FZ) +// <i> Reserved bits must be kept at reset value +// <o.18> DBG_TIM17_STOP <i> TIM17 counter stopped when core is halted +// <o.17> DBG_TIM16_STOP <i> TIM16 counter stopped when core is halted +// <o.16> DBG_TIM15_STOP <i> TIM15 counter stopped when core is halted +// <o.11> DBG_TIM1_STOP <i> TIM1 counter stopped when core is halted +// </h> +DbgMCU_APB2_Fz = 0x00000000; + +// <h> Flash Download Options +// <o.0> Option Byte Loading <i> Launch the Option Byte Loading after a Flash Download by setting the OBL_LAUNCH bit (causes a reset) +// </h> +DoOptionByteLoading = 0x00000000; + +// <<< end of configuration section >>> diff --git a/MDK-ARM/F030C8T6_Ext_FP0.uvprojx b/MDK-ARM/F030C8T6_Ext_FP0.uvprojx new file mode 100644 index 0000000..4c4159e --- /dev/null +++ b/MDK-ARM/F030C8T6_Ext_FP0.uvprojx @@ -0,0 +1,749 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd"> + + <SchemaVersion>2.1</SchemaVersion> + + <Header>### uVision Project, (C) Keil Software</Header> + + <Targets> + <Target> + <TargetName>F030C8T6_Ext_FP0</TargetName> + <ToolsetNumber>0x4</ToolsetNumber> + <ToolsetName>ARM-ADS</ToolsetName> + <pCCUsed>5060422::V5.06 update 4 (build 422)::ARMCC</pCCUsed> + <TargetOption> + <TargetCommonOption> + <Device>STM32F030C8Tx</Device> + <Vendor>STMicroelectronics</Vendor> + <PackID>Keil.STM32F0xx_DFP.2.1.0</PackID> + <PackURL>http://www.keil.com/pack/</PackURL> + <Cpu>IRAM(0x20000000,0x00002000) IROM(0x08000000,0x00010000) CPUTYPE("Cortex-M0") CLOCK(12000000) ELITTLE</Cpu> + <FlashUtilSpec></FlashUtilSpec> + <StartupFile></StartupFile> + <FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F0xx_64 -FS08000000 -FL010000 -FP0($$Device:STM32F030C8Tx$CMSIS\Flash\STM32F0xx_64.FLM))</FlashDriverDll> + <DeviceId>0</DeviceId> + <RegisterFile>$$Device:STM32F030C8Tx$Drivers\CMSIS\Device\ST\STM32F0xx\Include\stm32f0xx.h</RegisterFile> + <MemoryEnv></MemoryEnv> + <Cmp></Cmp> + <Asm></Asm> + <Linker></Linker> + <OHString></OHString> + <InfinionOptionDll></InfinionOptionDll> + <SLE66CMisc></SLE66CMisc> + <SLE66AMisc></SLE66AMisc> + <SLE66LinkerMisc></SLE66LinkerMisc> + <SFDFile>$$Device:STM32F030C8Tx$CMSIS\SVD\STM32F0x0.svd</SFDFile> + <bCustSvd>0</bCustSvd> + <UseEnv>0</UseEnv> + <BinPath></BinPath> + <IncludePath></IncludePath> + <LibPath></LibPath> + <RegisterFilePath></RegisterFilePath> + <DBRegisterFilePath></DBRegisterFilePath> + <TargetStatus> + <Error>0</Error> + <ExitCodeStop>0</ExitCodeStop> + <ButtonStop>0</ButtonStop> + <NotGenerated>0</NotGenerated> + <InvalidFlash>1</InvalidFlash> + </TargetStatus> + <OutputDirectory>F030C8T6_Test2\</OutputDirectory> + <OutputName>F030C8T6_Test2</OutputName> + <CreateExecutable>1</CreateExecutable> + <CreateLib>0</CreateLib> + <CreateHexFile>1</CreateHexFile> + <DebugInformation>1</DebugInformation> + <BrowseInformation>1</BrowseInformation> + <ListingPath>.\F030C8T6_Test2\</ListingPath> + <HexFormatSelection>1</HexFormatSelection> + <Merge32K>0</Merge32K> + <CreateBatchFile>0</CreateBatchFile> + <BeforeCompile> + <RunUserProg1>0</RunUserProg1> + <RunUserProg2>0</RunUserProg2> + <UserProg1Name></UserProg1Name> + <UserProg2Name></UserProg2Name> + <UserProg1Dos16Mode>0</UserProg1Dos16Mode> + <UserProg2Dos16Mode>0</UserProg2Dos16Mode> + <nStopU1X>0</nStopU1X> + <nStopU2X>0</nStopU2X> + </BeforeCompile> + <BeforeMake> + <RunUserProg1>0</RunUserProg1> + <RunUserProg2>0</RunUserProg2> + <UserProg1Name></UserProg1Name> + <UserProg2Name></UserProg2Name> + <UserProg1Dos16Mode>0</UserProg1Dos16Mode> + <UserProg2Dos16Mode>0</UserProg2Dos16Mode> + <nStopB1X>0</nStopB1X> + <nStopB2X>0</nStopB2X> + </BeforeMake> + <AfterMake> + <RunUserProg1>0</RunUserProg1> + <RunUserProg2>0</RunUserProg2> + <UserProg1Name></UserProg1Name> + <UserProg2Name></UserProg2Name> + <UserProg1Dos16Mode>0</UserProg1Dos16Mode> + <UserProg2Dos16Mode>0</UserProg2Dos16Mode> + <nStopA1X>0</nStopA1X> + <nStopA2X>0</nStopA2X> + </AfterMake> + <SelectedForBatchBuild>0</SelectedForBatchBuild> + <SVCSIdString></SVCSIdString> + </TargetCommonOption> + <CommonProperty> + <UseCPPCompiler>0</UseCPPCompiler> + <RVCTCodeConst>0</RVCTCodeConst> + <RVCTZI>0</RVCTZI> + <RVCTOtherData>0</RVCTOtherData> + <ModuleSelection>0</ModuleSelection> + <IncludeInBuild>1</IncludeInBuild> + <AlwaysBuild>0</AlwaysBuild> + <GenerateAssemblyFile>0</GenerateAssemblyFile> + <AssembleAssemblyFile>0</AssembleAssemblyFile> + <PublicsOnly>0</PublicsOnly> + <StopOnExitCode>3</StopOnExitCode> + <CustomArgument></CustomArgument> + <IncludeLibraryModules></IncludeLibraryModules> + <ComprImg>0</ComprImg> + </CommonProperty> + <DllOption> + <SimDllName>SARMCM3.DLL</SimDllName> + <SimDllArguments> -REMAP </SimDllArguments> + <SimDlgDll>DARMCM1.DLL</SimDlgDll> + <SimDlgDllArguments>-pCM0</SimDlgDllArguments> + <TargetDllName>SARMCM3.DLL</TargetDllName> + <TargetDllArguments> </TargetDllArguments> + <TargetDlgDll>TARMCM1.DLL</TargetDlgDll> + <TargetDlgDllArguments>-pCM0</TargetDlgDllArguments> + </DllOption> + <DebugOption> + <OPTHX> + <HexSelection>1</HexSelection> + <HexRangeLowAddress>0</HexRangeLowAddress> + <HexRangeHighAddress>0</HexRangeHighAddress> + <HexOffset>0</HexOffset> + <Oh166RecLen>16</Oh166RecLen> + </OPTHX> + </DebugOption> + <Utilities> + <Flash1> + <UseTargetDll>1</UseTargetDll> + <UseExternalTool>0</UseExternalTool> + <RunIndependent>0</RunIndependent> + <UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging> + <Capability>1</Capability> + <DriverSelection>4096</DriverSelection> + </Flash1> + <bUseTDR>1</bUseTDR> + <Flash2>BIN\UL2CM3.DLL</Flash2> + <Flash3>"" ()</Flash3> + <Flash4></Flash4> + <pFcarmOut></pFcarmOut> + <pFcarmGrp></pFcarmGrp> + <pFcArmRoot></pFcArmRoot> + <FcArmLst>0</FcArmLst> + </Utilities> + <TargetArmAds> + <ArmAdsMisc> + <GenerateListings>0</GenerateListings> + <asHll>1</asHll> + <asAsm>1</asAsm> + <asMacX>1</asMacX> + <asSyms>1</asSyms> + <asFals>1</asFals> + <asDbgD>1</asDbgD> + <asForm>1</asForm> + <ldLst>0</ldLst> + <ldmm>1</ldmm> + <ldXref>1</ldXref> + <BigEnd>0</BigEnd> + <AdsALst>1</AdsALst> + <AdsACrf>1</AdsACrf> + <AdsANop>0</AdsANop> + <AdsANot>0</AdsANot> + <AdsLLst>1</AdsLLst> + <AdsLmap>1</AdsLmap> + <AdsLcgr>1</AdsLcgr> + <AdsLsym>1</AdsLsym> + <AdsLszi>1</AdsLszi> + <AdsLtoi>1</AdsLtoi> + <AdsLsun>1</AdsLsun> + <AdsLven>1</AdsLven> + <AdsLsxf>1</AdsLsxf> + <RvctClst>0</RvctClst> + <GenPPlst>0</GenPPlst> + <AdsCpuType>"Cortex-M0"</AdsCpuType> + <RvctDeviceName></RvctDeviceName> + <mOS>0</mOS> + <uocRom>0</uocRom> + <uocRam>0</uocRam> + <hadIROM>1</hadIROM> + <hadIRAM>1</hadIRAM> + <hadXRAM>0</hadXRAM> + <uocXRam>0</uocXRam> + <RvdsVP>0</RvdsVP> + <hadIRAM2>0</hadIRAM2> + <hadIROM2>0</hadIROM2> + <StupSel>8</StupSel> + <useUlib>1</useUlib> + <EndSel>0</EndSel> + <uLtcg>0</uLtcg> + <nSecure>0</nSecure> + <RoSelD>3</RoSelD> + <RwSelD>3</RwSelD> + <CodeSel>0</CodeSel> + <OptFeed>0</OptFeed> + <NoZi1>0</NoZi1> + <NoZi2>0</NoZi2> + <NoZi3>0</NoZi3> + <NoZi4>0</NoZi4> + <NoZi5>0</NoZi5> + <Ro1Chk>0</Ro1Chk> + <Ro2Chk>0</Ro2Chk> + <Ro3Chk>0</Ro3Chk> + <Ir1Chk>1</Ir1Chk> + <Ir2Chk>0</Ir2Chk> + <Ra1Chk>0</Ra1Chk> + <Ra2Chk>0</Ra2Chk> + <Ra3Chk>0</Ra3Chk> + <Im1Chk>1</Im1Chk> + <Im2Chk>0</Im2Chk> + <OnChipMemories> + <Ocm1> + <Type>0</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </Ocm1> + <Ocm2> + <Type>0</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </Ocm2> + <Ocm3> + <Type>0</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </Ocm3> + <Ocm4> + <Type>0</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </Ocm4> + <Ocm5> + <Type>0</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </Ocm5> + <Ocm6> + <Type>0</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </Ocm6> + <IRAM> + <Type>0</Type> + <StartAddress>0x20000000</StartAddress> + <Size>0x2000</Size> + </IRAM> + <IROM> + <Type>1</Type> + <StartAddress>0x8000000</StartAddress> + <Size>0x10000</Size> + </IROM> + <XRAM> + <Type>0</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </XRAM> + <OCR_RVCT1> + <Type>1</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </OCR_RVCT1> + <OCR_RVCT2> + <Type>1</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </OCR_RVCT2> + <OCR_RVCT3> + <Type>1</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </OCR_RVCT3> + <OCR_RVCT4> + <Type>1</Type> + <StartAddress>0x8000000</StartAddress> + <Size>0x10000</Size> + </OCR_RVCT4> + <OCR_RVCT5> + <Type>1</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </OCR_RVCT5> + <OCR_RVCT6> + <Type>0</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </OCR_RVCT6> + <OCR_RVCT7> + <Type>0</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </OCR_RVCT7> + <OCR_RVCT8> + <Type>0</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </OCR_RVCT8> + <OCR_RVCT9> + <Type>0</Type> + <StartAddress>0x20000000</StartAddress> + <Size>0x2000</Size> + </OCR_RVCT9> + <OCR_RVCT10> + <Type>0</Type> + <StartAddress>0x0</StartAddress> + <Size>0x0</Size> + </OCR_RVCT10> + </OnChipMemories> + <RvctStartVector></RvctStartVector> + </ArmAdsMisc> + <Cads> + <interw>1</interw> + <Optim>7</Optim> + <oTime>0</oTime> + <SplitLS>0</SplitLS> + <OneElfS>1</OneElfS> + <Strict>0</Strict> + <EnumInt>0</EnumInt> + <PlainCh>0</PlainCh> + <Ropi>0</Ropi> + <Rwpi>0</Rwpi> + <wLevel>2</wLevel> + <uThumb>0</uThumb> + <uSurpInc>0</uSurpInc> + <uC99>1</uC99> + <useXO>0</useXO> + <v6Lang>3</v6Lang> + <v6LangP>3</v6LangP> + <vShortEn>1</vShortEn> + <vShortWch>1</vShortWch> + <v6Lto>0</v6Lto> + <v6WtE>0</v6WtE> + <v6Rtti>0</v6Rtti> + <VariousControls> + <MiscControls></MiscControls> + <Define>USE_FULL_LL_DRIVER,USE_HAL_DRIVER</Define> + <Undefine></Undefine> + <IncludePath>../Inc;../Src; ../Drivers/STM32F0xx_HAL_Driver/Inc; ../Drivers/CMSIS/Device/ST/STM32F0xx/Include; ../Drivers/CMSIS/Include; ../Drivers/STM32F0xx_HAL_Driver/Inc/Legacy</IncludePath> + </VariousControls> + </Cads> + <Aads> + <interw>1</interw> + <Ropi>0</Ropi> + <Rwpi>0</Rwpi> + <thumb>0</thumb> + <SplitLS>0</SplitLS> + <SwStkChk>0</SwStkChk> + <NoWarn>0</NoWarn> + <uSurpInc>0</uSurpInc> + <useXO>0</useXO> + <uClangAs>0</uClangAs> + <VariousControls> + <MiscControls></MiscControls> + <Define></Define> + <Undefine></Undefine> + <IncludePath></IncludePath> + </VariousControls> + </Aads> + <LDads> + <umfTarg>1</umfTarg> + <Ropi>0</Ropi> + <Rwpi>0</Rwpi> + <noStLib>0</noStLib> + <RepFail>1</RepFail> + <useFile>0</useFile> + <TextAddressRange>0x08000000</TextAddressRange> + <DataAddressRange>0x20000000</DataAddressRange> + <pXoBase></pXoBase> + <ScatterFile></ScatterFile> + <IncludeLibs></IncludeLibs> + <IncludeLibsPath></IncludeLibsPath> + <Misc></Misc> + <LinkerInputFile></LinkerInputFile> + <DisabledWarnings></DisabledWarnings> + </LDads> + </TargetArmAds> + </TargetOption> + <Groups> + <Group> + <GroupName>Application/MDK-ARM</GroupName> + <Files> + <File> + <FileName>startup_stm32f030x8.s</FileName> + <FileType>2</FileType> + <FilePath>.\startup_stm32f030x8.s</FilePath> + </File> + </Files> + </Group> + <Group> + <GroupName>Application/User</GroupName> + <Files> + <File> + <FileName>functions.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\functions.c</FilePath> + </File> + <File> + <FileName>GlobalDef.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\GlobalDef.c</FilePath> + </File> + <File> + <FileName>MyQueue.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\MyQueue.c</FilePath> + </File> + <File> + <FileName>shell.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\shell.c</FilePath> + </File> + <File> + <FileName>main.c</FileName> + <FileType>1</FileType> + <FilePath>../Src/main.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_it.c</FileName> + <FileType>1</FileType> + <FilePath>../Src/stm32f0xx_it.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_msp.c</FileName> + <FileType>1</FileType> + <FilePath>../Src/stm32f0xx_hal_msp.c</FilePath> + </File> + <File> + <FileName>BSP.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\BSP.c</FilePath> + </File> + <File> + <FileName>PLCfunctions.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\PLCfunctions.c</FilePath> + </File> + <File> + <FileName>KMachine.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\KMachine.c</FilePath> + </File> + <File> + <FileName>KBus.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\KBus.c</FilePath> + </File> + <File> + <FileName>KLink.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\KLink.c</FilePath> + </File> + <File> + <FileName>ModbusRTU.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\ModbusRTU.c</FilePath> + </File> + <File> + <FileName>FP0.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\FP0.c</FilePath> + </File> + <File> + <FileName>debug.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\debug.c</FilePath> + </File> + </Files> + </Group> + <Group> + <GroupName>Drivers/CMSIS</GroupName> + <Files> + <File> + <FileName>system_stm32f0xx.c</FileName> + <FileType>1</FileType> + <FilePath>..//Src/system_stm32f0xx.c</FilePath> + </File> + </Files> + </Group> + <Group> + <GroupName>Drivers/STM32F0xx_HAL_Driver</GroupName> + <Files> + <File> + <FileName>stm32f0xx_ll_gpio.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_gpio.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_ll_exti.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_exti.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_ll_adc.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_adc.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_ll_dma.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_dma.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_ll_spi.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_spi.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_tim.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_tim.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_tim_ex.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_tim_ex.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_ll_usart.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_usart.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_ll_rcc.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_rcc.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_rcc.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_rcc.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_rcc_ex.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_rcc_ex.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_i2c.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_i2c.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_i2c_ex.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_i2c_ex.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_gpio.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_gpio.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_dma.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_dma.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_cortex.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_cortex.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_pwr.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_pwr.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_pwr_ex.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_pwr_ex.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_flash.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_flash.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_flash_ex.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_flash_ex.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_ll_utils.c</FileName> + <FileType>1</FileType> + <FilePath>../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_utils.c</FilePath> + </File> + <File> + <FileName>stm32f0xx_ll_tim.c</FileName> + <FileType>1</FileType> + <FilePath>..\Drivers\STM32F0xx_HAL_Driver\Src\stm32f0xx_ll_tim.c</FilePath> + </File> + </Files> + </Group> + <Group> + <GroupName>Drivers/W5500</GroupName> + <Files> + <File> + <FileName>socket.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\Ethernet\socket.c</FilePath> + </File> + <File> + <FileName>wizchip_conf.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\Ethernet\wizchip_conf.c</FilePath> + </File> + <File> + <FileName>dns.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\Internet\DNS\dns.c</FilePath> + </File> + <File> + <FileName>dhcp.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\Internet\DHCP\dhcp.c</FilePath> + </File> + <File> + <FileName>w5500.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\Ethernet\W5500\w5500.c</FilePath> + </File> + <File> + <FileName>w5500_port.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\w5500_port.c</FilePath> + </File> + <File> + <FileName>loopback.c</FileName> + <FileType>1</FileType> + <FilePath>..\Src\Ethernet\loopback.c</FilePath> + </File> + </Files> + </Group> + <Group> + <GroupName>Inc</GroupName> + <Files> + <File> + <FileName>BSP.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\BSP.h</FilePath> + </File> + <File> + <FileName>debug.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\debug.h</FilePath> + </File> + <File> + <FileName>FP0.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\FP0.h</FilePath> + </File> + <File> + <FileName>functions.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\functions.h</FilePath> + </File> + <File> + <FileName>GlobalDef.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\GlobalDef.h</FilePath> + </File> + <File> + <FileName>KBus.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\KBus.h</FilePath> + </File> + <File> + <FileName>KLink.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\KLink.h</FilePath> + </File> + <File> + <FileName>KMachine.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\KMachine.h</FilePath> + </File> + <File> + <FileName>main.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\main.h</FilePath> + </File> + <File> + <FileName>ModbusRTU.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\ModbusRTU.h</FilePath> + </File> + <File> + <FileName>MyQueue.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\MyQueue.h</FilePath> + </File> + <File> + <FileName>PLCfunctions.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\PLCfunctions.h</FilePath> + </File> + <File> + <FileName>shell.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\shell.h</FilePath> + </File> + <File> + <FileName>stm32_assert.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\stm32_assert.h</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_conf.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\stm32f0xx_hal_conf.h</FilePath> + </File> + <File> + <FileName>stm32f0xx_it.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\stm32f0xx_it.h</FilePath> + </File> + <File> + <FileName>w5500_port.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\w5500_port.h</FilePath> + </File> + </Files> + </Group> + <Group> + <GroupName>::CMSIS</GroupName> + </Group> + </Groups> + </Target> + </Targets> + + <RTE> + <apis/> + <components> + <component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.4.0" condition="ARMv6_7_8-M Device"> + <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.7.0"/> + <targetInfos> + <targetInfo name="F030C8T6_Ext_FP0"/> + </targetInfos> + </component> + </components> + <files/> + </RTE> + +</Project> diff --git a/MDK-ARM/F030C8T6_KLink.uvprojx b/MDK-ARM/F030C8T6_KLink.uvprojx index 5fe14e9..4c4159e 100644 --- a/MDK-ARM/F030C8T6_KLink.uvprojx +++ b/MDK-ARM/F030C8T6_KLink.uvprojx @@ -7,7 +7,7 @@ <Targets> <Target> - <TargetName>F030C8T6_Test2</TargetName> + <TargetName>F030C8T6_Ext_FP0</TargetName> <ToolsetNumber>0x4</ToolsetNumber> <ToolsetName>ARM-ADS</ToolsetName> <pCCUsed>5060422::V5.06 update 4 (build 422)::ARMCC</pCCUsed> @@ -637,6 +637,96 @@ </Files> </Group> <Group> + <GroupName>Inc</GroupName> + <Files> + <File> + <FileName>BSP.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\BSP.h</FilePath> + </File> + <File> + <FileName>debug.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\debug.h</FilePath> + </File> + <File> + <FileName>FP0.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\FP0.h</FilePath> + </File> + <File> + <FileName>functions.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\functions.h</FilePath> + </File> + <File> + <FileName>GlobalDef.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\GlobalDef.h</FilePath> + </File> + <File> + <FileName>KBus.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\KBus.h</FilePath> + </File> + <File> + <FileName>KLink.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\KLink.h</FilePath> + </File> + <File> + <FileName>KMachine.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\KMachine.h</FilePath> + </File> + <File> + <FileName>main.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\main.h</FilePath> + </File> + <File> + <FileName>ModbusRTU.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\ModbusRTU.h</FilePath> + </File> + <File> + <FileName>MyQueue.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\MyQueue.h</FilePath> + </File> + <File> + <FileName>PLCfunctions.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\PLCfunctions.h</FilePath> + </File> + <File> + <FileName>shell.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\shell.h</FilePath> + </File> + <File> + <FileName>stm32_assert.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\stm32_assert.h</FilePath> + </File> + <File> + <FileName>stm32f0xx_hal_conf.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\stm32f0xx_hal_conf.h</FilePath> + </File> + <File> + <FileName>stm32f0xx_it.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\stm32f0xx_it.h</FilePath> + </File> + <File> + <FileName>w5500_port.h</FileName> + <FileType>5</FileType> + <FilePath>..\Inc\w5500_port.h</FilePath> + </File> + </Files> + </Group> + <Group> <GroupName>::CMSIS</GroupName> </Group> </Groups> @@ -649,7 +739,7 @@ <component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.4.0" condition="ARMv6_7_8-M Device"> <package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.7.0"/> <targetInfos> - <targetInfo name="F030C8T6_Test2"/> + <targetInfo name="F030C8T6_Ext_FP0"/> </targetInfos> </component> </components> diff --git a/MDK-ARM/JLinkLog.txt b/MDK-ARM/JLinkLog.txt index 5e84cdc..728c3f9 100644 --- a/MDK-ARM/JLinkLog.txt +++ b/MDK-ARM/JLinkLog.txt @@ -1,4 +1,5 @@ +<<<<<<< HEAD T2780 000:157 SEGGER J-Link V6.10i Log File (0002ms, 0039ms total) T2780 000:157 DLL Compiled: Oct 25 2016 19:31:51 (0002ms, 0039ms total) T2780 000:157 Logging started @ 2022-12-23 23:22 (0002ms, 0039ms total) @@ -2343,3 +2344,38 @@ T2780 003:290 JLINK_Close() -- CPU is running -- CPU_WriteMem(4 bytes @ 0xE0002008) -- CPU is running -- CPU_WriteMem(4 bytes @ 0xE000200C) -- CPU is running -- CPU_WriteMem(4 bytes @ 0xE0002010) -- CPU is running -- CPU_WriteMem(4 bytes @ 0xE0002014) >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x28 TIF> (0026ms, 1034ms total) T2780 003:290 (0026ms, 1034ms total) T2780 003:290 Closed (0026ms, 1034ms total) +======= +T11F0 000:622 SEGGER J-Link V6.10i Log File (0001ms, 0065ms total) +T11F0 000:622 DLL Compiled: Oct 25 2016 19:31:51 (0002ms, 0066ms total) +T11F0 000:622 Logging started @ 2022-12-13 18:37 (0002ms, 0066ms total) +T11F0 000:624 JLINK_SetWarnOutHandler(...) (0000ms, 0066ms total) +T11F0 000:624 JLINK_OpenEx(...) +Firmware: J-Link OB-STM32F072-CortexM compiled Sep 26 2016 10:03:56 +Hardware: V1.00 +Feature(s): GDB, RDI, FlashBP, FlashDL, JFlash, RDDIWEBSRV Webserver running on local port 19080 (0059ms, 0125ms total) +T11F0 000:624 returns O.K. (0059ms, 0125ms total) +T11F0 000:683 JLINK_SetErrorOutHandler(...) (0000ms, 0125ms total) +T11F0 000:683 JLINK_ExecCommand("ProjectFile = "D:\WORK\MCU&PCB\DIST_IO\F030C8T6_FP0\MDK-ARM\JLinkSettings.ini"", ...). Device "CORTEX-M0" selected. returns 0x00 (0170ms, 0295ms total) +T11F0 000:853 JLINK_ExecCommand("Device = STM32F030C8Tx", ...). Device "CORTEX-M0" selected. returns 0x00 (0018ms, 0313ms total) +T11F0 000:871 JLINK_ExecCommand("DisableConnectionTimeout", ...). returns 0x01 (0000ms, 0313ms total) +T11F0 000:871 JLINK_GetHardwareVersion() returns 0x2710 (0000ms, 0313ms total) +T11F0 000:871 JLINK_GetDLLVersion() returns 61009 (0000ms, 0313ms total) +T11F0 000:871 JLINK_GetFirmwareString(...) (0000ms, 0313ms total) +T11F0 000:871 JLINK_GetDLLVersion() returns 61009 (0000ms, 0313ms total) +T11F0 000:871 JLINK_GetCompileDateTime() (0000ms, 0313ms total) +T11F0 000:871 JLINK_GetFirmwareString(...) (0000ms, 0313ms total) +T11F0 000:871 JLINK_GetHardwareVersion() returns 0x2710 (0000ms, 0313ms total) +T11F0 000:871 JLINK_TIF_Select(JLINKARM_TIF_SWD) returns 0x00 (0001ms, 0314ms total) +T11F0 000:872 JLINK_SetSpeed(5000) (0001ms, 0315ms total) +T11F0 000:873 JLINK_SetResetType(JLINKARM_RESET_TYPE_NORMAL) returns JLINKARM_RESET_TYPE_NORMAL (0000ms, 0315ms total) +T11F0 000:873 JLINK_Reset() >0x108 TIF>Found SWD-DP with ID 0x2BA01477 >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF>AP-IDR: 0x24770011, Type: AHB-AP >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x21 TIF> +Found Cortex-M4 r0p1, Little endian.Identified core does not match configuration. (Found: Cortex-M4, Configured: Cortex-M0) -- CPU_ReadMem(4 bytes @ 0xE000EDF0) -- CPU_ReadMem(4 bytes @ 0xE0002000)FPUnit: 6 code (BP) slots and 2 literal slots -- CPU_ReadMem(4 bytes @ 0xE000EDFC) -- CPU_WriteMem(4 bytes @ 0xE000EDFC) -- CPU_ReadMem(4 bytes @ 0xE0001000) -- CPU_WriteMem(4 bytes @ 0xE0001000) -- CPU_ReadMem(4 bytes @ 0xE000ED88) -- CPU_WriteMem(4 bytes @ 0xE000ED88) -- CPU_ReadMem(4 bytes @ 0xE000ED88) + -- CPU_WriteMem(4 bytes @ 0xE000ED88)CoreSight components:ROMTbl 0 @ E00FF000 -- CPU_ReadMem(16 bytes @ 0xE00FF000) -- CPU_ReadMem(16 bytes @ 0xE000EFF0) -- CPU_ReadMem(16 bytes @ 0xE000EFE0)ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB00C SCS -- CPU_ReadMem(16 bytes @ 0xE0001FF0) -- CPU_ReadMem(16 bytes @ 0xE0001FE0)ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 003BB002 DWT -- CPU_ReadMem(16 bytes @ 0xE0002FF0) -- CPU_ReadMem(16 bytes @ 0xE0002FE0) +ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 002BB003 FPB -- CPU_ReadMem(16 bytes @ 0xE0000FF0) -- CPU_ReadMem(16 bytes @ 0xE0000FE0)ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 003BB001 ITM -- CPU_ReadMem(16 bytes @ 0xE00FF010) -- CPU_ReadMem(16 bytes @ 0xE0040FF0) -- CPU_ReadMem(16 bytes @ 0xE0040FE0)ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 000BB9A1 TPIU -- CPU is running -- CPU_WriteMem(4 bytes @ 0xE000EDF0) -- CPU is running -- CPU_WriteMem(4 bytes @ 0xE000EDFC) >0x35 TIF> -- CPU is running + -- CPU_WriteMem(4 bytes @ 0xE000ED0C) -- CPU is running -- CPU_ReadMem(4 bytes @ 0xE000EDF0) -- CPU is running -- CPU_ReadMem(4 bytes @ 0xE000EDF0) -- CPU is running -- CPU_WriteMem(4 bytes @ 0xE000EDF0) -- CPU is running -- CPU_WriteMem(4 bytes @ 0xE000EDFC) -- CPU is running -- CPU_ReadMem(4 bytes @ 0xE000EDF0) -- CPU_WriteMem(4 bytes @ 0xE0002000) -- CPU_ReadMem(4 bytes @ 0xE000EDFC) -- CPU_ReadMem(4 bytes @ 0xE0001000) (0047ms, 0362ms total) +T11F0 000:920 JLINK_GetId() >0x0D TIF> >0x21 TIF> returns 0x2BA01477 (0001ms, 0363ms total) +T11F0 000:937 JLINK_GetFirmwareString(...) (0000ms, 0363ms total) +T11F0 020:597 JLINK_Close() -- CPU_ReadMem(4 bytes @ 0xE0001000) -- CPU_WriteMem(4 bytes @ 0xE0001004) >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x28 TIF> >0x0D TIF> >0x21 TIF> >0x0D TIF> >0x28 TIF> (0026ms, 0389ms total) +T11F0 020:597 (0026ms, 0389ms total) +T11F0 020:597 Closed (0026ms, 0389ms total) +>>>>>>> origin/FP0 diff --git a/MDK-ARM/RTE/_F030C8T6_Ext_FP0/RTE_Components.h b/MDK-ARM/RTE/_F030C8T6_Ext_FP0/RTE_Components.h new file mode 100644 index 0000000..d6b4a83 --- /dev/null +++ b/MDK-ARM/RTE/_F030C8T6_Ext_FP0/RTE_Components.h @@ -0,0 +1,20 @@ + +/* + * Auto generated Run-Time-Environment Component Configuration File + * *** Do not modify ! *** + * + * Project: 'F030C8T6_Ext_FP0' + * Target: 'F030C8T6_Ext_FP0' + */ + +#ifndef RTE_COMPONENTS_H +#define RTE_COMPONENTS_H + + +/* + * Define the Device Header File: + */ +#define CMSIS_device_header "stm32f0xx.h" + + +#endif /* RTE_COMPONENTS_H */ diff --git a/MDK-ARM/pemicro_connection_settings.ini b/MDK-ARM/pemicro_connection_settings.ini new file mode 100644 index 0000000..1fe1c3b --- /dev/null +++ b/MDK-ARM/pemicro_connection_settings.ini @@ -0,0 +1,3 @@ +[STARTUP] +CPUTARGETTYPENAME= + diff --git a/Src/BSP.c b/Src/BSP.c index f2e255c..e312c08 100644 --- a/Src/BSP.c +++ b/Src/BSP.c @@ -596,10 +596,11 @@ PA2 ------> USART2_TX PA3 ------> USART2_RX */ + GPIO_InitStruct.Pin = LL_GPIO_PIN_1|LL_GPIO_PIN_2|LL_GPIO_PIN_3; GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; - GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; + GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; GPIO_InitStruct.Alternate = LL_GPIO_AF_1; LL_GPIO_Init(GPIOA, &GPIO_InitStruct); diff --git a/Src/FP0.c b/Src/FP0.c index 326fbec..70a386e 100644 --- a/Src/FP0.c +++ b/Src/FP0.c @@ -22,7 +22,7 @@ uint8_t bSentLen; uint8_t bConfiged=0; -uint8_t nConfigAddr=0; +uint8_t nConfigStationId=0; uint8_t nInputBytes=8; uint8_t nOutputBytes=8; uint8_t nIndex=0; @@ -99,8 +99,8 @@ } } if (CurSYN ==0 && oldSYN != 0) { - KMem.SDT[121] = KMem.SDT[122]; - KMem.SDT[122]=0; + KMem.WDT[121] = KMem.WDT[122]; + KMem.WDT[122]=0; } if (CurSEL && CurSYN !=0 && oldSYN == 0){ bSPI1Recving=1; @@ -156,15 +156,15 @@ uint8_t res=0; uint8_t nST=pBuf[0]; uint8_t nCMD=nST&0x7; - uint8_t nAddr=nST&0xf8; - KMem.SDB[128+KMem.SDT[123]] = 0xFF; - KMem.SDT[123]++; if (KMem.SDT[123]>=100) {KMem.SDT[123]=81;} + uint8_t nStationID=nST&0xf8; - if (nAddr<0x80) return 0; + logData(0xff); + + if (nStationID<0x80) return 0; switch (nCMD) { case CMD_0_QUERY: - if (!bConfiged || (bConfiged && nAddr == nConfigAddr)) + if (!bConfiged || (bConfiged && nStationID == nConfigStationId)) { KMem.DT[8]++; pFP0QuRplyPkg p1 = (pFP0QuRplyPkg)PkgBuf2; @@ -175,11 +175,10 @@ p1->nBCC= 0x30|CalFP0BCC(PkgBuf2,4); p1->End1=0x0d; - KMem.SDB[128+KMem.SDT[123]] = 0x11; - KMem.SDT[123]++; if (KMem.SDT[123]>=100) {KMem.SDT[123]=81;} + logData(0x11); SendFP0Pkg(PkgBuf2,sizeof(stFP0QuRplyPkg)); - nConfigAddr=nAddr; + nConfigStationId=nStationID; bConfiged=1; } bSPI1Recving=1; @@ -193,7 +192,7 @@ // bSPI1Recving=1; break; case CMD_3_EXCHG: - if (!bConfiged || nConfigAddr != nAddr) + if (!bConfiged || nConfigStationId != nStationID) { bSPI1Recving=1; break; @@ -238,7 +237,7 @@ break; case CMD_7_END: KMem.DT[15]++; - if (bConfiged && nConfigAddr == nAddr) + if (bConfiged && nConfigStationId == nStationID) { //SetFP0DEPin_0(); SetACKPin_1(); @@ -272,8 +271,9 @@ value = SPI1SendBuf[nSPI1SentLen]; LL_SPI_TransmitData8(SPI1,value); bSPI1Sending=1; - KMem.SDB[128+KMem.SDT[123]] = value; - KMem.SDT[123]++; if (KMem.SDT[123]>=100) {KMem.SDT[123]=81;} + + logData(value); + // passive mode SetFP0DEPin_1(); SetACKPin_0(); diff --git a/Src/KBus.c b/Src/KBus.c index d52082b..f51509d 100644 --- a/Src/KBus.c +++ b/Src/KBus.c @@ -17,22 +17,22 @@ unsigned char BufferIn[16]={0}; unsigned char BufferOut[16]={0}; -stChnStat ChnStats[8]; -unsigned char nAddr=0; +stChnStat KBusChnStats[8]; +unsigned char nStationID=0; unsigned char nChilds; int ChildStat[16]; unsigned char nCurPollId=0; unsigned char nSeq=0; -volatile unsigned char MasterRecved=1; -volatile unsigned char MasterRecvOK=1; +volatile unsigned char KBusMasterRecved=1; +volatile unsigned char KBusMasterRecvOK=1; -volatile unsigned char SlaveRecved=1; -unsigned int SendTimeuS=0; -volatile int RecvTimeuS=0; +volatile unsigned char KBusSlaveRecved=1; +unsigned int KBusSendTimeuS=0; +volatile int KBusRecvTimeuS=0; -int DelayuS=0; -int MaxDelayuS=0; +int KBusDelayuS=0; +int KBusMaxDelayuS=0; int ThisuS; volatile unsigned int nSlaveTick=0; @@ -58,7 +58,7 @@ return k; } -int KBusMakePacket(pPacket p1,unsigned char src, uchar dst, uchar nType,unsigned char nSEQ, unsigned char DataLen,void * pData ) +int KBusMakePacket(pKBPacket p1,unsigned char src, uchar dst, uchar nType,unsigned char nSEQ, unsigned char DataLen,void * pData ) { p1->Sign=StartSign; p1->DstHost=dst; @@ -73,17 +73,17 @@ case cmdPing: p1->PacketLen=DataLen; memcpy(p1->data,pData,DataLen); - p1->data[DataLen]=KBusBCC(p1,sizeof(stPacket)+DataLen-1); + p1->data[DataLen]=KBusBCC(p1,sizeof(stKBPacket)+DataLen-1); p1->data[DataLen+1]=EndSign; - PacketLenth=sizeof(stPacket)+DataLen+1; + PacketLenth=sizeof(stKBPacket)+DataLen+1; break; case cmdPingReply: p1->PacketLen=DataLen; memcpy(p1->data,pData,DataLen); - p1->data[DataLen]=KBusBCC(p1,sizeof(stPacket)+DataLen-1); + p1->data[DataLen]=KBusBCC(p1,sizeof(stKBPacket)+DataLen-1); p1->data[DataLen+1]=EndSign; - PacketLenth=sizeof(stPacket)+DataLen+1; + PacketLenth=sizeof(stKBPacket)+DataLen+1; break; case cmdRead: break; @@ -94,67 +94,67 @@ case cmdWriteReply: p1->PacketLen=DataLen; if (DataLen !=0 ) memcpy(p1->data,pData,DataLen); - p1->data[DataLen]=KBusBCC(p1,sizeof(stPacket)+DataLen-1); + p1->data[DataLen]=KBusBCC(p1,sizeof(stKBPacket)+DataLen-1); p1->data[DataLen+1]=EndSign; - PacketLenth=sizeof(stPacket)+DataLen+1; + PacketLenth=sizeof(stKBPacket)+DataLen+1; break; case cmdGetVersion: p1->PacketLen=DataLen; memcpy(p1->data,pData,DataLen); - p1->data[DataLen]=KBusBCC(p1,sizeof(stPacket)+DataLen-1); + p1->data[DataLen]=KBusBCC(p1,sizeof(stKBPacket)+DataLen-1); p1->data[DataLen+1]=EndSign; - PacketLenth=sizeof(stPacket)+DataLen+1; + PacketLenth=sizeof(stKBPacket)+DataLen+1; break; case cmdVerInfo: p1->PacketLen=DataLen; memcpy(p1->data,pData,DataLen); - p1->data[DataLen]=KBusBCC(p1,sizeof(stPacket)+DataLen-1); + p1->data[DataLen]=KBusBCC(p1,sizeof(stKBPacket)+DataLen-1); p1->data[DataLen+1]=EndSign; - PacketLenth=sizeof(stPacket)+DataLen+1; + PacketLenth=sizeof(stKBPacket)+DataLen+1; break; case cmdExChgData: p1->PacketLen=DataLen; memcpy(p1->data,pData,DataLen); - p1->data[DataLen]=KBusBCC(p1,sizeof(stPacket)+DataLen-1); + p1->data[DataLen]=KBusBCC(p1,sizeof(stKBPacket)+DataLen-1); p1->data[DataLen+1]=EndSign; - PacketLenth=sizeof(stPacket)+DataLen+1; + PacketLenth=sizeof(stKBPacket)+DataLen+1; break; case cmdExChgDataReply: p1->PacketLen=DataLen; memcpy(p1->data,pData,DataLen); - p1->data[DataLen]=KBusBCC(p1,sizeof(stPacket)+DataLen-1); + p1->data[DataLen]=KBusBCC(p1,sizeof(stKBPacket)+DataLen-1); p1->data[DataLen+1]=EndSign; - PacketLenth=sizeof(stPacket)+DataLen+1; + PacketLenth=sizeof(stKBPacket)+DataLen+1; break; case cmdSyncRead: p1->PacketLen=DataLen; memcpy(p1->data,pData,DataLen); - p1->data[DataLen]=KBusBCC(p1,sizeof(stPacket)+DataLen-1); + p1->data[DataLen]=KBusBCC(p1,sizeof(stKBPacket)+DataLen-1); p1->data[DataLen+1]=EndSign; - PacketLenth=sizeof(stPacket)+DataLen+1; + PacketLenth=sizeof(stKBPacket)+DataLen+1; break; case cmdSyncWrite: p1->PacketLen=DataLen; memcpy(p1->data,pData,DataLen); - p1->data[DataLen]=KBusBCC(p1,sizeof(stPacket)+DataLen-1); + p1->data[DataLen]=KBusBCC(p1,sizeof(stKBPacket)+DataLen-1); p1->data[DataLen+1]=EndSign; - PacketLenth=sizeof(stPacket)+DataLen+1; + PacketLenth=sizeof(stKBPacket)+DataLen+1; break; case cmdSequenRead: p1->PacketLen=DataLen; memcpy(p1->data,pData,DataLen); - p1->data[DataLen]=KBusBCC(p1,sizeof(stPacket)+DataLen-1); + p1->data[DataLen]=KBusBCC(p1,sizeof(stKBPacket)+DataLen-1); p1->data[DataLen+1]=EndSign; - PacketLenth=sizeof(stPacket)+DataLen+1; + PacketLenth=sizeof(stKBPacket)+DataLen+1; break; case cmdSyncTime: p1->PacketLen=DataLen; memcpy(p1->data,pData,DataLen); - p1->data[DataLen]=KBusBCC(p1,sizeof(stPacket)+DataLen-1); + p1->data[DataLen]=KBusBCC(p1,sizeof(stKBPacket)+DataLen-1); p1->data[DataLen+1]=EndSign; - PacketLenth=sizeof(stPacket)+DataLen+1; + PacketLenth=sizeof(stKBPacket)+DataLen+1; break; default: @@ -164,90 +164,90 @@ return PacketLenth; } -int KBusCheckPacket(int nChn, pPacket p1, int nLen1) +int KBusCheckPacket(int nChn, pKBPacket p1, int nLen1) { if (p1->Sign != StartSign) { Uart2Stat.NotPacketErr++; - ChnStats[nCurPollId].NotPkgErr++; + KBusChnStats[nCurPollId].NotPkgErr++; return -1; } int DataLen=p1->PacketLen; if (DataLen>MaxPacketLength) { Uart2Stat.LengthErr++; - ChnStats[nCurPollId].PkgLenErr++; + KBusChnStats[nCurPollId].PkgLenErr++; return -1; } - if (nLen1<DataLen+sizeof(stPacket)+1) + if (nLen1<DataLen+sizeof(stKBPacket)+1) { - //len4=sprintf(str3,"%d < %d + %d \r\n",len2,DataLen,sizeof(stPacket)); + //len4=sprintf(str3,"%d < %d + %d \r\n",len2,DataLen,sizeof(stKBPacket)); //PutStr(str3,len4); - ChnStats[nCurPollId].PkgLenErr++; + KBusChnStats[nCurPollId].PkgLenErr++; Uart2Stat.LengthErr++; return -3; //not long enough } // if (p1->data[DataLen+1] != EndSign) // { -// ChnStats[nCurPollId].NoEndErr++; +// KBusChnStats[nCurPollId].NoEndErr++; // Uart2Stat.LengthErr++; // return -2; // } - unsigned char thisBCC=KBusBCC(p1,sizeof(stPacket)+DataLen-1); + unsigned char thisBCC=KBusBCC(p1,sizeof(stKBPacket)+DataLen-1); if (thisBCC != p1->data[DataLen]) {//BCC Error; Uart2Stat.BCCerr++; - ChnStats[nCurPollId].BCCErr++; + KBusChnStats[nCurPollId].BCCErr++; return -4; } return 0; } -int KBusSlaveCheckPacket(int nChn, pPacket p1, int nLen1) +int KBusSlaveCheckPacket(int nChn, pKBPacket p1, int nLen1) { if (p1->Sign != StartSign) { Uart2Stat.NotPacketErr++; - ChnStats[0].ClientNotPktErr++; + KBusChnStats[0].ClientNotPktErr++; return -1; } int DataLen=p1->PacketLen; if (DataLen>MaxPacketLength) { Uart2Stat.LengthErr++; - ChnStats[0].ClientPkgLenErr++; + KBusChnStats[0].ClientPkgLenErr++; return -1; } - if (nLen1<DataLen+sizeof(stPacket)+1) + if (nLen1<DataLen+sizeof(stKBPacket)+1) { - //len4=sprintf(str3,"%d < %d + %d \r\n",len2,DataLen,sizeof(stPacket)); + //len4=sprintf(str3,"%d < %d + %d \r\n",len2,DataLen,sizeof(stKBPacket)); //PutStr(str3,len4); - ChnStats[0].ClientPkgLenErr++; + KBusChnStats[0].ClientPkgLenErr++; Uart2Stat.LengthErr++; return -3; //not long enough } // if (p1->data[DataLen+1] != EndSign) // { -// ChnStats[nCurPollId].NoEndErr++; +// KBusChnStats[nCurPollId].NoEndErr++; // Uart2Stat.LengthErr++; // return -2; // } - unsigned char thisBCC=KBusBCC(p1,sizeof(stPacket)+DataLen-1); + unsigned char thisBCC=KBusBCC(p1,sizeof(stKBPacket)+DataLen-1); if (thisBCC != p1->data[DataLen]) {//BCC Error; Uart2Stat.BCCerr++; - ChnStats[0].ClientBccErr++; + KBusChnStats[0].ClientBccErr++; return -4; } return 0; } -int KBusMasterParsePacket(int nChn, pPacket p1, int Len1) +int KBusMasterParsePacket(int nChn, pKBPacket p1, int Len1) { int DataLen=p1->PacketLen; - ChnStats[nCurPollId].RecvPackets++; - pPacket p2=(pPacket)PacketBuf2; + KBusChnStats[nCurPollId].RecvPackets++; + pKBPacket p2=(pKBPacket)PacketBuf2; int PacketLen=0; //LL_GPIO_TogglePin(GPIOA,LL_GPIO_PIN_6); int ChildId=p1->SrcAddr; @@ -263,18 +263,18 @@ SendPacket(nChn, p2, PacketLen); break; case cmdPingReply: - DelayuS=ThisuS-SendTimeuS; - if (DelayuS > MaxDelayuS) MaxDelayuS = DelayuS; + KBusDelayuS=ThisuS-KBusSendTimeuS; + if (KBusDelayuS > KBusMaxDelayuS) KBusMaxDelayuS = KBusDelayuS; BufferIn[ChildId]=p1->data[0]; //RunStat=100; - ChnStats[nCurPollId].CtnLstPkts=0; - ChnStats[nCurPollId].Delay=DelayuS; - if (DelayuS > ChnStats[nCurPollId].MaxDelay) - ChnStats[nCurPollId].MaxDelay=DelayuS; + KBusChnStats[nCurPollId].CtnLstPkts=0; + KBusChnStats[nCurPollId].Delay=KBusDelayuS; + if (KBusDelayuS > KBusChnStats[nCurPollId].MaxDelay) + KBusChnStats[nCurPollId].MaxDelay=KBusDelayuS; //PutOutput(outputvalue); - MasterRecvOK=1; + KBusMasterRecvOK=1; break; case cmdRead: break; @@ -283,7 +283,7 @@ case cmdWrite: break; case cmdWriteReply: - MasterRecved=1; + KBusMasterRecved=1; break; case cmdGetVersion: break; @@ -294,12 +294,12 @@ //PutOutput(outputvalue); //memcpy(DispBuf,p1->data+2,8); p1->data[0]=BufferOut[0]; - PacketLen=KBusMakePacket(p2,nAddr,0,cmdExChgDataReply,p1->nSEQ,DataLen,p1->data); + PacketLen=KBusMakePacket(p2,nStationID,0,cmdExChgDataReply,p1->nSEQ,DataLen,p1->data); SendPacket(nChn, p2, PacketLen); break; case cmdExChgDataReply: - DelayuS=ThisuS-SendTimeuS; - if (DelayuS > MaxDelayuS) MaxDelayuS = DelayuS; + KBusDelayuS=ThisuS-KBusSendTimeuS; + if (KBusDelayuS > KBusMaxDelayuS) KBusMaxDelayuS = KBusDelayuS; #if (BOARD_TYPE == 14) BufferIn[ChildId]=p1->data[0]; @@ -318,17 +318,17 @@ #endif //RunStat=100; - ChnStats[nCurPollId].CtnLstPkts=0; - ChnStats[nCurPollId].Delay=DelayuS; - if (DelayuS > ChnStats[nCurPollId].MaxDelay) - ChnStats[nCurPollId].MaxDelay=DelayuS; + KBusChnStats[nCurPollId].CtnLstPkts=0; + KBusChnStats[nCurPollId].Delay=KBusDelayuS; + if (KBusDelayuS > KBusChnStats[nCurPollId].MaxDelay) + KBusChnStats[nCurPollId].MaxDelay=KBusDelayuS; //PutOutput(outputvalue); nIndex=p1->data[3]; - ChnStats[nCurPollId].ClientDatas[nIndex]=p1->data[4]|(p1->data[5]<<8)|(p1->data[6]<<16)|(p1->data[7]<<24); + KBusChnStats[nCurPollId].ClientDatas[nIndex]=p1->data[4]|(p1->data[5]<<8)|(p1->data[6]<<16)|(p1->data[7]<<24); - MasterRecvOK=1; + KBusMasterRecvOK=1; break; @@ -343,28 +343,28 @@ return 0; } unsigned char nClientDataIndex=0; -int KBusSlaveParsePacket(int nChn, pPacket p1, int Len1) +int KBusSlaveParsePacket(int nChn, pKBPacket p1, int Len1) { Uart2Stat.OKPacket++; int DataLen=p1->PacketLen; //int nSrcAddr=p1->SrcAddr; int nDstHost=p1->DstHost; -// RecvTimeuS=ThisuS; -// SlaveRecved=1; +// KBusRecvTimeuS=ThisuS; +// KBusSlaveRecved=1; - pPacket p2=(pPacket)PacketBuf2; + pKBPacket p2=(pKBPacket)PacketBuf2; int PacketLen=0; unsigned char nIndex = p1->nSEQ & 0x07; - if (nDstHost!=nAddr && nDstHost != 0xff) + if (nDstHost!=nStationID && nDstHost != 0xff) { - ChnStats[0].ClientMisIdPkts++; + KBusChnStats[0].ClientMisIdPkts++; return -1; } - if (nDstHost==nAddr || nDstHost==0xff) + if (nDstHost==nStationID || nDstHost==0xff) { - RecvTimeuS=ThisuS; - SlaveRecved=1; + KBusRecvTimeuS=ThisuS; + KBusSlaveRecved=1; switch (p1->nCMD) { case cmdNone: @@ -374,9 +374,9 @@ //PutOutput(outputvalue); //memcpy(DispBuf,p1->data+2,8); p1->data[0]=BufferOut[0]; - RecvTimeuS=ThisuS; - PacketLen=KBusMakePacket(p2,nAddr,0,cmdPingReply,p1->nSEQ,DataLen,p1->data); - ChnStats[0].ClientSendPkts++; + KBusRecvTimeuS=ThisuS; + PacketLen=KBusMakePacket(p2,nStationID,0,cmdPingReply,p1->nSEQ,DataLen,p1->data); + KBusChnStats[0].ClientSendPkts++; SendPacket(nChn, p2, PacketLen); break; case cmdPingReply: @@ -388,7 +388,7 @@ case cmdWrite: //memcpy(DispBuf,p1->data,DataLen); PacketLen=KBusMakePacket(p2,1,0,cmdWriteReply,p1->nSEQ,0,0); - ChnStats[0].ClientSendPkts++; + KBusChnStats[0].ClientSendPkts++; SendPacket(nChn, p2, PacketLen); break; case cmdWriteReply: @@ -405,7 +405,7 @@ //PutOutput(outputvalue); //memcpy(DispBuf,p1->data+2,8); nIndex=nClientDataIndex; - // ChnStats[0].ClientDatas[7]++; + // KBusChnStats[0].ClientDatas[7]++; // BufferOut[0]=GetInput(); // BufferOut[0]=GetInput(); #else @@ -413,20 +413,20 @@ //PutOutput(outputvalue); //memcpy(DispBuf,p1->data+2,8); nIndex=nClientDataIndex; - // ChnStats[0].ClientDatas[7]++; + // KBusChnStats[0].ClientDatas[7]++; // BufferOut[0]=GetInput(); BufferOut[0]=GetInput(); #endif p1->data[0]=BufferOut[0]; p1->data[3]=nIndex; - p1->data[4]=ChnStats[0].ClientDatas[nIndex]; - p1->data[5]=ChnStats[0].ClientDatas[nIndex]>>8; - p1->data[6]=ChnStats[0].ClientDatas[nIndex]>>16; - p1->data[7]=ChnStats[0].ClientDatas[nIndex]>>24; + p1->data[4]=KBusChnStats[0].ClientDatas[nIndex]; + p1->data[5]=KBusChnStats[0].ClientDatas[nIndex]>>8; + p1->data[6]=KBusChnStats[0].ClientDatas[nIndex]>>16; + p1->data[7]=KBusChnStats[0].ClientDatas[nIndex]>>24; nClientDataIndex++; if (nClientDataIndex >= 10) { nClientDataIndex=0;} - PacketLen=KBusMakePacket(p2,nAddr,0,cmdExChgDataReply,p1->nSEQ,DataLen,p1->data); - ChnStats[0].ClientSendPkts++; + PacketLen=KBusMakePacket(p2,nStationID,0,cmdExChgDataReply,p1->nSEQ,DataLen,p1->data); + KBusChnStats[0].ClientSendPkts++; SendPacket(nChn, p2, PacketLen); break; case cmdExChgDataReply: @@ -448,37 +448,37 @@ } return 0; } -int KBusParsePacket(int nChn, pPacket p1, int Len1) +int KBusParsePacket(int nChn, pKBPacket p1, int Len1) { ThisuS=GetuS(); int Result=0; if (bKBusMaster) { - MasterRecved=1; + KBusMasterRecved=1; Result=KBusCheckPacket(nChn, p1, Len1); if (Result != S_OK) { return Result; } - MasterRecvOK=1; + KBusMasterRecvOK=1; Result=KBusMasterParsePacket(nChn, p1, Len1); return Result; } if (bKBusSlave) { - ChnStats[0].ClientRecvPkts++; + KBusChnStats[0].ClientRecvPkts++; Result=KBusSlaveCheckPacket(nChn, p1, Len1); if (Result != S_OK) { return Result; } - ChnStats[0].ClientTimeOutErr=KMem.RunStat; + KBusChnStats[0].ClientTimeOutErr=KMem.RunStat; Result=KBusSlaveParsePacket(nChn, p1, Len1); return Result; } //int len1=p1->PacketLen; // if (p1->DstHost!=255&&p1->DstHost!=2) return -3; -// pPacket p2=(pPacket)PacketBuf2; +// pKBPacket p2=(pKBPacket)PacketBuf2; // Uart2Stat.OKPacket++; return Result; @@ -544,20 +544,20 @@ int len1=0; - if ((MasterRecved && MasterRecvOK && thisuS-SendTimeuS>50) || thisuS-SendTimeuS>1000u) + if ((KBusMasterRecved && KBusMasterRecvOK && thisuS-KBusSendTimeuS>50) || thisuS-KBusSendTimeuS>1000u) { - if (!MasterRecvOK) + if (!KBusMasterRecvOK) { TimeOutCount++; Uart2Stat.TimeOutErr++; - ChnStats[nCurPollId].LostPackets++; - ChnStats[nCurPollId].CtnLstPkts++; - if (!MasterRecved) {ChnStats[nCurPollId].TimeOutErr++;} - if (ChnStats[nCurPollId].CtnLstPkts>ChnStats[nCurPollId].MaxCtnLstPkts) - {ChnStats[nCurPollId].MaxCtnLstPkts=ChnStats[nCurPollId].CtnLstPkts;} - if (ChnStats[nCurPollId].CtnLstPkts>3) + KBusChnStats[nCurPollId].LostPackets++; + KBusChnStats[nCurPollId].CtnLstPkts++; + if (!KBusMasterRecved) {KBusChnStats[nCurPollId].TimeOutErr++;} + if (KBusChnStats[nCurPollId].CtnLstPkts>KBusChnStats[nCurPollId].MaxCtnLstPkts) + {KBusChnStats[nCurPollId].MaxCtnLstPkts=KBusChnStats[nCurPollId].CtnLstPkts;} + if (KBusChnStats[nCurPollId].CtnLstPkts>3) { - ChnStats[nCurPollId].Stat=0; + KBusChnStats[nCurPollId].Stat=0; KMem.ErrStat=200; {BufferIn[nCurPollId]=0;} @@ -565,7 +565,7 @@ // LL_GPIO_SetOutputPin(GPIOA,LL_GPIO_PIN_7); }else { - ChnStats[nCurPollId].Stat=1; + KBusChnStats[nCurPollId].Stat=1; KMem.RunStat=100; } @@ -599,24 +599,24 @@ Datas[0]=BufferOut[nCurPollId]; Datas[1]=BufferOut[nCurPollId+1];; - Datas[2]=ChnStats[nCurPollId].Stat; + Datas[2]=KBusChnStats[nCurPollId].Stat; Datas[3]=0; Datas[4]=tick1&0xff; Datas[5]=(tick1>>8)&0xff; Datas[6]=(tick1>>16)&0xff; Datas[7]=(tick1>>24)&0xff; - SendTimeuS=thisuS; - len1=KBusMakePacket((pPacket)PacketBuf1,0,nCurPollId,cmdExChgData,nSeq,8,Datas); - SendPacket(nChn, (pPacket)PacketBuf1, len1); - ChnStats[nCurPollId].SendPackets++; - ChnStats[nCurPollId].SendTimeInterval=SendTimeuS-ChnStats[nCurPollId].LastSentTimeuS; - ChnStats[nCurPollId].LastSentTimeuS=SendTimeuS; + KBusSendTimeuS=thisuS; + len1=KBusMakePacket((pKBPacket)PacketBuf1,0,nCurPollId,cmdExChgData,nSeq,8,Datas); + SendPacket(nChn, (pKBPacket)PacketBuf1, len1); + KBusChnStats[nCurPollId].SendPackets++; + KBusChnStats[nCurPollId].SendTimeInterval=KBusSendTimeuS-KBusChnStats[nCurPollId].LastSentTimeuS; + KBusChnStats[nCurPollId].LastSentTimeuS=KBusSendTimeuS; // PacketLength = len1; SendTime=tick1; - MasterRecved=0; - MasterRecvOK=0; + KBusMasterRecved=0; + KBusMasterRecvOK=0; // LL_GPIO_TogglePin(GPIOA,LL_GPIO_PIN_5); //ToggleErrLed(); // ToggleOut8(); @@ -632,23 +632,23 @@ int KBusSlaveFunc(int nChn) { int ThisuS=GetuS(); - int thisRecvTime=RecvTimeuS; - if (SlaveRecved) + int thisRecvTime=KBusRecvTimeuS; + if (KBusSlaveRecved) { KMem.RunStat=8000; - SlaveRecved=0; + KBusSlaveRecved=0; }else if ((ThisuS - thisRecvTime) >12000u) { KMem.ErrStat=8000; KMem.SDD[17]=1; KMem.SDD[18]=ThisuS; - KMem.SDD[19]=RecvTimeuS; + KMem.SDD[19]=KBusRecvTimeuS; }else if ( ThisuS > (thisRecvTime + 12000u)) { KMem.ErrStat=8000; KMem.SDD[17]=2; KMem.SDD[18]=ThisuS; - KMem.SDD[19]=RecvTimeuS; + KMem.SDD[19]=KBusRecvTimeuS; } return 0; diff --git a/Src/KLink.c b/Src/KLink.c index da4fd03..623fba0 100644 --- a/Src/KLink.c +++ b/Src/KLink.c @@ -16,7 +16,7 @@ unsigned char KLBufferIn[16]={0}; unsigned char KLBufferOut[16]={0}; -unsigned char nKLAddr=1; +unsigned char nKLStationId=1; unsigned char nKLSeq=0; unKLStat nKLStatus ={0}; @@ -61,7 +61,7 @@ case KLCmdRead: // case KLCmdReadReply: //p1->data[DataLen+1]=KLEndSign; - //PacketLenth=sizeof(stPacket)+DataLen+1; + //PacketLenth=sizeof(stKBPacket)+DataLen+1; break; case KLCmdWrite: // case KLCmdWriteReply: @@ -91,13 +91,13 @@ } if (nLen1<DataLen+sizeof(stKLReqPktHdr)) { - //len4=sprintf(str3,"%d < %d + %d \r\n",len2,DataLen,sizeof(stPacket)); + //len4=sprintf(str3,"%d < %d + %d \r\n",len2,DataLen,sizeof(stKBPacket)); //PutStr(str3,len4); return 3; //not long enough } // if (p1->data[DataLen+1] != EndSign) // { -// ChnStats[nCurPollId].NoEndErr++; +// KBusChnStats[nCurPollId].NoEndErr++; // Uart2Stat.LengthErr++; // return -2; // } @@ -129,11 +129,13 @@ { pKLReqPktHdr p1 = (pKLReqPktHdr)pBuf; - int nDstHost=p1->DstHost; + unsigned char nDstHost=p1->DstHost; KLRecvTimeuS=KLThisuS; - int nDataType=p1->nType1; - int nAddr=0; - int DataLen=0; //p1->LoadLen; + unsigned char nDataType=p1->nType1; + unsigned short nWordAddr=0; + unsigned short nByteAddr=0; + unsigned short nBitAddr=0; + unsigned short DataLen=0; //p1->LoadLen; //int nSrcAddr=p1->SrcAddr; nKLStatus.nSEQ = ((pKLStat)(&(p1->Stat)))->nSEQ;; @@ -144,7 +146,7 @@ int PacketLen=0; KLRecvTimeuS=KLThisuS; - if (nDstHost==nKLAddr || nDstHost==0xff) + if (nDstHost==nKLStationId || nDstHost==0xff) { switch (p1->nCMD) { @@ -183,7 +185,7 @@ SendPacket(nChn, p2, PacketLen); break; case KLCmdWriteFactoryData: - nAddr=p1->Params[0]+ (p1->Params[1]<<8); + nWordAddr=p1->Params[0]+ (p1->Params[1]<<8); DataLen= p1->Params[2]; //DataLen=16; for (int i=0;i<DataLen;i++) @@ -196,22 +198,24 @@ case KLCmdRead: case KLCmdReadDataWord: case KLCmdReadDataByte: - nAddr=p1->Params[0]+ (p1->Params[1]<<8); + nWordAddr=p1->Params[0]+ (p1->Params[1]<<8); DataLen= p1->Params[2]; - if (nDataType ==KLDataTypeDT) { pData=KMem.DT+nAddr; } - else if (nDataType == KLDataTypeSDT) { pData=KMem.SDT+nAddr; } - else if (nDataType == KLDataTypeWSR) { pData=KMem.WSR+nAddr; } - else if (nDataType == KLDataTypeWX) { pData=KMem.WX+nAddr; } - else if (nDataType == KLDataTypeWY) { pData=KMem.WY+nAddr; } - else if (nDataType == KLDataTypeWR) { pData=KMem.WR+nAddr; } - else if (nDataType == KLDataTypeWLX) { pData=KMem.WLX+nAddr; } - else if (nDataType == KLDataTypeWLY) { pData=KMem.WLY+nAddr; } - else if (nDataType == KLDataTypeSV) { pData=KMem.SV+nAddr; } - else if (nDataType == KLDataTypeEV) { pData=KMem.EV+nAddr; } - else if (nDataType == KLDataTypeTest) { pData=KMem.SDT+nAddr; } - else if (nDataType == KLDataSysCfg) { pData = (unsigned short *)&storedKMSysCfg + nAddr;} - else if (nDataType == KLDataTypeFlash) { pData = (unsigned short *)FLASH_BASE + nAddr;} - else { pData=KLBufferOut+nAddr; } + if (nDataType ==KLDataTypeDT) { pData=KMem.DT+nWordAddr; } + else if (nDataType == KLDataTypeSDT) { pData=KMem.SDT+nWordAddr; } + else if (nDataType == KLDataTypeWSR) { pData=KMem.WSR+nWordAddr; } + else if (nDataType == KLDataTypeWX) { pData=KMem.WX+nWordAddr; } + else if (nDataType == KLDataTypeWY) { pData=KMem.WY+nWordAddr; } + else if (nDataType == KLDataTypeWR) { pData=KMem.WR+nWordAddr; } + else if (nDataType == KLDataTypeWLX) { pData=KMem.WLX+nWordAddr; } + else if (nDataType == KLDataTypeWLY) { pData=KMem.WLY+nWordAddr; } + else if (nDataType == KLDataTypeSV) { pData=KMem.SV+nWordAddr; } + else if (nDataType == KLDataTypeEV) { pData=KMem.EV+nWordAddr; } + else if (nDataType == KLDataTypeTest) { pData=KMem.SDT+nWordAddr; } + else if (nDataType == KLDataTypeWDT) { pData=KMem.WDT+nWordAddr; } + else if (nDataType == KLDataTypeKBD) { pData=(unsigned short *)&KBusChnStats +nWordAddr; } + else if (nDataType == KLDataSysCfg) { pData = (unsigned short *)&storedKMSysCfg.theKMSysCfg + nWordAddr;} + else if (nDataType == KLDataTypeFlash) { pData = (unsigned short *)FLASH_BASE + nWordAddr;} + else { pData=KLBufferOut+nWordAddr; } PacketLen=KLMakeRplyPacket(p2,nDstHost,nKLStatus.StatByte,p1->nCMD,DataLen,pData); SendPacket(nChn, p2, PacketLen); @@ -224,22 +228,24 @@ case KLCmdWriteDataByte: //memcpy(DispBuf,p1->data,DataLen); - nAddr=p1->Params[0]+ (p1->Params[1]<<8); + nWordAddr=p1->Params[0]+ (p1->Params[1]<<8); DataLen= p1->Params[2]; - if (nDataType ==KLDataTypeDT) { pData=KMem.DT+nAddr; } - else if (nDataType == KLDataTypeSDT) { pData=KMem.SDT+nAddr; } - else if (nDataType == KLDataTypeWSR) { pData=KMem.WSR+nAddr; } - else if (nDataType == KLDataTypeWX) { pData=KMem.WX+nAddr; } - else if (nDataType == KLDataTypeWY) { pData=KMem.WY+nAddr; } - else if (nDataType == KLDataTypeWR) { pData=KMem.WR+nAddr; } - else if (nDataType == KLDataTypeWLX) { pData=KMem.WLX+nAddr; } - else if (nDataType == KLDataTypeWLY) { pData=KMem.WLY+nAddr; } - else if (nDataType == KLDataTypeSV) { pData=KMem.SV+nAddr; DataLen=0;} - else if (nDataType == KLDataTypeEV) { pData=KMem.EV+nAddr; DataLen=0;} - else if (nDataType == KLDataTypeTest) { pData=KMem.SDT+nAddr; DataLen=0;} - else if (nDataType == KLDataSysCfg) { pData = (unsigned short *)&storedKMSysCfg + nAddr;} - else if (nDataType == KLDataTypeFlash) { pData = (unsigned short *)FLASH_BASE + nAddr;} - else { pData=KLBufferOut+nAddr; DataLen=0; } + if (nDataType ==KLDataTypeDT) { pData=KMem.DT+nWordAddr; } + else if (nDataType == KLDataTypeSDT) { pData=KMem.SDT+nWordAddr; } + else if (nDataType == KLDataTypeWSR) { pData=KMem.WSR+nWordAddr; } + else if (nDataType == KLDataTypeWX) { pData=KMem.WX+nWordAddr; } + else if (nDataType == KLDataTypeWY) { pData=KMem.WY+nWordAddr; } + else if (nDataType == KLDataTypeWR) { pData=KMem.WR+nWordAddr; } + else if (nDataType == KLDataTypeWLX) { pData=KMem.WLX+nWordAddr; } + else if (nDataType == KLDataTypeWLY) { pData=KMem.WLY+nWordAddr; } + else if (nDataType == KLDataTypeSV) { pData=KMem.SV+nWordAddr; DataLen=0;} + else if (nDataType == KLDataTypeEV) { pData=KMem.EV+nWordAddr; DataLen=0;} + else if (nDataType == KLDataTypeTest) { pData=KMem.SDT+nWordAddr; DataLen=0;} + else if (nDataType == KLDataTypeWDT) { pData=KMem.WDT+nWordAddr; DataLen=0;} + else if (nDataType == KLDataTypeKBD) { pData=(unsigned short *)KBusChnStats +nWordAddr; DataLen=0;} + else if (nDataType == KLDataSysCfg) { pData = (unsigned short *)&(storedKMSysCfg) + nWordAddr;} + else if (nDataType == KLDataTypeFlash) { pData = (unsigned short *)FLASH_BASE + nWordAddr;} + else { pData=KLBufferOut+nWordAddr; DataLen=0; } memcpy(pData,p1->Params+4,DataLen); PacketLen=KLMakeRplyPacket(p2,nDstHost,nKLStatus.StatByte,p1->nCMD,0,0); @@ -249,16 +255,16 @@ // break; case KLCmdRead1Bit: - nAddr=p1->Params[0]+ (p1->Params[1]<<8); + nBitAddr=p1->Params[0]+ (p1->Params[1]<<8); DataLen = 1; - if (nDataType == KLCoilTypeX) { rData[0] = ((KMem.WX[nAddr>>4]&(1<<(nAddr&0x0f)))>0);} - else if (nDataType == KLCoilTypeY) { rData[0] = ((KMem.WY[nAddr>>4]&(1<<(nAddr&0x0f)))>0);} - else if (nDataType == KLCoilTypeR) { rData[0] = ((KMem.WR[nAddr>>4]&(1<<(nAddr&0x0f)))>0);} - else if (nDataType == KLCoilTypeLX) { rData[0] = ((KMem.WLX[nAddr>>4]&(1<<(nAddr&0x0f)))>0);} - else if (nDataType == KLCoilTypeLY) { rData[0] = ((KMem.WLY[nAddr>>4]&(1<<(nAddr&0x0f)))>0);} - else if (nDataType == KLCoilTypeT) { rData[0] = KMem.Timers[nAddr].bTon;} - else if (nDataType == KLCoilTypeC) { rData[0] = KMem.Timers[nAddr].bTon;} - else if (nDataType == KLCoilTypeSR) {rData[0] = ((KMem.WSR[nAddr>>4]&(1<<(nAddr&0x0f)))>0);} + if (nDataType == KLCoilTypeX) { rData[0] = ((KMem.WX[nBitAddr>>4]&(1<<(nBitAddr&0x0f)))>0);} + else if (nDataType == KLCoilTypeY) { rData[0] = ((KMem.WY[nBitAddr>>4]&(1<<(nBitAddr&0x0f)))>0);} + else if (nDataType == KLCoilTypeR) { rData[0] = ((KMem.WR[nBitAddr>>4]&(1<<(nBitAddr&0x0f)))>0);} + else if (nDataType == KLCoilTypeLX) { rData[0] = ((KMem.WLX[nBitAddr>>4]&(1<<(nBitAddr&0x0f)))>0);} + else if (nDataType == KLCoilTypeLY) { rData[0] = ((KMem.WLY[nBitAddr>>4]&(1<<(nBitAddr&0x0f)))>0);} + else if (nDataType == KLCoilTypeT) { rData[0] = KMem.Timers[nBitAddr].bTon;} + else if (nDataType == KLCoilTypeC) { rData[0] = KMem.Timers[nBitAddr].bTon;} + else if (nDataType == KLCoilTypeSR) {rData[0] = ((KMem.WSR[nBitAddr>>4]&(1<<(nBitAddr&0x0f)))>0);} else if (nDataType == KLCoilTypeLR) { rData[0] = 0;} else {rData[0]=0;} @@ -266,16 +272,16 @@ SendPacket(nChn, p2, PacketLen); break; case KLCmdWrite1Bit: - nAddr=p1->Params[0]+ (p1->Params[1]<<8); - if (nDataType == KLCoilTypeX) { SetBitValue( &KMem.WX[nAddr>>4],nAddr&0x0f,p1->Params[2]);} - else if (nDataType == KLCoilTypeY) { SetBitValue( &KMem.WY[nAddr>>4],nAddr&0x0f,p1->Params[2]);} - else if (nDataType == KLCoilTypeR) { SetBitValue( &KMem.WR[nAddr>>4],nAddr&0x0f,p1->Params[2]);} - else if (nDataType == KLCoilTypeLX) {SetBitValue( &KMem.WLX[nAddr>>4],nAddr&0x0f,p1->Params[2]);} - else if (nDataType == KLCoilTypeLY) {SetBitValue( &KMem.WLY[nAddr>>4],nAddr&0x0f,p1->Params[2]);} - else if (nDataType == KLCoilTypeT) { KMem.Timers[nAddr].bTon = p1->Params[2];} - else if (nDataType == KLCoilTypeC) { KMem.Timers[nAddr].bTon = p1->Params[2];} - else if (nDataType == KLCoilTypeC) { KMem.Timers[nAddr].bTon = p1->Params[2];} - else if (nDataType == KLCoilTypeLR) { SetBitValue( &KMem.WSR[nAddr>>4],nAddr&0x0f,p1->Params[2]);;} + nBitAddr=p1->Params[0]+ (p1->Params[1]<<8); + if (nDataType == KLCoilTypeX) { SetBitValue( &KMem.WX[nBitAddr>>4],nBitAddr&0x0f,p1->Params[2]);} + else if (nDataType == KLCoilTypeY) { SetBitValue( &KMem.WY[nBitAddr>>4],nBitAddr&0x0f,p1->Params[2]);} + else if (nDataType == KLCoilTypeR) { SetBitValue( &KMem.WR[nBitAddr>>4],nBitAddr&0x0f,p1->Params[2]);} + else if (nDataType == KLCoilTypeLX) {SetBitValue( &KMem.WLX[nBitAddr>>4],nBitAddr&0x0f,p1->Params[2]);} + else if (nDataType == KLCoilTypeLY) {SetBitValue( &KMem.WLY[nBitAddr>>4],nBitAddr&0x0f,p1->Params[2]);} + else if (nDataType == KLCoilTypeT) { KMem.Timers[nBitAddr].bTon = p1->Params[2];} + else if (nDataType == KLCoilTypeC) { KMem.Timers[nBitAddr].bTon = p1->Params[2];} + else if (nDataType == KLCoilTypeC) { KMem.Timers[nBitAddr].bTon = p1->Params[2];} + else if (nDataType == KLCoilTypeLR) { SetBitValue( &KMem.WSR[nBitAddr>>4],nBitAddr&0x0f,p1->Params[2]);;} else {rData[0]=0;} DataLen=0; PacketLen=KLMakeRplyPacket(p2,nDstHost,nKLStatus.StatByte,KLCmdWrite1Bit,DataLen,rData); @@ -289,16 +295,16 @@ break; case KLCmdReadProgram: - nAddr=p1->Params[0]+ (p1->Params[1]<<8); + nWordAddr=p1->Params[0]+ (p1->Params[1]<<8); DataLen= p1->Params[2]; if (nDataType==0){ - pData = (unsigned short *)STORE_PRG_BASE + nAddr; + pData = (unsigned short *)STORE_PRG_BASE + nWordAddr; } else if (nDataType==1){ - pData = (unsigned short *)ALT_PRG_BASE + nAddr; + pData = (unsigned short *)ALT_PRG_BASE + nWordAddr; } else if (KMRunStat.nBinProgBank == 0) { - pData = (unsigned short *)STORE_PRG_BASE + nAddr; + pData = (unsigned short *)STORE_PRG_BASE + nWordAddr; }else { - pData = (unsigned short *)ALT_PRG_BASE + nAddr; + pData = (unsigned short *)ALT_PRG_BASE + nWordAddr; } PacketLen=KLMakeRplyPacket(p2,nDstHost,nKLStatus.StatByte,p1->nCMD,DataLen,pData); SendPacket(nChn, p2, PacketLen); @@ -316,22 +322,22 @@ break; case KLCmdWriteProgram: if (PLCMem.bPLCRunning) PLCMem.bPLCRunning=0; - nAddr=p1->Params[0]+ (p1->Params[1]<<8); + nWordAddr=p1->Params[0]+ (p1->Params[1]<<8); DataLen= p1->Params[2]; //DataLen=16; for (int i=0;i<DataLen;i++) {KLPacketBuf2[i]=p1->Params[4+i];} - WriteProgram(nAddr, KLPacketBuf2, DataLen,nDataType); + WriteProgram(nWordAddr, KLPacketBuf2, DataLen,nDataType); DataLen=4; *((int *)(&rData[0]))=(long)(p1->Params+4); PacketLen=KLMakeRplyPacket(p2,nDstHost,nKLStatus.StatByte,KLCmdWriteProgram,0,0); SendPacket(nChn, p2, PacketLen); break; case KLCmdFinishProgram: - nAddr=p1->Params[0]+ (p1->Params[1]<<8); //Program Size; + nWordAddr=p1->Params[0]+ (p1->Params[1]<<8); //Program Size; DataLen=nDataType; - KMRunStat.nBinProgSize=nAddr; + KMRunStat.nBinProgSize=nWordAddr; if (KMRunStat.nBinProgBank ==0) {KMRunStat.nBinProgBank=1;} else {KMRunStat.nBinProgBank=0;} SaveRunStat(&KMRunStat); @@ -341,11 +347,51 @@ PacketLen=KLMakeRplyPacket(p2,nDstHost,nKLStatus.StatByte,KLCmdFinishProgram,0,0); SendPacket(nChn, p2, PacketLen); break; + + case KLCmdBlinkLED: + DataLen=nDataType; + KMRunStat.bLEDFlick=DataLen; + PacketLen=KLMakeRplyPacket(p2,nDstHost,nKLStatus.StatByte,p1->nCMD,0,0); + SendPacket(nChn, p2, PacketLen); + break; + + case KLCmdStopBlinkLED: + DataLen=nDataType; + KMRunStat.bLEDFlick=0; + PacketLen=KLMakeRplyPacket(p2,nDstHost,nKLStatus.StatByte,p1->nCMD,0,0); + SendPacket(nChn, p2, PacketLen); + break; + case KLCmdReadRunStat: DataLen= sizeof(stRunStat); pData=&KMRunStat; PacketLen=KLMakeRplyPacket(p2,nDstHost,nKLStatus.StatByte,p1->nCMD,DataLen,pData); SendPacket(nChn, p2, PacketLen); + break; + case KLCmdReadSysCfg: + nByteAddr=p1->Params[0]+ (p1->Params[1]<<8); + pData=(UCHAR *)(&storedKMSysCfg.theKMSysCfg)+nByteAddr; + DataLen = p1->Params[2]; + if (nByteAddr >= sizeof(stKMSysCfg)) {DataLen=0;} + else { + if (DataLen + nByteAddr >sizeof(stKMSysCfg)) + DataLen= sizeof(stKMSysCfg) - nByteAddr; + } + PacketLen=KLMakeRplyPacket(p2,nDstHost,nKLStatus.StatByte,p1->nCMD,DataLen,pData); + SendPacket(nChn, p2, PacketLen); + break; + case KLCmdWriteSysCfg: + nByteAddr=p1->Params[0]+ (p1->Params[1]<<8); + pData=(UCHAR *)(&storedKMSysCfg.theKMSysCfg)+nByteAddr; + DataLen = p1->Params[2]; + if (nByteAddr >= sizeof(stKMSysCfg)) {DataLen=0;} + else { + if (DataLen + nByteAddr >sizeof(stKMSysCfg)) + DataLen= sizeof(stKMSysCfg) - nByteAddr; + } + memcpy(pData,p1->Params+4,DataLen); + PacketLen=KLMakeRplyPacket(p2,nDstHost,nKLStatus.StatByte,p1->nCMD,0,0); + SendPacket(nChn, p2, PacketLen); break; case KLCmdSaveSysCfg: WriteSysCfgToFlash(&storedKMSysCfg); @@ -357,6 +403,11 @@ PacketLen=KLMakeRplyPacket(p2,nDstHost,nKLStatus.StatByte,KLCmdSaveRunStat,0,0); SendPacket(nChn, p2, PacketLen); break; + case KLCmdClearRunStat: + memset(KBusChnStats,0,sizeof(KBusChnStats)); + PacketLen=KLMakeRplyPacket(p2,nDstHost,nKLStatus.StatByte,p1->nCMD,0,0); + SendPacket(nChn, p2, PacketLen); + break; case KLCmdGetEventLogCount: DataLen= 4; pData=&KMem.nEventCount; @@ -364,9 +415,9 @@ SendPacket(nChn, p2, PacketLen); break; case KLCmdGetEventLog: - nAddr=p1->Params[0]+ (p1->Params[1]<<8); + nWordAddr=p1->Params[0]+ (p1->Params[1]<<8); DataLen= p1->Params[2] * sizeof(stEventLog); - pData=GetEventLogAddr(nAddr); + pData=GetEventLogAddr(nWordAddr); PacketLen=KLMakeRplyPacket(p2,nDstHost,nKLStatus.StatByte,p1->nCMD,DataLen,pData); SendPacket(nChn, p2, PacketLen); break; @@ -378,7 +429,7 @@ default: DataLen=1; rData[0]=KL_UNKNOWN; - PacketLen=KLMakeRplyPacket(p2,nKLAddr,nKLStatus.StatByte,KLCmdErrRply,DataLen,rData); + PacketLen=KLMakeRplyPacket(p2,nKLStationId,nKLStatus.StatByte,KLCmdErrRply,DataLen,rData); SendPacket(nChn, p2, PacketLen); break; } @@ -398,7 +449,7 @@ char rData[4]; rData[0]=Result; - PacketLen=KLMakeRplyPacket(KLPacketBuf2,nKLAddr,nKLStatus.StatByte,KLCmdErrRply,DataLen,rData); + PacketLen=KLMakeRplyPacket(KLPacketBuf2,nKLStationId,nKLStatus.StatByte,KLCmdErrRply,DataLen,rData); // PacketLen=KLMakePacket(p2,0,nAddr,cmdKLPing,p1->nSEQ,DataLen,rData); SendPacket(nChn, KLPacketBuf2, PacketLen); return Result; @@ -411,7 +462,7 @@ //int len1=p1->PacketLen; // if (p1->DstHost!=255&&p1->DstHost!=2) return -3; -// pPacket p2=(pPacket)PacketBuf2; +// pKBPacket p2=(pKBPacket)PacketBuf2; // Uart2Stat.OKPacket++; return Result; diff --git a/Src/KMachine.c b/Src/KMachine.c index cad2702..abc6f31 100644 --- a/Src/KMachine.c +++ b/Src/KMachine.c @@ -28,10 +28,14 @@ //uint32_t * pUID = (uint32_t *)(UID_BASE); const stKMInfoBlock KMInfoBlock = { - BOARD_TYPE, //nDeviceType +// sizeof(stKMInfoBlock), + (BOARD_TYPE<<8) + BOARD_VER, //nDeviceType BOARD_VER, //nDevieVer 0x0100, //ProgVer 0x0100, //KLinkVer - 0x0100, //nCapacity + 0x0100, //KBusVer + + 4, //nCapacity1 ?K + 1, //nCapacity2 ?k 16, //nDInput; 16, //nDOutput 0, //nAInput @@ -40,6 +44,11 @@ 0, //nHOutput 0, //nExt1; 0, //nExt2; + 0, //nLogSize; + 0, //nPorts; + 0, //nManSize; + 0, //nAbility; + 6, //nSwitchBits; }; const char VersionStr[] __attribute__((at(FLASH_BASE + 0X1000))) //__attribute__((at(0X8001000))) = "3.00"; @@ -52,33 +61,42 @@ CFG_VER, 0x0000, 0x0000, - {0,0,0,0,0,0}, + 0x0000, { { - 1, - 0, - 2304, //Buadrate * 100; PortType_KLink, //PorttType - 1, //ByteSize + 1, //Station + 2304, //Buadrate = * 100; + 0, //ByteSize 0, //Parity 0, //StopBits + 0, //endType 0, //EofChar 0, //SofChar + 0, //endtime + 0, //recvbuf + 0, //bufsize }, { - 1, - 0, - 2304, //Buadrate * 100; PortType_KBus, //PorttType - 1, //ByteSize + 0, //Station + 2304, //Buadrate = * 100; + 0, //ByteSize 0, //Parity 0, //StopBits + 0, //endType 0, //EofChar 0, //SofChar + 0, //endtime + 0, //recvbuf + 0, //bufsize } }, {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}}, {{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1}}, + { //default port mapping + 0,0,0,0,0,0 + }, 0x0003, 0x0004, 0x0005, @@ -89,11 +107,7 @@ 0x000a, 0x000b, 0x000c, - 0x000d, - 0x000e, - 0x000f, - 0x0010, - {0}, + 0x0011, END_SIGN, }; @@ -190,6 +204,10 @@ } int WriteFactoryData(void * pDataBuf, int nByteCount) { + stFactoryData * p1 = (stFactoryData*) pDataBuf; + stFactoryData * p2 = (stFactoryData *)FACTORY_DATA_BASE; + p1->Seq1= p2->Seq1+1; + EraseAndWriteToFlashMem(pDataBuf, (stFactoryData *)FACTORY_DATA_BASE,nByteCount); return 0; } diff --git a/Src/PLCfunctions.c b/Src/PLCfunctions.c index fbee49a..f6acac0 100644 --- a/Src/PLCfunctions.c +++ b/Src/PLCfunctions.c @@ -372,6 +372,28 @@ return 0; } +inline void SetAddrBit(unsigned short * pW, unsigned char bitAddr) +{ + (*pW)|=1<<(bitAddr&0xf); +} + +inline void ResetBit(unsigned short * pW, unsigned char bitAddr) +{ + (*pW)&=~(1<<(bitAddr&0xf)); +} +static inline void SetBitValue(unsigned short * pW, unsigned char bitAddr, unsigned char Value) +{ + if (Value) { SetAddrBit(pW, bitAddr);} + else {ResetBit(pW, bitAddr);} +} + +static inline unsigned char GetBitValue(unsigned short W, unsigned char bitAddr) +{ + if (W&(1<<(bitAddr&0xf))) return 1; + else return 0; +} + + int ProcessPLCBinProg(const stBinProg1 * pBinprog, int nStepSize) { if (!PLCMem.bPLCRunning) return 0; @@ -744,7 +766,7 @@ break; } - lastScanInputVal = PLCMem.ProgTrace[CurPos]; + lastScanInputVal = PLCMem.ProgTrace[CurPos]; //GetBitValue(KMem.WDFs); PLCMem.ProgTrace[CurPos] = KMem.CurVAL; CurPos += nNextPos; } diff --git a/Src/debug.c b/Src/debug.c index 539d1ac..35c4bd4 100644 --- a/Src/debug.c +++ b/Src/debug.c @@ -173,11 +173,6 @@ Uart1baudval = HAL_RCC_GetPCLK1Freq() / USART1->BRR; Uart1BaudFirstGot=0; } - if (Uart2BaudFirstGot) - { - Uart2baudval = HAL_RCC_GetPCLK1Freq() / USART2->BRR; - Uart2BaudFirstGot=0; - } int Reload=SysTick->LOAD; int Clk2=SysTick->VAL; diff --git a/Src/functions.c b/Src/functions.c index feedbc0..0b7e7c8 100644 --- a/Src/functions.c +++ b/Src/functions.c @@ -55,6 +55,12 @@ return nCurTick; } +void logData(unsigned char d) +{ + KMem.WDB[128+KMem.WDT[123]] = d; + KMem.WDT[123]++; if (KMem.WDT[123]>=100) {KMem.WDT[123]=81;} +} + const unsigned short crc16_table[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, @@ -211,7 +217,7 @@ LL_DMA_SetDataLength(DMA1,LL_DMA_CHANNEL_2,nSize); LL_DMA_EnableChannel(DMA1,LL_DMA_CHANNEL_2); Uart1Stat.DMASendLen=nSize; - Uart1Stat.Sending=1; + Uart1Stat.bSending=1; LL_DMA_EnableIT_TC(DMA1,LL_DMA_CHANNEL_2); LL_USART_EnableDMAReq_TX(USART1); return nSize; @@ -219,7 +225,7 @@ int Uart1TriggerSendDMA() { - if (!Uart1Stat.Sending&&!IsEmpty(&Uart1Stat.QTx)) + if (!Uart1Stat.bSending&&!IsEmpty(&Uart1Stat.QTx)) { int len1=GetContinueData(&Uart1Stat.QTx); Uart1SendDMA(GetReadBuffer(&Uart1Stat.QTx),len1); @@ -235,7 +241,7 @@ LL_DMA_SetDataLength(DMA1,LL_DMA_CHANNEL_5,nSize); LL_DMA_EnableChannel(DMA1,LL_DMA_CHANNEL_5); Uart2Stat.DMARecvLen=nSize; - Uart2Stat.Recving=1; + Uart2Stat.bRecving=1; LL_DMA_EnableIT_TC(DMA1,LL_DMA_CHANNEL_5); LL_USART_EnableDMAReq_RX(USART2); return 0; @@ -248,14 +254,14 @@ LL_DMA_SetDataLength(DMA1,LL_DMA_CHANNEL_4,nSize); LL_DMA_EnableChannel(DMA1,LL_DMA_CHANNEL_4); Uart2Stat.DMASendLen=nSize; - Uart2Stat.Sending=1; + Uart2Stat.bSending=1; LL_DMA_EnableIT_TC(DMA1,LL_DMA_CHANNEL_4); LL_USART_EnableDMAReq_TX(USART2); return nSize; } int Uart2TriggerSendDMA() { - if (!Uart2Stat.Sending&&!IsEmpty(&Uart2Stat.QTx)) + if (!Uart2Stat.bSending&&!IsEmpty(&Uart2Stat.QTx)) { int len1=GetContinueData(&Uart2Stat.QTx); Uart2SendDMA(GetReadBuffer(&Uart2Stat.QTx),len1); @@ -281,7 +287,7 @@ #endif if (Uart2Stat.bPacketRecved) { - KBusParsePacket(2, (pPacket)Uart2RecvBuf1, Uart2RecvBuf1DataLen); + KBusParsePacket(2, (pKBPacket)Uart2RecvBuf1, Uart2RecvBuf1DataLen); Uart2RecvBuf1DataLen=0; Uart2Stat.bPacketRecved=0; Uart2RecvDMA(Uart2RecvBuf1,sizeof(Uart2RecvBuf1)); @@ -296,12 +302,11 @@ { value = LL_SPI_ReceiveData8( SPI1); #if (BOARD_TYPE == 14) - KMem.SDD[62]++; - KMem.SDT[122]++; + KMem.WDD[62]++; + KMem.WDT[122]++; if (!bSPI1Sending) { - KMem.SDB[128+KMem.SDT[123]] = value; - KMem.SDT[123]++; if (KMem.SDT[123]>=100) {KMem.SDT[123]=81;} + logData(value); } if (!bSPI1Sending && (1 || bSPI1Recving)) { @@ -310,8 +315,7 @@ if (value==0x0d) { - KMem.SDB[128+KMem.SDT[123]] = nSPI1RecvPos; - KMem.SDT[123]++; if (KMem.SDT[123]>=100) {KMem.SDT[123]=81;} + logData(nSPI1RecvPos); nSPI1RecvLenInBuf=nSPI1RecvPos; bSPI1RecvDone=1; @@ -338,8 +342,7 @@ else { value = SPI1SendBuf[nSPI1SentLen]; LL_SPI_TransmitData8(SPI1,value); - KMem.SDB[128+KMem.SDT[123]] = value; - KMem.SDT[123]++; if (KMem.SDT[123]>=100) {KMem.SDT[123]=81;} + logData(value); } } #endif @@ -378,7 +381,7 @@ Uart2Stat.IdelCount++; if (Uart2RecvBuf1DataLen>0) TriggerPendSV(); - // ParsePacket((pPacket)Uart2RecvBuf1,Uart2RecvBuf1DataLen); + // ParsePacket((pKBPacket)Uart2RecvBuf1,Uart2RecvBuf1DataLen); } int PutStr(char * str1, int len1) @@ -433,7 +436,7 @@ Uart1Stat.SentPacket++; return len1; } -int SendPacket2(pPacket p1,int len1) +int SendPacket2(pKBPacket p1,int len1) { PutStr2((char *)p1,len1); // PushIn(&Uart2Stat.QTx,p1,len1); @@ -444,6 +447,8 @@ */ void ToggleRunLed() { LL_GPIO_TogglePin(GPIOC,LL_GPIO_PIN_13);} void ToggleErrLed() { LL_GPIO_TogglePin(GPIOC,LL_GPIO_PIN_14);} +void ToggleErr2Led() { LL_GPIO_TogglePin(GPIOC,LL_GPIO_PIN_15);} + #if (BOARD_TYPE == 14) void ToggleOutStat() { LL_GPIO_TogglePin(GPIOC,LL_GPIO_PIN_15);} @@ -472,11 +477,17 @@ if (bOn) {LL_GPIO_ResetOutputPin(GPIOC,LL_GPIO_PIN_14);} else {LL_GPIO_SetOutputPin(GPIOC,LL_GPIO_PIN_14);} } +void SetErr2Led(uchar bOn) +{ + if (bOn) {LL_GPIO_ResetOutputPin(GPIOC,LL_GPIO_PIN_15);} + else {LL_GPIO_SetOutputPin(GPIOC,LL_GPIO_PIN_15);} +} +/* void SetLeds(uchar bRun, uchar bErr) { SetRunLed(bRun); SetErrLed (bErr); } - +*/ #define set165SL_0() LL_GPIO_ResetOutputPin(GPIOA,LL_GPIO_PIN_4) #define set165SL_1() LL_GPIO_SetOutputPin(GPIOA,LL_GPIO_PIN_4) #define set165CLK_0() LL_GPIO_ResetOutputPin(GPIOA,LL_GPIO_PIN_5) @@ -853,9 +864,10 @@ { #if (BOARD_TYPE == 14) return ; -#endif +#else PutOutputSPI2(Y); //Output595_16(Y); +#endif } #if (BOARD_TYPE == 9 || BOARD_TYPE == 10 || BOARD_TYPE == 15 ) diff --git a/Src/main.c b/Src/main.c index 9e62055..c1a7ec3 100644 --- a/Src/main.c +++ b/Src/main.c @@ -70,11 +70,11 @@ /* USER CODE BEGIN PV */ /* Private variables ---------------------------------------------------------*/ -#define RX2BUFSIZE 128 -#define TX2BUFSIZE 128 +#define RX2BUFSIZE 64 +#define TX2BUFSIZE 64 -unsigned char Uart1RxBuf[256]; -unsigned char Uart1TxBuf[280]; +unsigned char Uart1RxBuf[128]; +unsigned char Uart1TxBuf[260]; unsigned char Uart2RxBuf[RX2BUFSIZE]; unsigned char Uart2TxBuf[TX2BUFSIZE]; @@ -124,6 +124,8 @@ Count=0; KMem.CurTimeSec++; KMem.ThisRunTime++; KMem.TotalRunTime++; + if (KMRunStat.bLEDFlick) KMRunStat.bLEDFlick--; + if (KMRunStat.bLEDFlick >120) KMRunStat.bLEDFlick=120; } return; @@ -139,9 +141,10 @@ int main(void) { /* USER CODE BEGIN 1 */ - - InitUartstat(&Uart1Stat,Uart1TxBuf,sizeof(Uart1RxBuf),Uart1TxBuf,sizeof(Uart1TxBuf)); - InitUartstat(&Uart2Stat,Uart2TxBuf,sizeof(Uart2RxBuf),Uart2TxBuf,sizeof(Uart2TxBuf)); + KMRunStat.bLEDFlick = 1; + + InitUartstat(&Uart1Stat,Uart1RxBuf,sizeof(Uart1RxBuf),Uart1TxBuf,sizeof(Uart1TxBuf)); + InitUartstat(&Uart2Stat,Uart2RxBuf,sizeof(Uart2RxBuf),Uart2TxBuf,sizeof(Uart2TxBuf)); /* USER CODE END 1 */ /* MCU Configuration----------------------------------------------------------*/ @@ -153,18 +156,18 @@ for (int i=0;i<9;i++) { -// memset(ChnStats[i],0,0); - ChnStats[i].SendPackets=0; - ChnStats[i].RecvPackets=0; - ChnStats[i].LostPackets=0; - ChnStats[i].CtnLstPkts=0; - ChnStats[i].MaxCtnLstPkts=0; - ChnStats[i].NotPkgErr=0; - ChnStats[i].PkgLenErr=0; - ChnStats[i].TimeOutErr=0; - ChnStats[i].BCCErr=0; - ChnStats[i].Delay=0; - ChnStats[i].MaxDelay=0; +// memset(KBusChnStats[i],0,0); + KBusChnStats[i].SendPackets=0; + KBusChnStats[i].RecvPackets=0; + KBusChnStats[i].LostPackets=0; + KBusChnStats[i].CtnLstPkts=0; + KBusChnStats[i].MaxCtnLstPkts=0; + KBusChnStats[i].NotPkgErr=0; + KBusChnStats[i].PkgLenErr=0; + KBusChnStats[i].TimeOutErr=0; + KBusChnStats[i].BCCErr=0; + KBusChnStats[i].Delay=0; + KBusChnStats[i].MaxDelay=0; } KMem.LastScanTime=0; @@ -190,7 +193,7 @@ /* USER CODE BEGIN SysInit */ TickFreq=10000; //Tick棰戠巼 InituS(TickFreq); - // HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/TickFreq); //閲嶆柊瀹氫箟SysTick鐨勯鐜囷拷 + // HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/TickFreq); //閲嶆柊瀹氫箟SysTick鐨勯鐜� /* USER CODE END SysInit */ @@ -201,26 +204,28 @@ KMachineInit(); ReadSysCfgFromFlash(&storedKMSysCfg); + KMRunStat.bLEDFlick = 1; + KMem.EffJumperSW=ReadJumperSW(); #if (BOARD_TYPE == 14) KMem.EffJumperSW|=0x10; - nAddr=KMem.EffJumperSW&0x0f; + nStationID=KMem.EffJumperSW&0x0f; if ((KMem.EffJumperSW&0x10)!=0) {bKBusMaster=1;bKBusSlave=0;} else{bKBusMaster=0;bKBusSlave=1;} - nChilds=nAddr; + nChilds=nStationID; FP0_Init(); #elif (BOARD_TYPE == 15) - nAddr=KMem.EffJumperSW&0x0f; + nStationID=KMem.EffJumperSW&0x0f; if (KMem.EffJumperSW == 0x1f) {bKBusRepeater=1;bKBusMaster=1;bKBusSlave=0;} else if ((KMem.EffJumperSW&0x10)!=0) {bKBusMaster=1;bKBusSlave=0;} else{bKBusMaster=0;bKBusSlave=1;} #else - nAddr=KMem.EffJumperSW&0x7; + nStationID=KMem.EffJumperSW&0x7; if (KMem.EffJumperSW == 0x0f) {bKBusRepeater=1;bKBusMaster=1;bKBusSlave=0;} else if ((KMem.EffJumperSW&0x08)!=0) {bKBusMaster=1;bKBusSlave=0;} else{bKBusMaster=0;bKBusSlave=1;} #endif - nChilds=nAddr; + nChilds=nStationID; nCurPollId=1; //if (KMem.EffJumperSW == 0x00) Uart1Baud = DefaultUart1Baud; @@ -308,7 +313,6 @@ KWireLessInit(KMem.EffJumperSW&0x20); KWireLessStart(); #endif - while (1) { //int MyKeyStat1,MyKeyStat2; @@ -440,20 +444,33 @@ // KMem.WY[0]=nCount2>>5; if (KMem.RunStat) {KMem.RunStat--;} if (KMem.ErrStat) {KMem.ErrStat--;} - - if (!KMem.RunStat) SetRunLed(SlowFlicker); - else SetRunLed(FastFlicker); - if (!KMem.ErrStat) + if (KMRunStat.bLEDFlick) { - SetErrLed(0); - SetOutStat(1); - } - else - { + SetRunLed(FastFlicker); SetErrLed(FastFlicker); - SetOutStat(0); + SetErr2Led(FastFlicker); + SetOutStat(!FastFlicker); + //KMRunStat.bLEDFlick-- ; + } + else + { + if (!KMem.RunStat) SetRunLed(SlowFlicker); + else SetRunLed(FastFlicker); + if (!KMem.ErrStat) + { + SetErrLed(0); + SetErr2Led(0); + SetOutStat(1); + } + else + { + SetErrLed(FastFlicker); + SetErr2Led(FastFlicker); + SetOutStat(0); + + } } // SetRunLed(RunStat); @@ -485,8 +502,8 @@ } KMem.nRunCount++; // int nSize=sizeof(stChnStat); -// memcpy(&KMem.SDT[64],&ChnStats[1],nSize); -// memcpy(&KMem.SDT[64+nSize/2],&ChnStats[2],nSize); +// memcpy(&KMem.SDT[64],&KBusChnStats[1],nSize); +// memcpy(&KMem.SDT[64+nSize/2],&KBusChnStats[2],nSize); // for (int i=0;i<128;i++) { SDT[i]=i; } // SDT[48]=55; if (Uart1RecvBuf1DataLen >0 && Uart1Stat.bPacketRecved) diff --git a/Src/stm32f0xx_it.c b/Src/stm32f0xx_it.c index ae44ae7..6306514 100644 --- a/Src/stm32f0xx_it.c +++ b/Src/stm32f0xx_it.c @@ -149,7 +149,7 @@ void DMA1_Channel2_3_IRQHandler(void) { /* USER CODE BEGIN DMA1_Channel2_3_IRQn 0 */ - Uart1DmaInts++; + Uart1Stat.DMACount++; if (LL_DMA_IsActiveFlag_TC2(DMA1)) { @@ -171,7 +171,7 @@ else { Uart1Stat.DMASendLen=0; - Uart1Stat.Sending=0; + Uart1Stat.bSending=0; } } /* USER CODE END DMA1_Channel2_3_IRQn 0 */ @@ -188,7 +188,7 @@ void DMA1_Channel4_5_IRQHandler(void) { /* USER CODE BEGIN DMA1_Channel4_5_IRQn 0 */ - Uart2DmaInts++; + Uart2Stat.DMACount++; if (LL_DMA_IsActiveFlag_TC4(DMA1)) { LL_DMA_ClearFlag_TC4(DMA1); @@ -212,7 +212,7 @@ */ { Uart2Stat.DMASendLen=0; - Uart2Stat.Sending=0; + Uart2Stat.bSending=0; } } /* USER CODE END DMA1_Channel4_5_IRQn 0 */ @@ -262,14 +262,14 @@ Uart1Stat.OverRunCount++; } if (LL_USART_IsEnabledIT_IDLE(USART1)&&LL_USART_IsActiveFlag_IDLE(USART1)) - {//接收完成 + {//鎺ユ敹瀹屾垚 LL_USART_ClearFlag_IDLE(USART1); Uart1RecvDone(); } /* USER CODE END USART1_IRQn 0 */ /* USER CODE BEGIN USART1_IRQn 1 */ if (LL_USART_IsActiveFlag_TC(USART1)) - {//发送完成 + {//鍙戦�佸畬鎴� LL_USART_ClearFlag_TC(USART1); Uart1SendDone(); } @@ -297,14 +297,14 @@ Uart2Stat.OverRunCount++; } if (LL_USART_IsEnabledIT_IDLE(USART2)&&LL_USART_IsActiveFlag_IDLE(USART2)) - {//接收完成 + {//鎺ユ敹瀹屾垚 LL_USART_ClearFlag_IDLE(USART2); Uart2RecvDone(); } /* USER CODE END USART2_IRQn 0 */ /* USER CODE BEGIN USART2_IRQn 1 */ if (LL_USART_IsActiveFlag_TC(USART2)) - {//发送完成 + {//鍙戦�佸畬鎴� LL_USART_ClearFlag_TC(USART2); Uart2SendDone(); } -- Gitblit v1.9.1