w5500 - w5500 Ethernet driver#
Adapted Air780E/Air700E Air780EP/Air780EPV Air601 Air101/Air103 Air105 ESP32C3 ESP32S3
Note
This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!
Tip
This library has its own demo,click this link to view the demo example of w5500
w5500.init(spiid, speed, cs_pin, irq_pin, rst_pin, link_pin)#
Initialization w5500
Parameters
Incoming Value Type |
Explanation |
---|---|
int |
spi Channel number, such as 0,1, 5, selected according to the actual situation of the equipment |
int |
spi Speed, can be set to the highest speed of the corresponding SPI |
int |
cs pin, Foot selection, corresponding to W5500 SCS |
int |
irq pin, Break foot, corresponding to W5500 INT |
int |
reset pin, Reset foot, corresponding to W5500 RST |
int |
link The status pin can be left blank and not used by default. |
Return Value
None
Examples
w5500.init(spi.SPI_0, 24000000, pin.PB13, pin.PC08, pin.PC09)
w5500.config(ip, submask, gateway, mac, RTR, RCR, speed)#
w5500 Configure network information
Parameters
Incoming Value Type |
Explanation |
---|---|
string |
Static ip address, if you need to use DHCP to obtain, please write nil |
string |
subnet mask, ignored if dynamic ip is used |
string |
gateway, ignored if dynamic ip is used |
string |
MAC,When writing nil, it is automatically generated by MCU unique code. If you want to write nil, the length must be 6byte |
int |
Retry interval, default 2000, unit 100us, do not change if you do not understand |
int |
The maximum number of retries, the default is 8, do not change what you do not understand. |
int |
Speed type, currently only 0 hardware configuration, 1 adaptive, default is 0 |
Return Value
None
Examples
w5500.config("192.168.1.2", "255.255.255.0", "192.168.1.1", string.fromHex("102a3b4c5d6e"))
w5500.bind(id)#
Register the w5500 into the Common Network Interface
Parameters
Incoming Value Type |
Explanation |
---|---|
int |
Common Network Channel Number |
Return Value
None
Examples
-- If the version used does not have socket library, change it network.ETH0
w5500.bind(socket.ETH0)
w5500.getMac()#
Obtaining the current MAC of w5500 must be used after init. If your own MAC is set in config, you need to delay reading it again.
Parameters
None
Return Value
return value type |
explanation |
---|---|
string |
Current MAC |
Examples
local mac = w5500.getMac()
log.info("w5500 mac", mac:toHex())