Introduction

edit

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

Hardware view

edit

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.

RJ45 pin Name Signal
1 TX+ Transmit data
2 TX- Transmit data
3 RX+ Receive data
6 RX- Receive data
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

Software view

edit

Alcor6L 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.

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 pio.pin.setdir(). 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

edit

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

edit