The Mizar32 has an add-on hardware module which lets us connect the Mizar32 to the internet.
The Ethernet add-on module is a half-width board which plugs into the left half of the add-on bus connectors, BUS1, BUS2 and BUS3. The hardware module converts the ethernet signals provided by the AVR32UC3A chip into the voltage levels required on an RJ45 connector to connect it to a hub, switch or router.
The board houses a DP83848 Ethernet transceiver, which generates and receives the raw ethernet signals and communicates their contents to the AVR32UC3 on the main board using the RMII protocol, which reduces the number of bus pins necessary to achieve this.
|Signal name||AVR32 pin||Bus pin||Name|
|ETHERNET||PA24||BUS2 pin 3||Ethernet interrupt|
|REF_CLK||PB0||BUS1 pin 3||50MHz reference clock|
|TX_EN||PB1||BUS1 pin 4||Transmit enable|
|TX0||PB2||BUS1 pin 5||Transmit data|
|TX1||PB3||BUS1 pin 6||Transmit data|
|RX0||PB5||BUS2 pin 5||Receive data|
|RX1||PB6||BUS2 pin 6||Receive data|
|RX_ER||PB7||BUS2 pin 7||Receive error|
|MDC||PB8||BUS2 pin 4||MDIO clock|
|MDIO||PB9||BUS2 pin 8||MDIO data|
|RX_DV||PB15||BUS1 pin 7||Receive data valid|
eLua has a
net module which lets you make TCP connections to other computer and receive incoming TCP connections from them, send and receive data and disconnect.
The following example waits for an incoming connection on port 23, then receives data from the network and prints it on console.
-- wait for an incoming connection on the TELNET port socket, remote, err = net.accept( 23 ) if err ~= net.ERR_OK then print( "Error waiting for connection" ) else -- print all lines of data until they close the connection repeat res, err = net.recv( socket, "*l" ) if err ~= net.ERR_OK then print( res ) end until err ~= net.ERR_OK end net.close( socket )
IP address assignment
The standard Mizar32 firmware with ethernet support (20120123 firmware for models A and B) requests an ethernet address using DHCP. If it cannot find a DHCP server on the local network, it gives up after 60 seconds and assigns itself the address 192.168.1.10 with gateway and DNS server of 192.168.1.1.
You can assign a fixed IP address that will be available immediately by using the Mizar32 Web Builder to create your own firmware: click on "Mizar32 Web Builder", then "Build Now", then select BUILD_UIP, clear BUILD_DHCP and set your required IP address in the fields at the bottom of the page. Instructions for programming the resulting firmware file to the board are on the page "Flashing firmware".
- The eLua Reference Manual's page for the net module
- The Atmel AVR32UC3A datasheet, section 29 "Ethernet MAC"
- The DP84838I transceiver datasheet