add readme for s7 demo, revise lwip config
This commit is contained in:
parent
0b35613eb3
commit
62026f5860
|
@ -0,0 +1,22 @@
|
||||||
|
# S7 测试样例程序
|
||||||
|
|
||||||
|
S7 库本身由 C++ 开发,在 XiUOS 下也可以使用 `snap7.h` 中的 C API 进行应用开发,如 `s7_demo.c` 中提供了一个皮带传送控制样例。
|
||||||
|
|
||||||
|
移植基于 LwIP,调试时可以设置 `LwIP/include/lwip/opt.h` 中的 `SOCKETS_DEBUG` 宏为 `LWIP_DBG_ON`,查看通讯情况。
|
||||||
|
|
||||||
|
|
||||||
|
## 实验室内部测试方法:
|
||||||
|
|
||||||
|
连接 OK1052-C 开发板到展墙交换机,启动 XiUOS 后在 shell 下输入 `S7Demo 192.168.250.2`,可以看到传送带周期性转动。
|
||||||
|
|
||||||
|
## 常见问题:
|
||||||
|
|
||||||
|
- 创建连接时错误提示为 "ISO : An error occurred during recv TCP : Connection time out"。
|
||||||
|
此时有可能已经接收到了回复,但是读取时有问题。需要设置 `LwIP/include/lwip/opt.h` 中的 `LWIP_SO_RCVBUF` 宏为 1,以在 `lwip_ioctl()` 中支持 `FIONREAD` 指令,获取缓冲区内字节数。
|
||||||
|
|
||||||
|
- 创建连接时错误提示为 "TCP : Unreachable peer"。
|
||||||
|
网络连接问题,配置开发板 LwIP 网络地址或重启尝试,可以通过 ping 命令检查网络连接情况后再进行测试。
|
||||||
|
|
||||||
|
- 创建连接时错误提示为 "TCP : No Buffer space avaliable"。
|
||||||
|
可能是未进行 LwIP 初始化,调用 `ETH_BSP_Config(); lwip_config_tcp(lwip_ipaddr, lwip_netmask, lwip_gwaddr);`。
|
||||||
|
|
|
@ -201,6 +201,11 @@ The STM32F4x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums
|
||||||
*/
|
*/
|
||||||
#define LWIP_SOCKET 1
|
#define LWIP_SOCKET 1
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
|
||||||
|
*/
|
||||||
|
#define LWIP_SO_RCVBUF 1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
---------------------------------
|
---------------------------------
|
||||||
---------- OS options ----------
|
---------- OS options ----------
|
||||||
|
|
|
@ -2009,7 +2009,7 @@
|
||||||
* LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
|
* LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
|
||||||
*/
|
*/
|
||||||
#if !defined LWIP_SO_RCVBUF || defined __DOXYGEN__
|
#if !defined LWIP_SO_RCVBUF || defined __DOXYGEN__
|
||||||
#define LWIP_SO_RCVBUF 1
|
#define LWIP_SO_RCVBUF 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue