
EM38A / EM38A-R / EM38A-X User’s Manual Page 5 of 8
Serial Interface
When the serial interface is enabled, all parallel inputs T1 ~ T8 are
disabled and all Parallel Modes are no longer available.
The serial interface consists of a female DB9 serial port supporting
both RS-232 (default setting) and RS-485. To support RS-485, you
must move the internal jumper JP1 to the “485” setting.
On the DB9 connector, three pins are used for RS-232: pin 2 for
RX, pin 3 for TX, pin 5 for ground. Two pins on the same connector
are used for RS-485: pin 1 for negative, pin 9 for positive.
The hardware protocol is fixed at 9600 baud, eight data bits, no
parity and one stop bit (9600, 8N1). Other protocols may be sup-
ported by special request.
For RS-232 applications, the system (a DCE device) is connected
to a DTE device (such as a PC) with a regular serial cable (not a
null modem cable). For RS-485 applications, up to 32 systems,
each assigned with a unique address, can be daisy chained on the
same bus with a 2-wire cable.
To enable the Serial Mode on the system, the configuration file
must contain a two-digit code ranging from 00 to 98. These two
digits are the only text required for the configuration file. If the code
is 00, the system enters the RS-232 mode. If the code is within 01
to 98, the system enters the RS-485 mode and uses the code as
its address on the RS-485 bus.
The communication protocol uses software handshake on a per-
byte basis. That is, for every byte it receives, the system sends an
confirmation byte to the DTE. The DTE must not send the next byte
until it receives the confirmation, otherwise commands may not be
received properly.
Both the RS-232 mode and the RS-485 mode use the same com-
mand protocol except that in the RS-232 mode, the addressing
step is omitted.
For the RS-485 mode, a communication session always starts with
the addressing step. The DTE sends an ASCII ‘A’ first, followed by
the binary code representing the address. The device should then
respond by sending back an ASCII “a” within 100 ms. Otherwise
the addressing step has failed and should be redone. The address-
ing step must precede each and every command, but is omitted in
the RS-232 mode.
After the addressing step the DTE issues the command one byte
at a time. For each byte sent, the DTE should wait to receive a
proper confirmation within 100 ms. If the confirmation is missing,
invalid or contains an error code, then the session has failed and
may be re-started if necessary.
Relay State Change Report (EM38A-X only)
When EM38A-X is playing a QSA file, it will automatically report
relay state change via the serial port. By monitoring the reports an
external device can learn the progress of the playback. A report is
issued when one or more relays change state, and the format is
xnnn where nnn is the decimal value of the binary form of the cur-
rent relay states. For example, x130 (binary form 10000010) indi-
cates relay 2 and 8 are on and all others are off.
Note that the reports are always sent even if the system is not
configured in the serial mode.
Testing the Serial Interface
The following test can be done on both RS-232 and RS-485 hard-
ware configurations, even though the address code seems unnec-
essary for the RS-232 configuration.
Create a plain text file called “MODE.TXT” on the flash card. Put
only two characters in the file: 66. This sets the player into the RS-
485 mode with an address code of 66.
Put a test sound file “001.mp3” on the flash card.
Connect the player to the PC using a “straight through” serial cable,
not a “null modem” one. A straight through cable has pin 2 con-
nected to pin 2, pin 3 connected to pin 3, and pin 5 connected to
pin 5. Those are the only three pins we use. Other pins, whether
connected or not, do not matter.
Power up the player and run the serial communication program of
your choice on the PC. Create a new connection on the COM port
to which the player is connected, with the following parameters:
Bits per second = 9600
Data bits = 8
Parity = None
Stop bits = 1
Flow control = None
Now we are ready to send the following commands to the player.
We Type Player Responds
------------------------------------------------------
A -
B a (see notes below)
F f
0 0
0 0
1 1
The test is successful if the player starts playing the sound file.
Note that we typed ‘B’ as the RS-485 address code because the
binary value of ASCII ‘B’ is 66 - the number we put in the MODE.TXT
file earlier. If we had written 00 in the MODE.TXT file earlier to put
the system into the RS-232 mode, then we should skip ‘A’ ‘B’ and
type ‘F’ directly.
If you made a mistake and typed a wrong letter during the test, the
player will either respond with a letter ‘e’ (for error) or not respond
at all, depending on the situation. In this case, you need to re-type
the command from the very beginning.
Command Broadcast (firmware 2.6 and above)
Address code 99 can be used to broadcast a command to all units
on the RS-485 bus. In this case, no unit will respond with any
acknowledgement in order to avoic bus conflict. Therefore some
commands, such as Busy? and Get Volume, are meaningless to
broadcast.
Since we can no longer use acknowledgement for flow control,
commands must be sent with a minimum interval of 50ms in be-
tween bytes. Also, we will not be able to know if commands are
properly received by the units.
Command broadcast is usually used to make multiple units start
playing at the same time for synchronization purposes. However,
due to clock variation in each unit, the playback will still gradually
go out of sync over time.