AN002. Practical Advice on Integrating EM Module into Your Device

What's in this Application Note

Over the cause of the past several years we have been in constant contact with Companies that are using our Ethernet-to-serial Modules (such as EM100 ) to network-enable their products. Invaluable experience and feedback that we have received in the process has helped us realize that some practical aspects of the Module integration are not always understood early enough in the product design cycle. As a result some devices that utilize our Modules were designed without proper consideration for the practical issues that may arise during the manufacturing or operation of the Device. This Application Note summarizes our experience. Follow the suggestions below and you may well save yourself a lot of headache in the future.

note_tip-wt

This application note does not only apply to EM100! EM100 is used as an example device, but the advice below also applies to EM203A, EM200, and other Tibbo embedded products.

Contents:

  • Position the Module as close as possible to the RJ45 connector, do proper layout

  • Make sure you supply good power at required current

  • Proper reset is a must!

  • Provide status LEDs, prog/init button, and serial access connector

  • Let your main CPU control the Module...

  • ...Or let the EM Module control your main CPU

Position the Module as close as possible to the RJ45 connector, do proper layout

Note: this part applies to all Tibbo Modules.

Improperly positioned EM Module will generate a lot of noise (EMI or Electro-Magnetic Emission). Put the EM, its Ethernet magnetics (if not built into the Module), and RJ45 connector as close as possible to each other. Failing to do so will make passing CE (FCC) EMI test very difficult! Additional problems may include communications problems and susceptibility to electrostatic discharge (ESD) damage.

There is a common misunderstanding regarding the CE/FCC EMI certification of our Modules. Being Modules, they are not certified "as is" but are tested on a particular PCB, usually our Evaluation Board . These boards have proper PCB layout and a conclusion is drawn that if the EM Module can pass the test on such a board then it can pass a test on another board with a proper layout. So, even though the EM Module itself is pre-tested your whole device may require CE/FCC certification.

Shown below is a proper layout for the EM100 Ethernet Module. This Module has Ethernet magnetics built-in, so only RJ45 connector must be added externally. The main point here is the length of wires that link the pins of the RJ45 connector to the RX-, RX+, TX-, TX+ pins of the EM100. The shorter the length, the lower the noise.

an002_em100_pcb_layout

Another important point. Do not create a ground plane in the vicinity of the RJ45 connector and RX-, RX+, TX-, and TX+ lines. The ground plane should "wrap around" the RJ45 area, but not cross any of the 4 interface wires. This is very important! Providing a ground plane beneath the connector area will make your device very susceptible to the ESD.

Make sure you supply good power at required current

Tibbo EM Modules are just like IC chips- they require a regulated DC power source, 5V nominal, +/- 5% deviation. Some Modules (such as EM200 ) consume relatively high current (~230mA)! We provide this data in our Documentation and yet we still have cases where our Customers use "bad" power supplies. So, this advise is simple: make sure you supply regulated 5V DC and that your power supply can offer necessary current.

Proper reset is a must!

Tibbo EM Modules do not have internal reset circuits so you must provide an external power-on reset. It is not enough to just tie the RST pin to VCC, this won't work! We also do not recommend using a simple RC-circuit. Such circuits are not reliable because they do not monitor the supply voltage and won't work properly under many circumstances.

For example, if you have a power supply that "starts slowly" (i.e. its voltage rises slowly after the powerup) then the reset pulse generated by the RC circuit may end before the VCC comes to within 5V-5%. Another problem condition is a "brownout" (this is when the VCC momentarily goes below 5V-5%). Brownouts can cause the EM Module to hang up. Use a proper reset IC instead- this will give you a very reliable reset both on startup and in case of a brownout. Some reset ICs (for example MAX810 from MAXIM) have a very attractive price now (about USD0.5). Reset IC you use must have the following spec: (1) active high reset, (2) reset pulse of at least 100ms, (3) reset threshold of around 4.7V. If your device already has a matching reset IC then you can use its output for the EM Module as well.

Another possible reset arrangement is to use a free I/O pin of your device's main CPU. I/O pins of most CPUs default to HIGH state upon hardware reset. For example, supposing that your device is based on the x51 microcontroller. You already have a reset circuit for this microcontroller so why would you add yet another one to reset the EM Module? You can connect an unused I/O pin of the x51 to the RST pin of the EM. On startup the x51 will receive a proper reset from the reset circuit and its I/O pins will be in the HIGH state. This will provide a reliable reset to the EM. You can modify the code of your main microcontroller to switch the "reset" I/O pin to LOW after a delay of, say, 100ms.

We recommend you to use this "CPU-controlled reset" approach whenever possible. Not only it lowers your cost (no need for an extra reset IC) but also gives your main CPU the ability to reset the EM Module at any time. This, as we will show later, can come very handy if you want to enable your CPU to program the settings of the EM and/or upgrade its internal firmware. Of course, it is not always possible to control the reset from the main CPU (no spare I/O lines may be available, it may be impossible to modify the firmware of the main CPU, etc.). In this case just go with a proper reset IC.

Provide status LEDs, prog/init button, and serial access connector

Note: part about LEDs applies to all Modules.

Tibbo EM Modules have four LEDs control lines (ER, EG, SR, SG). We strongly recommend you to provide these LEDs on your board. Not having them leaves you "blind". Supposing, the EM in your device is not working as expected. If you have those LEDs then you can solve the problem much easier. SR and SG LEDs display many different signal patterns so one glance at them can tell you a lot about the current EM status. ER and EG LEDs tell you about the Ethernet connection, which is also important.

Ideally, you should make those LEDs visible from the outside (left figure). This way your Users can also see them. If this is impossible then at least provide these LEDs on your board so they can be observed when your device's cover is removed (right figure).

an002_extra_stuff

Besides LEDs, we strongly recommend you to provide a setup button that is connected to the MD pin of the EM. Again, it is best to make this button "pushable" from the outside (left figure above). If this is impossible you can provide an internal button or a simple jumper on your board (right figure above). Why you need this? Because in the life of your device you (or your Users) can encounter a situation when they need to do one of the following: (1) initialize the EM, (2) program the EM through the serial port, or (3) upgrade internal firmware of the EM.

Initialization may be required because the EM has somehow lost its settings (due to powerful ESD or for some other reason) or was incorrectly setup. To initialize the EM using the setup button you use the quick init procedure .

Programming through the serial port may be required if the EM Module cannot be programmed through the network for some reason. In this case you just press the setup button to put the EM into the serial programming mode and do all the programming through the serial port. Of course, you need to have an access to the EM's serial port for this. Read on, we will come to that.

Finally, the firmware upgrade through the serial port cannot be ruled out. Of course, you can mostly use network upgrades, but don't count on this. Upgrade through the serial port is the most reliable way that will always work. To do the serial upgrade, you need to have a button. You also need to have access to the EM's serial port, so we will now discuss the subject.

Our last suggestion is that you provide a simple way to break the serial connection between the EM and your main CPU. You can pass the TX and RX lines of the EM through two jumpers. These jumpers are to be closed during the normal operation so the EM is connected to your CPU (see figure below). When you need to access the serial port of the EM directly you remove the jumpers and plug in a simple serial cable. It only needs to have three lines: TX, RX, and Ground. Because the EM has a TTL serial port you cannot connect this cable to the COM port of your PC directly. Use a simple board with RS232 IC installed on it to provide TTL<-->RS232 signal translation.

an002_jumpers

By providing the jumpers you are leaving a back-door access to the EM AND to the serial port of your main CPU. This may prove very useful during repairs, field service, etc. One final note: if you thing that jumpers are too unreliable or you simply don't have enough space for them on the board then you can use solder jumpers instead.

Let your main CPU control the Module...

One other important suggestion: let your main CPU control the EM Module. Under "control" we understand the following: (1) ability to reset (restart) the EM at any time, (2) ability to program the EM, (3) ability to upgrade internal firmware of the EM. Implementing this is optional but so easy to do that there is no real reason why you shouldn't (if you can). True, the EM doesn't have to be programmed through the serial port, you can do all the programming through the network using the DS Manager. But this is not always consistent with the rest of your device's features.

Here is an example: your device has an LCD screen and a keypad and there is a setup mode that allows you to set all the functioning parameters (time, date, etc.). To be consistent, you should include EM-related settings into this onscreen setup as well (for example, IP-address of the device). For this, you must provide a way for your main CPU to put the EM into a serial programming mode .

Another possibility is to have the main CPU upgrade the firmware of the EM. Again, EM Module can be upgraded through the network using the DS Manager , and in those few cases when the network upgrade is not possible you can just use the "plug-in cable" method described in the previous section. Still, it is much more "neat" if the firmware can be upgraded by your main CPU itself. We have had a case in which the EM was used in a terminal device that also was field-upgradeable. Our Customer has implemented a system, under which the upgrade file for the main CPU contained the firmware of the EM as well (EM firmware file was merged into the firmware file of this "host" device). After the terminal was loaded with the new firmware it automatically initialized itself and also downloaded the new firmware into the EM! This gave the Users an overall feeling of "one-ness" of the device they use.

To achieve all this flexibility you only need to have your main CPU control two extra lines: RST and MD (because TX and RX lines are already there, right?). We have already discussed how to connect the RST line. MD line is connected in this same fashion. So, you only need two extra CPU I/O lines.

Note, that we still recommend you to provide all the bits and pieces that we have suggested in the previous section. This means that we suggest you to have the MD line of the EM connected to your main CPU and the setup button at the same time. Many CPUs and microcontrollers have the I/O pins that allow them to be driven low externally and high internally at the same time (for example, the x51 microcontroller is like that). In this case you can simply parallel the CPU output and the setup button (Fig. 4a). If this is not permissible you can use two (Shottky) diodes to separate the I/O pin from the button (Fig. 4b).

an002_reset

In some cases it is not possible, of course, to have the main CPU control the RST and MD lines. You may have no spare I/O pins or interconnection between PCBs in your device may have no spare wires to carry RST and MD signals. In this case you won't be able to put the EM into the firmware upgrade mode but you can still have your main CPU program the EM's settings whenever necessary. There is an alternative method (two methods, actually) of putting the EM into the serial programming mode- by sending a so-called escape sequence .

The only complication is that appropriate escape sequence must be enabled for this to work. This is defined by the Soft Entry (SE) setting , which defaults to the post-initialization value of 0 (escape sequence disabled). Yes, you can manually enable this by using the DS Manager but if the EM gets initialized the escape sequence will stop working and you will have to manually edit the SE setting again!

To avoid this situation you can define your own post-initialization setting values. Instead of going with the factory default of 0(disabled), you can choose to have the EM default to 1 or 2 (escape sequence type1 or type2). Our Application Note 1 ("Customization options in our Products") explains how to do this.

...Or let the EM Module control your main CPU

And here is a complete reversal of the idea: sometimes it may be better to have the EM Module control the main CPU in your device. We have had a case in which an EM100 was used in a very simple serial machine. This machine also had a firmware upgrade feature. The User had to press a special button, then power the device up and upload the firmware through the serial port. After we have added the EM100 the serial port of the device was connected to the serial port of the EM100. Of course, new firmware could be loaded into the device through the EM100 (hence, through the network) as well. This could have allowed for the remote firmware upgrades if it wouldn't have been for a small problem- the "upgrade" button still had to be pressed on the machine itself- and this killed the whole "remote upgradeability" idea.

To solve this we have connected the download line of the device's main CPU to a general-purpose I/O pin of the EM100. By remotely controlling the state if this I/O line we can now put the main CPU into the firmware upgrade mode! Now the upgrades are truly remote.