Update README for clarification
This commit is contained in:
parent
5b99525cd0
commit
b38c5ae65b
46
README.md
46
README.md
|
@ -1,11 +1,23 @@
|
||||||
# ENC424J600 Driver
|
# ENC424J600 Driver
|
||||||
|
|
||||||
|
|
||||||
|
## General Instructions
|
||||||
|
|
||||||
|
The ENC424J600 Ethernet controller module supports operation in one of the following interfaces: Serial Peripheral Interace (SPI), or Parallel Slave Port (PSP). This Rust library currently only supports the use of SPI for STM32F4xx microcontrollers.
|
||||||
|
|
||||||
|
On ENC424J600, the **INTn/SPISEL** pin is multiplexed with an **interrupt function** (INTn) and an **interface selection function** (SPISEL). During power-up, to select SPI as the interface, INTn/SPISEL needs to latch a logic high for 1-10 us, driven outside of ENC424J600. After ENC424J600 has been initialsed, the same pin can be used to indicate occurrence of interrupt with a logic low, or idling with a logic high, driven by ENC424J600. Therefore, on the microcontroller side, the mode of driving the pin should be chosen by design: it should be **tri-stated** if interrupt is enabled, or **push-pull** otherwise.
|
||||||
|
|
||||||
|
|
||||||
|
### Instructions for STM32F407 Examples
|
||||||
|
|
||||||
|
These examples assume that the **SPI1** port is connected to the Ethernet module, and the **GPIO PA1** pin is connected to its SPISEL pin. Since no interrupts are involved, GPIO PA1 is configured as a **push-pull** output to only initialise the controller. The program output is logged via ITM stimulus port 0.
|
||||||
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
### Endless Pinging - `tx_stm32f407`
|
### Endless Pinging - `tx_stm32f407`
|
||||||
|
|
||||||
This program demonstrates the Ethernet TX capability on an STM32F407 board connected to an ENC424J600 module via SPI. Once loaded and initialised, a specific ping packet is sent (broadcasted) every 100ms. Such a packet has the following properties:
|
This program demonstrates the Ethernet TX capability on an STM32F407 board. Once loaded and initialised, a specific ping packet is sent (broadcasted) every 100ms. Such a packet has the following properties:
|
||||||
|
|
||||||
* Destination MAC Address: ff-ff-ff-ff-ff-ff
|
* Destination MAC Address: ff-ff-ff-ff-ff-ff
|
||||||
* Source MAC Address: 08-60-6e-44-42-95
|
* Source MAC Address: 08-60-6e-44-42-95
|
||||||
|
@ -13,8 +25,6 @@ This program demonstrates the Ethernet TX capability on an STM32F407 board conne
|
||||||
* Source IP Address: 192.168.1.100
|
* Source IP Address: 192.168.1.100
|
||||||
* Frame Length in Bytes: 64
|
* Frame Length in Bytes: 64
|
||||||
|
|
||||||
This program assumes that the **SPI1** port is connected to the Ethernet module, and the **GPIO PA1** pin is connected to its SPISEL pin. The program output is logged via ITM stimulus port 0.
|
|
||||||
|
|
||||||
#### How-to
|
#### How-to
|
||||||
|
|
||||||
1. Connect your STM32F407 device to the computer. Without changing any code, you may use an STLink V2 debugger. Then, on a console window, run OpenOCD and debug the example program:
|
1. Connect your STM32F407 device to the computer. Without changing any code, you may use an STLink V2 debugger. Then, on a console window, run OpenOCD and debug the example program:
|
||||||
|
@ -49,16 +59,14 @@ Packet sent
|
||||||
|
|
||||||
### TCP Echoing & Greeting - `tcp_stm32f407`
|
### TCP Echoing & Greeting - `tcp_stm32f407`
|
||||||
|
|
||||||
This program demonstrates the TCP connectivity using **smoltcp** on an STM32F407 board connected to an ENC424J600 module via SPI. Once loaded and initialised, two TCP sockets will be opened on a specific IPv4 address. These sockets are:
|
This program demonstrates the TCP connectivity using **smoltcp** on an STM32F407 board. Once loaded and initialised, two TCP sockets will be opened on a specific IPv4 address. These sockets are:
|
||||||
|
|
||||||
1. **Echoing port - 1234**
|
1. **Echoing port - 1234**
|
||||||
* This socket receives raw data on all incoming TCP packets on the said port and prints them back on the output.
|
* This socket receives raw data on all incoming TCP packets on the said port and prints them back on the output.
|
||||||
* Note that this socket has a time-out of 10s.
|
* Note that this socket has a time-out of 10s.
|
||||||
2. **Greeting port - 4321**
|
2. **Greeting port - 4321**
|
||||||
* This socket waits for a single incoming TCP packet on the said port, and sends a TCP packet holding a text of greeting on the port.
|
* This socket waits for a single incoming TCP packet on the said port, and sends a TCP packet holding a text of greeting on the port.
|
||||||
* Note that once a greeting is sent, the port is closed immediately. Further packets received by the controller are dropped until the initiator closes the port.
|
* Note that once a greeting is sent, the socket is closed immediately. Further packets received by the controller are dropped until the initiator disconnects from the port.
|
||||||
|
|
||||||
This program assumes that the **SPI1** port is connected to the Ethernet module, and the **GPIO PA1** pin is connected to its SPISEL pin. The program output is logged via ITM stimulus port 0.
|
|
||||||
|
|
||||||
#### How-to
|
#### How-to
|
||||||
|
|
||||||
|
@ -79,7 +87,7 @@ This program assumes that the **SPI1** port is connected to the Ethernet module,
|
||||||
```sh
|
```sh
|
||||||
$ nc <ip> <port-number>
|
$ nc <ip> <port-number>
|
||||||
```
|
```
|
||||||
Multiple instances of Netcat can run to use all the ports simultaneously. Use Ctrl+C to close the port manually (especially for the greeting port).
|
Multiple instances of Netcat can run to use all the ports simultaneously. Use Ctrl+C to disconnect from the port manually (especially for the greeting port).
|
||||||
|
|
||||||
#### Expected Output
|
#### Expected Output
|
||||||
|
|
||||||
|
@ -92,11 +100,11 @@ Ethernet initialised.
|
||||||
Timer initialised.
|
Timer initialised.
|
||||||
MAC Address = 04-91-62-3e-fc-1e
|
MAC Address = 04-91-62-3e-fc-1e
|
||||||
TCP sockets will listen at 192.168.1.77/24
|
TCP sockets will listen at 192.168.1.77/24
|
||||||
[0.0s] Listening to port 1234 for echoing, auto-closing in 10s
|
[0.0s] Listening to port 1234 for echoing, time-out in 10s
|
||||||
[0.0s] Listening to port 4321 for greeting, please open the port
|
[0.0s] Listening to port 4321 for greeting, please connect to the port
|
||||||
```
|
```
|
||||||
|
|
||||||
The user opens port 1234 and sends two packets with the following commands:
|
The user connects to port 1234 and sends two packets with the following commands:
|
||||||
```sh
|
```sh
|
||||||
$ nc 192.168.1.77 1234
|
$ nc 192.168.1.77 1234
|
||||||
Hello World!
|
Hello World!
|
||||||
|
@ -109,7 +117,7 @@ The following is appended to the ITM output:
|
||||||
[19.0s] Received packet: Ok("Bye world!\n")
|
[19.0s] Received packet: Ok("Bye world!\n")
|
||||||
```
|
```
|
||||||
|
|
||||||
The user then opens port 4321 with the following command, and immediately receives the following message on their console:
|
The user then connects port 4321 with the following command, and immediately receives the following message on their console:
|
||||||
```sh
|
```sh
|
||||||
$ nc 192.168.1.77 4321
|
$ nc 192.168.1.77 4321
|
||||||
Welcome to the server demo for STM32-F407!
|
Welcome to the server demo for STM32-F407!
|
||||||
|
@ -120,23 +128,23 @@ The following is appended to the ITM output:
|
||||||
[24.200s] Greeting sent, socket closed
|
[24.200s] Greeting sent, socket closed
|
||||||
```
|
```
|
||||||
|
|
||||||
After 10 seconds of the user not sending any more packets on port 1234, the following is appended to the ITM output; meanwhile, port 1234 is closed by `nc` for the user:
|
After 10 seconds of the user not sending any more packets on port 1234, the following is appended to the ITM output; meanwhile, the socket is closed by `nc` for the user:
|
||||||
```
|
```
|
||||||
[29.0s] Listening to port 1234 for echoing, auto-closing in 10s
|
[29.0s] Listening to port 1234 for echoing, time-out in 10s
|
||||||
```
|
```
|
||||||
|
|
||||||
The user can now re-open port 1234 again.
|
The user can now re-connect to port 1234 again.
|
||||||
|
|
||||||
For port 4321, without closing the port by exiting `nc`, the user keeps sending any packets with the utility. Since the Ethernet controller has already closed the port, these new packets are dropped and the following error messages are appended to the ITM output:
|
For port 4321, without closing the port by exiting `nc`, the user keeps sending any packets with the utility. Since the Ethernet controller has already closed the socket, these new packets are dropped and the following error messages are appended to the ITM output:
|
||||||
```
|
```
|
||||||
[35.950s] Poll error: Dropped
|
[35.950s] Poll error: Dropped
|
||||||
[36.150s] Poll error: Dropped
|
[36.150s] Poll error: Dropped
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
The user then closes port 4321 by exiting `nc`, and the following message is appended to the ITM output:
|
The user then disconnects from port 4321 by exiting `nc`, and the following message is appended to the ITM output:
|
||||||
```
|
```
|
||||||
[40.200s] Listening to port 4321 for greeting, please open the port
|
[40.200s] Listening to port 4321 for greeting, please connect to the port
|
||||||
```
|
```
|
||||||
|
|
||||||
The user can now re-open port 4321 again.
|
The user can now re-connect to port 4321 again.
|
||||||
|
|
Loading…
Reference in New Issue