您尚未登录。

楼主 #1 2021-04-21 01:13:56

kekemuyu
会员
注册时间: 2018-12-13
已发帖子: 841
积分: 721

esp8266通过串口用作网卡使用

相对于spi或者sdio接口方式,串口的配置更加简单。已经通过笔记本验证,下次验证f1c100s。

https://github.com/martin-ger/esp_slip_router

Usage as STA
In this mode the ESP connects to the internet via an AP with ssid, password and offers at UART0 a SLIP interface with IP address 192.168.240.1. This default can be changed in the file user_config.h.

To connect a Linux-based host, start the firmware on the ESP, connect it via serial to USB, and use the following commands on the host:

sudo slattach -L -p slip -s 115200 /dev/ttyUSB0&
sudo ifconfig sl0 192.168.240.2 pointopoint 192.168.240.1 up mtu 1500
now

telnet 192.168.240.1 7777
gives you terminal access to the esp as router. On the ESP you then enter:

CMD>set ssid <your_ssid> 
CMD>set password <your_pw> 
CMD>set use_ap 0
CMD>save
CMD>reset
To get full internet access you will need aditionally a route:

sudo route add default gw 192.168.240.1
and a DNS server - add an appropriate entry (e.g. public DNS server) in /etc/resolv.conf, eg. by (as root):

echo "nameserver 9.9.9.9" > /etc/resolv.conf

离线

#2 2021-04-21 08:20:20

raspberryman
会员
注册时间: 2019-12-27
已发帖子: 503
积分: 465

Re: esp8266通过串口用作网卡使用

网络通讯也是走串口吗?

离线

#3 2021-04-21 09:08:57

lcfmax
会员
注册时间: 2018-04-13
已发帖子: 319
积分: 272.5

Re: esp8266通过串口用作网卡使用

这个用法有点意思哦

离线

#4 2021-04-21 09:32:40

unturned3
会员
注册时间: 2020-07-01
已发帖子: 262
积分: 300

Re: esp8266通过串口用作网卡使用

raspberryman 说:

网络通讯也是走串口吗?

我看了一眼那个github repo,里头写了 “This is an implementation of a SLIP (Serial Line IP - RFC1055) router on the ESP8266.” 这应该就是说网络通讯也是从串口走的

离线

#5 2021-04-21 09:50:13

演技担当黄晓明
会员
注册时间: 2017-10-17
已发帖子: 183
积分: 121.5

Re: esp8266通过串口用作网卡使用

ppp 的应用?

离线

楼主 #6 2021-04-21 10:43:41

kekemuyu
会员
注册时间: 2018-12-13
已发帖子: 841
积分: 721

Re: esp8266通过串口用作网卡使用

通过slip(串行互联网协议)实现的,这里是wiki详细介绍:
https://en.wikipedia.org/wiki/Serial_Line_Internet_Protocol

离线

楼主 #7 2021-04-21 10:46:26

kekemuyu
会员
注册时间: 2018-12-13
已发帖子: 841
积分: 721

Re: esp8266通过串口用作网卡使用

我的tiny200s内核没有slip驱动,所以报了一下错误:

SLIP_set_disc(1): Invalid argument

将这个驱动编译进内核应该就可以了,当然还需要有slattach 和telnet这两个工具

离线

#8 2021-04-22 19:55:44

小智
会员
注册时间: 2019-10-16
已发帖子: 109
积分: 86

Re: esp8266通过串口用作网卡使用

linux的tap或者tun可以直接使用串口虚拟网卡吧
https://blog.csdn.net/coroutines/article/details/8106674

最近编辑记录 小智 (2021-04-22 19:56:31)

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn