mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-19 19:40:56 +00:00
Update Makefiles and READMEs
This commit is contained in:
1 parent
70799101e4
commit
eaa6199de0
8 files changed
+4
-144
No files matched your search
@@ -21,6 +21,3 @@ pico_enable_stdio_uart(firmware 0) # to USB
|
|||||||
# Mongoose build flags
|
# Mongoose build flags
|
||||||
add_definitions(-DMG_ENABLE_TCPIP=1)
|
add_definitions(-DMG_ENABLE_TCPIP=1)
|
||||||
add_definitions(-DMG_ENABLE_PACKED_FS=1)
|
add_definitions(-DMG_ENABLE_PACKED_FS=1)
|
||||||
|
|
||||||
# Extra build flags (enable if needed)
|
|
||||||
add_definitions(-DDUAL_CONFIG=0)
|
|
||||||
@@ -1,63 +1 @@
|
|||||||
|
See detailed tutorial (including hardware connections) at https://mongoose.ws/tutorials/rp2040/pico-rmii/
|
||||||
# RMII with the PIO in an RP2040 for 10Mbps Ethernet
|
|
||||||
|
|
||||||
- Full-duplex 10Mbps
|
|
||||||
- RMII Tx implemented with a PIO state machine and single-buffer DMA transfers
|
|
||||||
- Once the DMA starts sending to the PIO, subsequent attempts to tx will block
|
|
||||||
- RMII Rx implemented with a PIO state machine and ping-pong buffer DMA transfers
|
|
||||||
- PIO code handles the CSR_DV signal, stops and raises an IRQ on frame ending. CRC is calculated later for minimum dead time between frames
|
|
||||||
- SMI implemented with a PIO state machine
|
|
||||||
- The RP2040 is clocked from the LAN8720 and works at 50MHz
|
|
||||||
- CRC calculation uses a fast table-based algorithm that doesn't require much storage (nibble calculation)
|
|
||||||
|
|
||||||
## Hardware connections
|
|
||||||
|
|
||||||
You can change most pins at will, bear in mind that each function requires consecutive pins, see main.c
|
|
||||||
The RETCLK (should be REFCLK...) pin can go to either GPIO20 or GPIO22
|
|
||||||
|
|
||||||
| LAN8720 | | Raspberry Pi Pico | |
|
|
||||||
| ----------- | ----------- |----------------- | -- |
|
|
||||||
| 1,2 | VCC | 3V3 | 36 |
|
|
||||||
| 3,4 | GND | GND | 38 |
|
|
||||||
| 5 | MDC | GPIO15 | 20 |
|
|
||||||
| 6 | MDIO | GPIO14 | 19 |
|
|
||||||
| 7 | CRS | GPIO8 | 11 |
|
|
||||||
| 8 | nINT / RETCLK | GPIO20 | 26 |
|
|
||||||
| 9 | RX1 | GPIO7 | 10 |
|
|
||||||
| 10 | RX0 | GPIO6 | 9 |
|
|
||||||
| 11 | TX0 | GPIO10 | 14 |
|
|
||||||
| 12 | TX-EN | GPIO12 | 16 |
|
|
||||||
| 13 |
|
|
||||||
| 14| TX1 | GPIO11 | 15 |
|
|
||||||
|
|
||||||
|
|
||||||
## Build and run
|
|
||||||
|
|
||||||
Clone Mongoose repo, go to this example, and build it:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git clone https://github.com/cesanta/mongoose
|
|
||||||
cd mongoose/examples/rp2040/pico-rmii
|
|
||||||
make build
|
|
||||||
```
|
|
||||||
|
|
||||||
This will generate a firmware file: `build/firmware.uf2`. Reboot your Pico board in bootloader mode, and copy it to the RPI disk.
|
|
||||||
|
|
||||||
Attach to the serial console, wait a couple of seconds, then plug in your Ethernet cable:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ picocom /dev/ttyACM0 -i -b 115200 --imap=lfcrlf
|
|
||||||
6213 1 mongoose.c:6757:onstatechange Link up
|
|
||||||
6217 3 mongoose.c:6840:tx_dhcp_discover DHCP discover sent
|
|
||||||
621b 3 mongoose.c:6723:arp_cache_add ARP cache: added 192.168.69.2 @ 52:54:...
|
|
||||||
6222 2 mongoose.c:6749:onstatechange READY, IP: 192.168.69.243
|
|
||||||
6227 2 mongoose.c:6750:onstatechange GW: 192.168.69.1
|
|
||||||
622b 2 mongoose.c:6752:onstatechange Lease: 21600 sec
|
|
||||||
```
|
|
||||||
|
|
||||||
Note the acquired IP address printed (you can also check your DHCP server). Point your browser to that address, or run curl, you should see an "ok" message:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ curl 192.168.69.243
|
|
||||||
ok
|
|
||||||
```
|
|
||||||
@@ -1,25 +1,7 @@
|
|||||||
|
|
||||||
# Device Dashboard via RNDIS on an RP2040
|
# Device Dashboard via RNDIS on an RP2040
|
||||||
|
|
||||||
Your headless Raspberry Pi Pico-based hardware can also have a device dashboard on a web browser when you connect it to your computer via USB
|
Your headless Raspberry Pi Pico-based hardware can also have a device dashboard on a web browser when you connect it to your computer via USB
|
||||||
|
|
||||||
## Build and run
|
- See detailed tutorial at https://mongoose.ws/tutorials/rp2040/pico-rndis-dashboard/
|
||||||
|
|
||||||
Clone Mongoose repo, go to this example, and build it:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git clone https://github.com/cesanta/mongoose
|
|
||||||
cd mongoose/examples/rp2040/pico-rndis-dashboard
|
|
||||||
make build
|
|
||||||
```
|
|
||||||
|
|
||||||
This will generate a firmware file: `build/firmware.uf2`. Reboot your Pico board in bootloader mode, and copy it to the RPI disk.
|
|
||||||
|
|
||||||
The device will reboot, register as a USB RNDIS device, and add a network and a removable read-only disk to your computer.
|
|
||||||
Open the new drive, named `Mongoose`, and double click on its `INDEX.HTM` file; your browser should open and you should see a device dashboard.
|
|
||||||
|
|
||||||
Alternatively, you may just run a browser, and open 192.168.3.1,
|
|
||||||
|
|
||||||
Note: USB stdio in the Pico-SDK is done in background with TinyUSB and an interrupt to hide it from the user and periodically call tusb_task(). When we use TinyUSB, that code is removed from the compilation list; so this example uses UART stdio (UART 0) to keep things simple and focused on the RNDIS example. If you want to see the console output, connect an USB-to-UART or a low-voltage-TTL-to-RS-232 adapter to GPIO0
|
|
||||||
|
|
||||||
Note for Mac users: For this example to run on Mac, please set `DUAL_CONFIG=1` in `CMakeLists.txt` before building; this enables CDC-ECM. Please notice that Windows may not recognize the mass-storage device in that case.
|
Note for Mac users: For this example to run on Mac, please set `DUAL_CONFIG=1` in `CMakeLists.txt` before building; this enables CDC-ECM. Please notice that Windows may not recognize the mass-storage device in that case.
|
||||||
@@ -22,6 +22,3 @@ add_definitions(-DMG_ENABLE_PACKED_FS=1)
|
|||||||
add_definitions(-DMG_ENABLE_MBEDTLS=0) # TODO(cpq): enable
|
add_definitions(-DMG_ENABLE_MBEDTLS=0) # TODO(cpq): enable
|
||||||
add_definitions(-DMG_ENABLE_CUSTOM_RANDOM=1)
|
add_definitions(-DMG_ENABLE_CUSTOM_RANDOM=1)
|
||||||
add_definitions(-DMG_ENABLE_FILE=0)
|
add_definitions(-DMG_ENABLE_FILE=0)
|
||||||
|
|
||||||
# Extra build flags (enable if needed)
|
|
||||||
add_definitions(-DDUAL_CONFIG=0)
|
|
||||||
@@ -1,57 +1,3 @@
|
|||||||
# RP2040 with W5500 Ethernet module
|
# RP2040 + W5500 Ethernet chip
|
||||||
|
|
||||||
This repository demonstrates how to use RP2040 with W5500 Ethernet module,
|
- See detailed tutorial (including hardware connections) at https://mongoose.ws/tutorials/rp2040/pico-w5500/
|
||||||
to implement networking. In this example, a very simple HTTP server is
|
|
||||||
implemented. See [other examples](../..) for more functionality.
|
|
||||||
|
|
||||||
## RP2040 Pico wiring
|
|
||||||
|
|
||||||
The W5500 module uses SPI for communication. The following pins are used
|
|
||||||
by this example (modify `main.c` if you use a different pinout):
|
|
||||||
|
|
||||||
```c
|
|
||||||
enum { LED = 25, SPI_CS = 17, SPI_CLK = 18, SPI_TX = 19, SPI_RX = 16 };
|
|
||||||
```
|
|
||||||
|
|
||||||
On a breadboard, it might look like this:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Pinout reference
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Build and run
|
|
||||||
|
|
||||||
Clone Mongoose repo, go to this example, and build it:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git clone https://github.com/cesanta/mongoose
|
|
||||||
cd mongoose/examples/ro2040/pico-w5500
|
|
||||||
make
|
|
||||||
```
|
|
||||||
|
|
||||||
The above will make a firmware in `build/example.uf2`. Reboot your Pico
|
|
||||||
board in bootloader mode, and copy `example.uf2` to the RPI disk.
|
|
||||||
|
|
||||||
Attach serial console. Then, plug in Ethernet cable:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ cu -l /dev/cu.usb* -s 115200
|
|
||||||
4653 2 main.c:79:main Ethernet: down
|
|
||||||
520b 2 main.c:79:main Ethernet: down
|
|
||||||
5dc3 2 main.c:79:main Ethernet: down
|
|
||||||
6593 1 mongoose.c:6757:onstatechange Link up
|
|
||||||
659a 3 mongoose.c:6840:tx_dhcp_discover DHCP discover sent
|
|
||||||
667b 3 mongoose.c:6723:arp_cache_add ARP cache: added 192.168.0.1 @ 90:5c:44:55:19:8b
|
|
||||||
667d 2 mongoose.c:6749:onstatechange READY, IP: 192.168.0.24
|
|
||||||
667e 2 mongoose.c:6750:onstatechange GW: 192.168.0.1
|
|
||||||
6680 2 mongoose.c:6752:onstatechange Lease: 86062 sec
|
|
||||||
697b 2 main.c:79:main Ethernet: up
|
|
||||||
7533 2 main.c:79:main Ethernet: up
|
|
||||||
```
|
|
||||||
|
|
||||||
Note the aquired IP address printed. Run a browser, and type that IP address
|
|
||||||
in the address field. You should see an "ok" message in a browser:
|
|
||||||
|
|
||||||

|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 55 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 336 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 351 KiB |
Reference in new issue
Block a user