Mizar32/Ethernet

= Introduction = The Mizar32 has an add-on hardware module which lets us connect the Mizar32 to the internet.

= Hardware view = 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.

=Software view= Alcor6L has a  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.

In eLua:

-- 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" ) -- That's *L not *One if err ~= net.ERR_OK then print( res ) end until err ~= net.ERR_OK end net.close( socket )

If the Ethernet hardware is not present, its bus pins can be used as as generic PIO pins by calling. For example, to use BUS1 pin 6 as a PIO output, you could use:

pio.pin.setdir(pio.OUTPUT, pio.PB_3)

In PicoLisp:

Please note: Alcor6L doesn't have the Ethernet module for PicoLisp yet. We're working on it. It will be supported soon. Please see issue #10

IP address assignment
The ethernet software included in the standard 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".

=Further reading=
 * The eLua Reference Manual's page for the net module
 * The Atmel AVR32UC3A datasheet, section 29: Ethernet MAC
 * The DP84838I transceiver datasheet