mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 23:28:29 +08:00
esp32: Add wifishare board config and documentation
Signed-off-by: Alan C. Assis <acassis@gmail.com>
This commit is contained in:
committed by
Xiang Xiao
parent
a521fd7b82
commit
b95fd6a573
@@ -965,6 +965,89 @@ Find your board IP using ``nsh> ifconfig`` and then from your computer::
|
||||
Where x and y are the last two numbers of the IP that your router gave to
|
||||
your board.
|
||||
|
||||
wifishare
|
||||
---------
|
||||
|
||||
The ``wifishare`` let your ESP32 board to work as Access Point (WiFi Router)
|
||||
and WiFi Station at same time. This way your board will connect to a real
|
||||
WiFi Router (from your ISP for example) and will offer WiFi connection to other
|
||||
devices and share WiFi connection with them.
|
||||
|
||||
After configuring the ``esp32-devkit:wifishare`` you need to define your
|
||||
credentials in the menuconfig. You can define your credentials this way::
|
||||
|
||||
$ make menuconfig
|
||||
-> Application Configuration
|
||||
-> Network Utilities
|
||||
-> Network initialization (NETUTILS_NETINIT [=y])
|
||||
-> WAPI Configuration
|
||||
|
||||
After compile and flash your board you need to confirm you have two interfaces:
|
||||
|
||||
nsh> ifconfig
|
||||
wlan0 Link encap:Ethernet HWaddr bc:dd:c2:d4:a9:ec at RUNNING mtu 1504
|
||||
inet addr:192.168.0.7 DRaddr:192.168.0.1 Mask:255.255.255.0
|
||||
|
||||
wlan1 Link encap:Ethernet HWaddr bc:dd:c2:d4:a9:ed at DOWN mtu 1504
|
||||
inet addr:0.0.0.0 DRaddr:0.0.0.0 Mask:0.0.0.0
|
||||
|
||||
Now you need to configure your wlan1 to become a WiFi Access Point:
|
||||
|
||||
nsh> dhcpd_start wlan1
|
||||
nsh> wapi psk wlan1 mypasswd 3
|
||||
nsh> wapi essid wlan1 nuttxap 1
|
||||
|
||||
And you need to make the route to your WiFi Router (i.e. 192.168.0.1) the default route:
|
||||
|
||||
nsh> addroute default 192.168.0.1 wlan0
|
||||
nsh> route
|
||||
SEQ TARGET NETMASK ROUTER
|
||||
1. 0.0.0.0 0.0.0.0 192.168.0.1
|
||||
|
||||
Finally we will setup an iptables rule to NAT the wlan0 interface:
|
||||
|
||||
nsh> iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
|
||||
|
||||
After connectig a client (i.e. Linux computer) to the `nuttxap` Access Point
|
||||
you can confirm it is working this way:
|
||||
|
||||
$ ifconfig
|
||||
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
|
||||
inet 127.0.0.1 netmask 255.0.0.0
|
||||
inet6 ::1 prefixlen 128 scopeid 0x10<host>
|
||||
loop txqueuelen 1000 (Local Loopback)
|
||||
RX packets 5666 bytes 547514 (547.5 KB)
|
||||
RX errors 0 dropped 0 overruns 0 frame 0
|
||||
TX packets 5666 bytes 547514 (547.5 KB)
|
||||
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
|
||||
|
||||
wlp0s20f3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
|
||||
inet 10.0.0.4 netmask 255.255.255.0 broadcast 10.0.0.255
|
||||
inet6 xxxx::xxxx:xxx:xxxx:xx prefixlen 64 scopeid 0x20<link>
|
||||
ether xx:xx:xx:xx:xx:xx txqueuelen 1000 (Ethernet)
|
||||
RX packets 127217 bytes 146539379 (146.5 MB)
|
||||
RX errors 0 dropped 0 overruns 0 frame 0
|
||||
TX packets 37079 bytes 23604536 (23.6 MB)
|
||||
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
|
||||
|
||||
$ ping 10.0.0.1
|
||||
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
|
||||
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=3.28 ms
|
||||
64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=9.72 ms
|
||||
64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=2.63 ms
|
||||
64 bytes from 10.0.0.1: icmp_seq=4 ttl=64 time=18.9 ms
|
||||
64 bytes from 10.0.0.1: icmp_seq=5 ttl=64 time=4.82 ms
|
||||
|
||||
$ ping 8.8.8.8
|
||||
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
|
||||
64 bytes from 8.8.8.8: icmp_seq=1 ttl=111 time=63.0 ms
|
||||
64 bytes from 8.8.8.8: icmp_seq=2 ttl=111 time=51.4 ms
|
||||
64 bytes from 8.8.8.8: icmp_seq=3 ttl=111 time=55.0 ms
|
||||
64 bytes from 8.8.8.8: icmp_seq=4 ttl=111 time=64.3 ms
|
||||
64 bytes from 8.8.8.8: icmp_seq=5 ttl=111 time=52.8 ms
|
||||
|
||||
That is it. You can use this 8.8.8.8 as DNS to resolve names.
|
||||
|
||||
Debugging with OpenOCD
|
||||
======================
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_ARCH_LEDS is not set
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ALLOW_BSD_COMPONENTS=y
|
||||
CONFIG_ARCH="xtensa"
|
||||
CONFIG_ARCH_BOARD="esp32-devkitc"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_ESP32_DEVKITC=y
|
||||
CONFIG_ARCH_CHIP="esp32"
|
||||
CONFIG_ARCH_CHIP_ESP32=y
|
||||
CONFIG_ARCH_CHIP_ESP32WROVER=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_XTENSA=y
|
||||
CONFIG_BOARDCTL_RESET=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEV_URANDOM=y
|
||||
CONFIG_DRIVERS_IEEE80211=y
|
||||
CONFIG_DRIVERS_WIRELESS=y
|
||||
CONFIG_ESP32_SPIFLASH=y
|
||||
CONFIG_ESP32_SPIFLASH_SPIFFS=y
|
||||
CONFIG_ESP32_STORAGE_MTD_SIZE=0x80000
|
||||
CONFIG_ESP32_UART0=y
|
||||
CONFIG_ESP32_WIFI=y
|
||||
CONFIG_ESP32_WIFI_STATION_SOFTAP=y
|
||||
CONFIG_EXAMPLES_DHCPD=y
|
||||
CONFIG_EXPERIMENTAL=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=3072
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INIT_STACKSIZE=3072
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_MM_REGIONS=3
|
||||
CONFIG_NAME_MAX=48
|
||||
CONFIG_NETDB_DNSCLIENT=y
|
||||
CONFIG_NETDEV_LATEINIT=y
|
||||
CONFIG_NETDEV_PHY_IOCTL=y
|
||||
CONFIG_NETDEV_WIRELESS_IOCTL=y
|
||||
CONFIG_NETINIT_DHCPC=y
|
||||
CONFIG_NETINIT_WAPI_PASSPHRASE="YOUR_ROUTER_PASSWORD"
|
||||
CONFIG_NETINIT_WAPI_SSID="YOUR_ROUTER_PASSWORD"
|
||||
CONFIG_NETLINK_ROUTE=y
|
||||
CONFIG_NETUTILS_CJSON=y
|
||||
CONFIG_NETUTILS_DHCPC_BOOTP_FLAGS=0x0000
|
||||
CONFIG_NETUTILS_DHCPD=y
|
||||
CONFIG_NETUTILS_TELNETD=y
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NET_ETH_PKTSIZE=1518
|
||||
CONFIG_NET_ICMP=y
|
||||
CONFIG_NET_ICMP_SOCKET=y
|
||||
CONFIG_NET_IPFORWARD=y
|
||||
CONFIG_NET_IPFORWARD_BROADCAST=y
|
||||
CONFIG_NET_NAT=y
|
||||
CONFIG_NET_NETLINK=y
|
||||
CONFIG_NET_ROUTE=y
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_TCP_DELAYED_ACK=y
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=300
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_PTHREAD_MUTEX_TYPES=y
|
||||
CONFIG_RAM_SIZE=114688
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SIG_DEFAULT=y
|
||||
CONFIG_SPI=y
|
||||
CONFIG_SPIFFS_NAME_MAX=48
|
||||
CONFIG_START_DAY=6
|
||||
CONFIG_START_MONTH=12
|
||||
CONFIG_START_YEAR=2011
|
||||
CONFIG_SYSLOG_BUFFER=y
|
||||
CONFIG_SYSTEM_DHCPC_RENEW=y
|
||||
CONFIG_SYSTEM_IPTABLES=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_PING=y
|
||||
CONFIG_TLS_TASK_NELEM=4
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_WIRELESS=y
|
||||
CONFIG_WIRELESS_WAPI=y
|
||||
CONFIG_WIRELESS_WAPI_CMDTOOL=y
|
||||
CONFIG_WIRELESS_WAPI_INITCONF=y
|
||||
CONFIG_WIRELESS_WAPI_STACKSIZE=4096
|
||||
Reference in New Issue
Block a user