< Mizar32

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.

RJ45 pinNameSignal
1TX+Transmit data
2TX-Transmit data
3RX+Receive data
6RX-Receive data
Signal nameAVR32 pinBus pinName
ETHERNETPA24BUS2 pin 3Ethernet interrupt
REF_CLKPB0BUS1 pin 350MHz reference clock
TX_ENPB1BUS1 pin 4Transmit enable
TX0PB2BUS1 pin 5Transmit data
TX1PB3BUS1 pin 6Transmit data
RX0PB5BUS2 pin 5Receive data
RX1PB6BUS2 pin 6Receive data
RX_ERPB7BUS2 pin 7Receive error
MDCPB8BUS2 pin 4MDIO clock
MDIOPB9BUS2 pin 8MDIO data
RX_DVPB15BUS1 pin 7Receive data valid

Software view

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

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

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.