Principles of Operation
Prev | Chapter 8. Serial Drivers | Next

## Principles of Operation

The basic unit of data transfer over MII and powerline is the IEEE 802.3 Ethernet frame. On output, the host must encapsulate each Ethernet frame as shown below before serial transmission to the QCA7000. The QCA7000 strips off the serial header and footer and forwards the frame over powerline.

Table 8.1. SPI Transmit Frame

Allocate a 1528-byte buffer to accommodate the largest outgoing serial packet and pad with `NUL` bytes. Write `SOF`, compute and write `FL`, copy the outgoing frame then write `EOF`. Serially transmit `FL` + `12` buffer bytes to the QCA7000.

Offset | Length | Symbol | Description
--- | --- | --- | ---
0x0000 | 4 | SOF | Start Of Frame. Must be `0xAAAAAAAA`.
0x0004 | 2 | FL | The Ethernet frame length in little endian format. The frame starts at offset `0x0008` here and includes all fields up to but excluding `EOF`. The minimum is `60`. The maximum is `1518` if `VLAN` is omitted and `1522` if not.
0x0006 | 2 | RSVD | Must be `0x0000`. Reserved to ensure 4-byte frame alignment.
0x0008 | 6 | DA | Destination address.
0x000E | 6 | SA | Source address. This must not be the MAC address of the powerline device. This must be the MAC address of the local host serial interface as assigned by the SP or UART driver. The PLC device and the associated host interface must have different MAC address.
0x0014 | 4 | VLAN | Virtual LAN tag. This field may be omitted.
0x0018 | 2 | ET | Ethertype. This field starts at offset `0x0014` if `VLAN` is omitted.
0x001A | 42 to 1500 | BODY | Frame body. This field starts at offset `0x0016` and ranges from `46` to `1500` bytes if `VLAN` is omitted.
0x004A to 0x05F8 | 4 | EOF | End Of Frame. Must be `0x5555`. This field starts at offset `0x0008` plus `FL`.

Table 8.2. SPI Receive Frame

The SPI read frame occurs in response to a read interrupt generated by the QCA7000. The host must acknowledge a read interrupt and service it by reading and acting on QCA7000 SPI register values. For incoming frames, the host reads the 32-bit overall packet length reported by the QCA7000 then read that many bytes, stripping off the serial header and footer and forwarding the Ethernet frame to the host.

Allocate a 1532-byte buffer to accomodate the largest incoming serial packet. Read `LEN` to determine the size of the incoming serial packet. Read `LEN` bytes into the buffer. Beware that `LEN` is a multiple of 4-bytes so there may be a few trailing `NUL` bytes in buffer.

Offset | Length | Symbol | Description
--- | --- | --- | ---
0x0000 | 4 | LEN | Hardware generated packet length. This field is only generated for SPI packets, not the UART packets.
0x0004 | 4 | SOF | Start Of Frame. Must be `0xAAAAAAAA`.
0x0008 | 2 | FL | Ethernet frame length in little endian format. The frame starts at offset `0x000C` here and includes all fields up to but excluding `EOF`. The minimum length is `60`. The maximum is `1518` if `VLAN` is omitted and `1522` if not.
0x000A | 2 | RSVD | Must be `0x0000`. Reserved to ensure 4-byte frame alignment.
0x000C | 6 | DA | Destination address.
0x0012 | 6 | SA | Source address. This must not be the MAC address of the powerline device. This must be the MAC address of the local host serial interface as assigned by the SP or UART driver. The PLC device and the associated host interface must have different MAC address.
0x0018 | 4 | VLAN | Virtual LAN tag. This field may be omitted.
0x001C | 2 | ET | Ethertype. This field starts offset `0x0018` if `VLAN` is omitted.
0x001E | 42 to 1500 | BODY | Frame body. This field starts at offset `0x001A` and ranges from `46` to `1500` bytes if `VLAN` is omitted.
0x004A to 0x05F8 | 4 | EOF | End Of Frame. Must be `0x5555`. This field starts at offset `0x000C` plus `FL`.

Prev | Up | Next
Chapter 8. Serial Drivers | Home | SPI Serial Driver