Download Circuit Cellar`s - cache.ourdev.cn

Transcript
static applications,
returned and you can configure the
but if the network
stack for up to four automatic retries.
FSK_IN
RSVD
2
27
configuration is large
After the address is a “Command”
PO[4], A, IO
FSK_OUT
3
26
and dynamic (i.e.,
byte. Sixteen commands are defined
RSVD
A, I, P0[1]
4
25
number of nodes
(Table 1) with another 32 reserved and
RSVD
TX_ SHUTDOWN
5
24
the rest available for application use.
unknown
and
changP2[5]
6
23
P2[6], EXTERNAL VREF
ing), consider using
After the command are “Payload
AGND
A, I, P2[3]
7
22
SSOP
RXCOMP_IN
A, I, P2[1]
8
21
Length” (0 to 31 bytes), a sequence
the “PLT + network
RXCOMP_OUT
RSVD
9
20
stack” option.
number (to detect lost/duplicate packXRES
12C SCL, P1[7]
10
19
ets) and a header CRC. These are folBehind the Cypress
P1[6]
12C SDA, P1[5]
11
18
lowed by the payload itself and an
network
stack
is
the
P1[4], EXTCLK
P1[3]
12
17
overall packet CRC.
fairly sophisticated
P1[2]
12C SCL, XTALIN, P1[1]
13
16
P1[0], XTALOUT I2C SDA
VSS
14
15
The media access strategy implepacket structure
mented by the stack features “carrier
shown in Figure 3.
sense” and “collision avoidance. Each
Let’s go through it to
Figure 1—With the same silicon under the hood, the new
Cypress powerline communication chips have a similar pinout
node waits until the line is idle, but
see some of the
and are available in 28-pin (shown here) and 48-pin versions.
then further waits a random amount
embellishments the
of time (between 85 and 115 ms)
stack provides, startbefore initiating transmission. WithPSoC-1 (i.e., M8C core)—whose program- ing with addressing. You can see the
out this “random backoff,” every node
network has plenty of elbow room
mable hardware is configured with a
would try to jump in as soon as the
power-line modem (see Figure 2), option- with 8-, 16- and 64-bit address options,
line goes idle and the network would
the latter taking advantage of the
ally fronted with a bit of software impleunique 64-bit ID each chip comes with get paralyzed by collisions.
menting a simple network protocol.
Of course, there’s no free lunch. The
from the factory. There are also
Now before you get too excited
price for the network stack’s reliabili“group” and “broadcast” options that
thinking about hooking up your
ty and ease of use may be worth it,
support one-to-many and many-to-one
HDTV, realize this modem is a simple
but there is a price to pay—namely,
associations.
half-duplex 2,400-bps unit with perthroughput. You can see that in the
The “Service Type” bit up front is
formance that harkens back to the
worst case (64-bit addresses) transferan innocuous name for a key feature
dial-up days. It’s speedy enough for a
ring a single byte payload would
of the protocol, namely acknowledgelot of simple and useful applications.
require sending a 22-byte packet (i.e., a
ment. When enabled, receivers will
Just be careful not to bite off more
22:1 packet/payload ratio). Fortunateautomatically acknowledge receipt,
bandwidth than the chip can chew.
ly, many applications will be able to
transmitters will timeout in half a
When you checkout the power line
use shorter addresses and/or longer
second if the acknowledgment isn’t
transceiver (PLT) object from the PSoC
payloads to reduce the
Designer library, there are
overhead. For instance,
three options to choose
Network protocol
with 8-bit addresses and
from: basic PLT, PLT + net31-byte payloads, the
work software, and PLT +
packet/payload ratio
network software + I2C.
Digital
would approach 1:1 (e.g.,
The basic PLT option
receiver
Digital
1.2 for a 38-byte packet
gives you raw byte-at-aHysteresis
transmitter
comparator
carrying a 31 byte paytime access to the data
Logic ‘1’ or
Low-pass
load). On the other hand,
link, much like a UART.
Logic
‘0’
Local
filter
External
oscillator
keep in mind that interThe automatically generatlow-pass filter
Modulator
Correlator
mittent interference will
ed API allows configuring
Square wave
be more likely to disrupt
the modem (e.g., bit rate,
at FSK
IF Band
a longer packet than a
gain, noise threshold),
frequencies
pass filter
Local
oscillator
shorter one.
checking if the line is busy
Mixer
Programmable
That brings us to the
(i.e., voltage higher than
gain amplifier
HF Band
PLC10 chip, which uticonfigured threshold), and
pass filter
lizes the final “PLT + nettransmitting and receiving
RX
work stack + I2C” option.
bytes by interrupt or
amplifier
In this case, access to the
polling. With this option
PLT and network stack is
you’ll have to handle all
Coupling circuit
rerouted via the external
the network administraI2C interface. You don’t
tion and error handling
yourself. It’s probably OK
have any direct access to
Fi gure 2 —Cypress takes advantage of the PSoC’s programmable hardware to implement a 2,400-bps, half-duplex FSK powerline modem.
for simple and relatively
the on-chip processor.
A, I, P0[7]
VDD
28
www.circuitcellar.com
•
CIRCUIT CELLAR®
Personal Download for g.ottaviani@mediaprogetti.it I © Circuit Cellar
July 2010 – Issue 240
Receiver
Transmitter
Powerline modem PHY
1
67