|
本帖最后由 北极熊 于 2019-6-11 11:33 编辑
单片机:STM32F407ZGTx
GSM模块:SIM800C
IP协议栈:Lwip-2.1.2
操作系统:FreeRTOS V10.1.1
实现原理:采用SIM800C内嵌PPP及Lwip对PPP拨号的支持,使用PPPos进行拨号上网。可实现TCP、UDP及Http等通信。
/*
* Lwip Initfunc
* ===================
*
* Initialize the TCP/IP protocol stack
* Creat a new PPPos interface and connect...
*
*/
/* Lwip Initfunc */
void lwip_comm_init(void)
{
/* Initfunc a function to call when tcpip_thread is running and finished initializing */
tcpip_init(modem_init,NULL);
//Create a new PPPoS interface
ppp = pppos_create(&ppp_netif, pppos_output_cb, ppp_link_status_cb, NULL);
/* Auth configuration, this is pretty self-explanatory */
ppp_set_auth(ppp, PPPAUTHTYPE_NONE, "", "");
/* Set this interface as default route */
ppp_set_default(ppp);
/* Initiate PPP negotiation, without waiting (holdoff=0), can only be called if PPP session is in the dead state (i.e. disconnected). */
ppp_connect(ppp, 0);
}
源码整理中,技术交流QQ:1018062633
|
-
用STM32+FreeRTOS+SIM800C+LWIP+PPP拨号写的Ping应用例子!
|