From 32dd2918fa59bbe937317a0307f9e941e9ce6e8e Mon Sep 17 00:00:00 2001
From: Ricky-Kwon
Date: Wed, 11 Apr 2018 16:56:34 +0900
Subject: [PATCH] #16 bug fixed
---
README.md | 26 +++++++++++-
WIZ550S2E_App/src/ATcmd/cmdrun.c | 68 +++++++++-----------------------
WIZ550S2E_App/src/common.h | 2 +-
WIZ550S2E_App/src/main.c | 2 +-
4 files changed, 46 insertions(+), 52 deletions(-)
diff --git a/README.md b/README.md
index f12bf74..8ad6419 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,9 @@
# WIZ550S2E
+
Serial to Ethernet Module based on [W5500](http://wizwiki.net/wiki/doku.php?id=products:w5500:start) & Cortex-M0
## Firmware
+
These are Firmware projects (source code) based on [LPCXpresso](http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/lpc-cortex-m-mcus/lpc1100-cortex-m0-plus-m0/lpcxpresso-ide-v8.2.2:LPCXPRESSO) IDE or [MCUXpresso](http://www.nxp.com/products/software-and-tools/run-time-software/mcuxpresso-software-and-tools/mcuxpresso-integrated-development-environment-ide:MCUXpresso-IDE).
- [Direct Download Link for LPCXpresso7.5.0_254 for Windows](https://s3.amazonaws.com/LPCXpresso7/LPCXpresso_7.5.0_254.exe)
@@ -51,12 +53,14 @@ If you would like to use [.bin file](http://wizwiki.net/wiki/doku.php?id=product
## Images
+
### WIZ550S2E Module
![WIZ550S2E](http://wizwiki.net/wiki/lib/exe/fetch.php?cache=&media=products:wiz550s2e:wiz550s2eds:wiz550s2e_pin.jpg "WIZ550S2E")
#### Features & Benefits & Hardware Specification
+
- Serial to Ethernet Module based on TCP/IP Controller W5500 & Cortex-M0(MCU LPC11E36FHN33)
- RJ-45 mounted, Pin-header type module
- Serial signals : TXD, RXD, RTS, CTS, GND
@@ -71,6 +75,7 @@ If you would like to use [.bin file](http://wizwiki.net/wiki/doku.php?id=product
- 2.54mm Header x2
### WIZ550S2E-232 Interface Board
+
@@ -78,7 +83,9 @@ If you would like to use [.bin file](http://wizwiki.net/wiki/doku.php?id=product
+
#### Features
+
- Line Driver SP3232EBEY
- System Reset Switch
- Factory Reset Switch
@@ -87,6 +94,7 @@ If you would like to use [.bin file](http://wizwiki.net/wiki/doku.php?id=product
- DC-Jack (for +5V Input Power)
### WIZ550S2E-485/422 Interface Board
+
@@ -94,7 +102,9 @@ If you would like to use [.bin file](http://wizwiki.net/wiki/doku.php?id=product
+
#### Features
+
- Line Driver SP3485EN
- System Reset Switch
- Factory Reset Switch
@@ -117,7 +127,7 @@ Install JAVA Runtime Environment
4. When you run the Terminal, type the "java -version" command, the following message is displayed.
![2](http://wizwiki.net/wiki/lib/exe/fetch.php?t=1428563628&w=500&h=100&tok=1cadd9&media=products:wiz550s2e:2.png "2")
5. [WIZ550S2E wiki page](http://wizwiki.net/wiki/doku.php?id=products:wiz550s2e:wiz550s2e_download).
-6. Configuration Tool for WIZ550S2E download.
+6. Configuration Tool for WIZ550S2E download.
![3](http://wizwiki.net/wiki/lib/exe/fetch.php?t=1428563629&w=500&h=375&tok=02960c&media=products:wiz550s2e:3.png "3")
7. Then Unzipped the downloaded zip file. Excutable jar file is created.
8. Excute file.
@@ -126,22 +136,32 @@ Install JAVA Runtime Environment
![4](http://wizwiki.net/wiki/lib/exe/fetch.php?t=1428563629&w=500&h=412&tok=8ab846&media=products:wiz550s2e:4.png "4")
## Revision History
+
+### v1.1.4
+
+- Fixed Problems receiving data in AT Mode
+
### v1.1.3
+
- Fixed UDP Send Fail in AT Mode
### v1.1.2
+
- Fixed recevied data loss(During trans to serial) problem in AT Mode
- Limit max size(1000byte) of receive data from ethernet.
### v1.1.1
+
- Add inactivity time function in Server/Mixed Mode
### v1.1.0
+
- ioLibrary Update
- Dependency Removal (remove "board.h" in "w5500.h")
- Remove garbage file
### v1.0.4
+
- Fixed bug
- Time packing problem in UDP mode.
- Before : Not work normally after the first time.
@@ -151,6 +171,7 @@ Install JAVA Runtime Environment
- After : Works in both uppercase and lowercase.
### v1.0.3
+
- Fixed bug
- AT Command Trigger
- Before : AT command is actived regardless of AT command enable.
@@ -159,6 +180,7 @@ Install JAVA Runtime Environment
- AT+NMODE : (AT command) Saving the changes made to AT mode to memory.
### v1.0.2
+
- Fixed bug
- In mixed mode
- Before : when connecting to the server, the '+' had to be include in the serial data.
@@ -171,7 +193,9 @@ Install JAVA Runtime Environment
- AT+FDNS = domain name
### v1.0.1
+
- Fixed Project set
### v1.0.0
+
- First release : Apr. 2015
diff --git a/WIZ550S2E_App/src/ATcmd/cmdrun.c b/WIZ550S2E_App/src/ATcmd/cmdrun.c
index 3e9ec7a..8fd4c73 100644
--- a/WIZ550S2E_App/src/ATcmd/cmdrun.c
+++ b/WIZ550S2E_App/src/ATcmd/cmdrun.c
@@ -623,8 +623,7 @@ void act_nrecv(int8_t sock, uint16_t maxlen){
uint16_t dstport;
int32_t len=0, offset=0;
uint16_t recvsize;
-
- if(maxlen > 1000) maxlen = 1000; // limit max size of receive data from ethernet. (20170525)
+ uint16_t sentlen=0, rbret=0;
if(sock == VAL_NONE) { DBG("sock==NONE");
for(i=ATC_SOCK_NUM_START; i<=ATC_SOCK_NUM_END; i++) {
@@ -658,9 +657,11 @@ void act_nrecv(int8_t sock, uint16_t maxlen){
ret = RET_NO_DATA;
goto FAIL_RET;
}
- //printf("Socket's RECV SIZE : %d\r\n", recvsize);
- len = recv(sock, (uint8_t*)atci.recvbuf, maxlen); //DBGA("TCPdbg---m(%d)l(%d)f(%d)", maxlen, len, GetSocketRxRecvBufferSize(sock));
- //printf("RECV Length : %d, %d\r\n", len, maxlen);
+ else {
+ if(recvsize > maxlen)
+ recvsize = maxlen;
+ }
+ len = recv(sock, (uint8_t*)atci.recvbuf, recvsize); //DBGA("TCPdbg---m(%d)l(%d)f(%d)", maxlen, len, GetSocketRxRecvBufferSize(sock));
} else { // UDP
uint16_t bufleft = maxlen;
@@ -670,45 +671,13 @@ void act_nrecv(int8_t sock, uint16_t maxlen){
ret = RET_NO_DATA;
goto FAIL_RET;
}
-
- if(bufleft < recvsize) {
- DBGA("buffer not enough - sock(%d),buf(%d),recv(%d)", sock, bufleft, recvsize);
- ret = RET_NO_FREEMEM;
- goto FAIL_RET;
- }
-
- offset = recvfrom(sock, (uint8_t*)&atci.recvbuf[len], bufleft, dstip, &dstport);
- if(offset <= 0 || offset > (int32_t)bufleft) { // Abnormal case - I don't think this could happen but just in case.
- if(offset > (int32_t)bufleft) {
- ERRA("buf overflw - off(%d), maxlen(%d)", offset, bufleft);
- if(len == 0) {
- ret = RET_UNSPECIFIED;
- goto FAIL_RET;
- }
- bufleft = 0;
- } else {
- ERRA("wrong reaction - ret(%d)", offset);
- if(len == 0) {
- if(offset == SOCK_CLOSED) {
- ret = RET_SOCK_CLS;
- goto FAIL_RET;
- } else if(offset < 0) {
- ret = RET_UNSPECIFIED;
- goto FAIL_RET;
- } else {
- ret = RET_NO_DATA;
- goto FAIL_RET;
- }
- }
- }
- } else { // Normal case
- DBGA("UDP Recv - off(%d), len(%d), maxlen(%d)", offset, len, bufleft);
- len += offset;
- bufleft -= offset;
+ else {
+ if(recvsize > maxlen)
+ recvsize = maxlen;
}
+ len = recvfrom(sock, (uint8_t*)atci.recvbuf, recvsize, dstip, &dstport);
}
//DBGA("RECV prt-len(%d), max(%d)", len, maxlen);
- atci.recvbuf[len] = 0;
recvflag[sock] = VAL_CLEAR;
if((sockstat[sock] & SOCK_STAT_PROTMASK) == SOCK_STAT_IDLE) { // ?�버그용?? ?�정?�면 간단?�게 ?�정??�
@@ -730,15 +699,16 @@ void act_nrecv(int8_t sock, uint16_t maxlen){
ARG_CLEAR(atci.tcmd.arg2);
ARG_CLEAR(atci.tcmd.arg3);
-#if 1 // added by kei for resolve RECV data loss issue. (20170525)
- uint32_t send_len = 0;
- do{
- send_len += UART_write(&atci.recvbuf[send_len], len-send_len);
- }while(len-send_len);
-#else
- UART_write(atci.recvbuf, len);
+ while (RingBuffer_IsEmpty(&txring)==0) {
+
+ }
+
+ while (len != sentlen) {
+ rbret = UART_write(atci.recvbuf+sentlen, len-sentlen);
+ sentlen += rbret;
+ }
+
UART_write("\r\n", 2);
-#endif
return;
diff --git a/WIZ550S2E_App/src/common.h b/WIZ550S2E_App/src/common.h
index 29f3b00..7565eb3 100644
--- a/WIZ550S2E_App/src/common.h
+++ b/WIZ550S2E_App/src/common.h
@@ -9,7 +9,7 @@
#define MAJOR_VER 1
#define MINOR_VER 1
-#define MAINTENANCE_VER 3
+#define MAINTENANCE_VER 4
#define SOCK_DATA 0
#define SOCK_CONFIG 1
diff --git a/WIZ550S2E_App/src/main.c b/WIZ550S2E_App/src/main.c
index 59df67c..fb5aace 100644
--- a/WIZ550S2E_App/src/main.c
+++ b/WIZ550S2E_App/src/main.c
@@ -141,7 +141,7 @@ int main(void)
}
}
- atc_init(&rxring, &txring);
+ atc_init();
op_mode = OP_DATA;
while (1) {