Archive

Archive for January, 2009

A rule of thumb for 50 Ohm Microstrip

January 27th, 2009

CB Designers often have to get some quick answers to quick questions. In designing PCB, they need to get the characteristic impedance of common structures in a quick way.

One quick thumb rule for the microstrip characteristic impedance that gives 50 Ohm is that the width of the trace has to be twice the trace to ground plane thickness.

This rule of thumb give impedance at slightly lower than 50 Ohm. In other words the width has to slightly less than twice to get closer to 50 Ohm.

As an example with

H = 5 mils

W = 10 mils

er = 4

t = 1 mils

Gives,

Z =  45 Ohms. A pretty close figure. Now make W = 8.5 mils and you get 50 Ohms.

You can find the microstrip impedance calculator using IPC formula at

Stripline Impedance Calculator

Signal Integrity

Never Rely completely on automatic Design Rule tester

January 22nd, 2009

In 2002, I was in charge of the Signal Integrity team, designing AMD based server motherboard. The motherboard consisted of many high speed signals including DDR2, PCI – 133 MHz, HyperTransport , Gigabit Ethernet. Serial ATA and others.

The responsibility of the signal integrity team was to conduct all the simulations and hand over the design rules to the Layout team. The layout team was responsible for ensuring that the rules are followed. We finally had a check list which a signal integrity engineer will fill out and sign out. The Signal Integrity engineer used to check the layout file, the length report and cross check it against signal integrity rules. If there was anything that potentially violated the signal integrity rules, it will be communicated to the layout engineer and to the team manager to take corrective action.

After several back and forth and design check, cross check, layout modification, the design was released for fabrication. The assembled board arrived after a couple of week. It was in the hands of the debug team and the BIOS team for few days before it came into my hand for signal integrity tests. I ran many tests, taking scope shots, running frequency and voltage margin tests , correlating my simulation results with the observed results. Everything looked as expected except one thing – the Gigabit Ethernet. The Gigabit Ethernet test consisted of sending a large file over a 25 meter long Ethernet cable and checking it at the receiver. It looked fined except that the software reported occasional errors in the reception. We checked and cross checked and it was not clear to me if this was a software issue or a hardware issue. We kept fighting and I questioned the methodologies used by the software engineers. I was obviously confident about my own methods and did not think that anything could be wrong at the hardware design end. We had taken care of the differential impedance calculations, we had maintained the length balance between the positive and negative ends of the differential signaling. I was confident of my knowledge about the differential signaling because of my extensive experience with HyperTransport bus.

Just out of curiosity, I opened the layout file one day when I was about to leave office, to check the routing of the differential pair of the Gigabit Ethernet circuit. I checked the lengths of the positive and negative of the signal pairs. They were matched to within 10 mils. Then I started looking if any asymmetry could exist in the differential pair. Suddenly, I found the issue and jumped off my seat. The figure below shows the way the differential pair signal was laid out by the layout person.

Figure 1 : Routing of Differential Signal with matching length

On one of the two signals there was a circular stub, that was taken into account when calculating the length of the differential signal. To match the signal lengths the other signal was stretched near the receiver. In the length calculation, the layout tool took into account the length of the circular stub. Electrically, however, the first trace was shorter. That was enough to cause the kind of error that we were seeing.

We made some fine knife cuts and joints and the error was gone.

I learnt that even though we could use the automatic checking script we should visually check all critical nets with a critics mind. It does not take that long to find errors.

Signal Integrity ,

Recording IP address of Visitor

January 18th, 2009

Problem

You want to do a quick record of the ip address of the visitor to your website. You do not need any exotic database. Just a quick record of the ip address so that you can know if they are causing spam to your website.

Solution

$ip = $REMOTE_ADDR;

$myFile = “testFile.txt”;
$fh = fopen($myFile, ‘a’) or die(“can’t open file”);
$stringData =” “. $ip .” “;
fwrite($fh, $stringData);
fclose($fh);

Explanation

The visitors’ ip address will be recorded using  $ip = $REMOTE_ADDR;

The statement below that will be used to store the ip address in a file.

Programming

Using explode function in php

January 17th, 2009

Problem

I have a list of emails separated by comma. This is stored in a string For example

$to = “x1@abc.com,x2@abc.com,x3@abc.com”

I need to read this string, separate them and print them in one line each in php.

Solution

You can use php explode function to achieve the result.

<?php

// Example to show usage of explode function in php

$to = “x1@abc.com,x2@abc.com,x3@abc.com”;
$pieces = explode(“,”, $to);

$x = count($pieces);
while ( $x >=0)
{
echo $pieces[$x];
echo “<br />”;
$x–;
}

?>

Copy paste the code and run it. It will print the things in reverse order

x3@abc.com
x2@abc.com
x1@abc.com

I will leave it as an excercize to you to modify the program to print the array element in normal order.

Programming ,

Speech Coding – Methods, Applications and Trends

January 17th, 2009

Speech and Audio are two preferred  ways of communication. By speech, we  generally mean the method of two-way sound communication used in telephony or similar situation, for example, video conferencing that includes audio communication. By audio we will generally mean higher quality sound used in broadcast, CD, DVD, music and video.

Speech or audio coding is used to digitize the analog sound and then reduce the number of bits required to represent the sound. The challenge to the coding is to use as few bits as possible to represent the sound while maintaining the decoded sound as close to the original sound as possible. In general, higher bit rate will represent a better quality and a lower bit rate will represent inferior quality. The bit rate and the quality of the decoded sound will depend upon the coding algorithm and scheme for a particular application. An understanding of the sound, environment, channel conditions and limitation is important to make a correct choice of a coding scheme.


Issues in Speech Coding

The basic requirement of a Speech coding is to produce high quality sound while taking as little bandwidth as possible. The codec should require small processing power. The delay in coding should be small. The codec should perform well under error prone network conditions. Finally, the interconnected networks, where there multiple coder and decoders are interconnected together should offer acceptable speech quality.

Quality and Bandwidth

Quality is the foremost important parameter against which all the codecs will be compared. The goal  is to satisfy generally contradictory requirements of lower data rate and higher quality. Two important parameters for comparing two codecs are the bandwidth requirement and the quality. The quality is measure in terms if MOS or Mean Opinion Score.

MOS – Mean Opinion Score is used as a way to evaluate the performance of speech coders. To find the MOS of coders, listeners are asked to classify the quality of the encoded speech in one out of five categories – excellent(5), good(4), fair(3), bad(2) or poor(1). The average of  numerical value assigned by of all the listeners are taken to produce the MOS rating. A MOS rating of 4.0 or higher indicates a good quality. It is not a mathematical way of evaluating speech codec. It is subjective to the listener and it is time consuming to perform MOS for a given codec. The results do vary from experiment to experiment. It is however, still widely used as a measure of the quality of the codec.

Signal to Noise ratio is another way to express the quality of codec.

Codec Complexity

If two codecs achieve roughly same MOS figure for a given rate, preference is made for the codec that needs lower computational complexity. The computational complexity of the codec is measured in MIPS ( Million Instructions per second). The MIPS figure generally refers to the DSP rather than the CPU. A lower MIPS figure will generally be cheaper to implement. Lower computational power requirement can lower the burden on the processor. Another figure that could be of importance is the maximum and the average amount of the memory required during the run time of a coding. It is apparent that the coding schemes should be implemented in a way that needs  as small processing power and memory as possible.

Coding Delay

Another issue in the implementation of a speech codec is the delay encountered in coding a given sample of speech. Human ear will not detect  end to end delay upto 150 ms. A delay of 400 ms or more will be definitely annoying and is supposed to hamper the ability to comprehend the speech smoothly . A delay between 150 ms to 400 ms is the grey area where delay of as much as 250 ms is found acceptable in most cases.

The delay consists of three part – coding delay, network delay and decoding delay. Speech codecs are compared for coding delays if the overall delay exceeds 150 ms.

The ITU-T G.114 standard provides an overview of the effect of the delay on the satisfaction rating users. According to it, a delay of upto about 200 ms keeps the users in very satisfied range. A coding delay of 400 ms or more makes many users dissatisfied.

Asynchronous Tandem Connection

Between end to end conversation, there may be a number of networks interconnected together. It is essential sometimes to decode the digital speech, perform the digital to analog conversion, and re-encode the analog signal. The term asynchronous tandeming refers to the interconnection of networks in which, coded speech has to be converted into analog signal and needs to be re-encoded.
Asynchronous tandem connection gives rise to two undesired issues. First it degrades the audio quality because of reconstruction and re-sampling. Secondly, it adds to the delay due to the decoding and recoding.

Error and Packet loss in Network

Unlike the normal data transfer, packet retransmission is either not an option or the scheme if implemented introduces further delay in the network. Packet loss for speech packets is a common phenomenon in an IP bases networks. The success of speech codec will depend upon how well it performs under the error prone network and under the condition where there is a possibility of packet loss.

Speech Coding

A speech waveform f(t) can be represented as a function of time t. The waveform coding method collects a defined number of samples per second. Each sample is then digitized to represent the amplitude of the waveform.

It is obvious that, higher the sample rate, more accurate the coding will be. A 2 ksps will be inferior in quality than a 8 ksps coding. The sample rate 8 ksps used in speech coding  comes from Nyquist Criteria which states the relation between the sampling rate to cover a  given bandwidth.

A pulse code modulation is the simplest form of coding. In speech domain a PCM will consist of 8 kilo samples per second with each sample coded with 8 bits giving a bit rate of 64 kpps.

Areas of Development and Refinement

There are many areas on Speech coding that needs refinement and further research. The methods used in one set of application needs to be tested and applied in other scenario and situation. For example the packet concealment developed for G.711 needs to investigated to be applied and evaluated for the other codecs as well.

Error Concealment

VoIP is gaining importance to the extent that it is about to overtake other forms of telephony and speech communication. Packet loss is a common phenomenon is cable based network and to some extent in DSL network. The research in error concealment algorithms ( G.711 concealment, Global IP Sound’s iLBL codec) has been recent developments. Redundancy algorithms can be used to overcome the poor quality of the coded resulting from packet loss. More development needs to be done. This area promises scope of improvement in the audio coding for VoIP.

Codec Performance Assessment

If a mathematical way could be found to assess the performance of codecs, it will be a great tool to replace the human oriented MOS type tool. Modelling mathematical codec assessor is a challenge. More challenging is the ability to assess codec performance under varying channel conditions, error conditions and packet loss conditions.

Network specific Speech codec design

Original codecs were designed for PSTN e.g. G.711 , G.726 and G.728. Modifications to these codecs were made to make them suitable for other networks e.g. – voice over Wi-Fi. As a result, packet loss concealment, comfort noise addition, were added to expand their capabilities.  However, designing a codec with a particular network in mind is expected to provide better quality, lower rate, low delay and robustness to error.

By Vikas Shukla
Vikas Shukla is currently working as Senior Design Engineer at BL Healthcare. He has degree in Computer Science and Engineering from IT-BHU, Varanasi, India. Mr. Shukla has over 15 years of experience in design of microprocessor-based systems. His expertise includes signal integrity, architecture and design of remote patient monitoring systems. The views expressed are his own.

Hardware Design, Programming ,

Architectural Decisions in the design of Processor Based Medical Devices

January 16th, 2009

Engineering Managers have to take a number of crucial decisions early in the design stages of the Medical devices. The managers must understand the general requirements pertaining to the design of general processor based electronics devices along with the requirements specific to the medical field. The more we understand the various fabrics, hardware as well as software, of the design stage, the better it helps in taking the decision.


It is utmost important to note that the decision making process must be guided by the truth searching rather than the quick assumptions. The following is a general guideline that will help managers get familiar with the fabrics of the design of a processor based medical device.

Choice of Processor

The most important parameter that will govern the choice of the processor will depend upon its ability to satisfy the needs of the application. A typical application may require 4000 MIPS processing power, 2 USB, 1 Ethernet, 3 Serial ports, support for 1 Gbyte NAND Flash, Bluetooth, 802.11b, Audio,  XVGA LCD, touchscreen. Once basic processor and peripheral requirements are satisfied, we may narrow down our choice to the pricing, speed of processor for future enhancement and previous experience with the processor line.

It will also depend upon the software support offered by the processor as also the experience of the design team members with a chosen series of the processor.

Absolute comparison of processors is a difficult task, especially in embedded arena. Unlike desktop arena, there is a lack of the benchmark data comparing processing powers of the embedded processors.

Software Support / Operating System

The choice of Operating System will be decided by the expertise of the existing team and the support for the available processor. Some of the choices that exist for the choice of the operating systems are VxWorks, Windows CE, Linux ( comes in various flavors), Embedded NT, DSP/BIOS, pSOS, eCOS, ATI Nucleius, LynxOS, ThreadX.


As soon as the choice of the Processor is about to be made, the software team should be involved. If the choice is made for example, for  Linux system, the software team should be asked to download the complete Board Support package and go through  the process of compiling the complete Linux chain including Boot Loader, Kernel and the part of the application. If the hardware design implements additional circuitry that needs driver development, the software team must analyze the additional efforts required to develop it.

It is likely that half of the time the team working on a project would like to keep the operating system same when trying to switch the processor for a different system. This makes sense in many cases, as they feel comfortable with the existing system and are confident that most of their code will work without modification in the new system. However, when there is a change in the underlying hardware, it may make more sense to switch the operating system that is better suited to the new chosen processor or the system.

Availability of Reference Design

It is always preferable to use a proven reference design to proceed. This will minimize the number of errors and design re-spins. The designer is not expected to prove the design. His focus should be to deliver the product with minimal possible additional design efforts. On hardware design perspective, this will mean availability of the schematics design files as well as layout design files. We should not rely upon the pdf files of the schematics of simply the gerber files of the layout. The design team should make it clear to the processor sales team  that they will have a better chance of adaptability only if they provide the reference design files. If the reference design uses a CPLD or a FPGA, the design team must make sure that they have the source code and they understand the tools required to build the Verilog or VHDL source code.

The lower level software also forms the part of the reference design. This must be evaluated by the firmware engineer. If a right choice is made based depending upon the availability of the reference design, it is possible to get the embedded board up and running in first power up.

Use of CPLD / FPGA

Use of CPLDs and FPGAs ( Field Programmable Gate Arrays) provide hardware design flexibility, cost reduction, space saving and many other exotic  features. However, if the designer chooses to use CPLD or FPGA in the design, he must take into account the time required to develop verify and maintain the code for the CPLD/FPGA. It will also depend upon the available manpower and expertise available.

Battery Power Requirements

A key challenge in the design of portable medical device companies is to achieve two goals which have contradictory requirements – the goal of low power consumption and that of high performance.

The medical devices usually will fall in one of the two categories. The first category is that of  small microcontroller based systems that will  be required to operate many months before requiring recharge and or battery replacement.

The second category is of the full fledged processor based system with potentially LCD displays that have battery life in hours or in days at the most.

In both cases designer will have to work with power system design engineers, software team to implement the lower possible current consumption – most importantly in idle state.

EMI/EMC Compliance, EMC 60601-1, EMC 60601-2 requirements

The Safety requirements must be understood before the system is taken to the compliance tests. This is a very broad area and the EMI test , ESD test, safety test requirements must be clearly understood right at the beginning of the design.

EMI test will require that the PCB Layout must follow the schemes that minimizes radiation from the board. This will require power plane planning, proper terminations for all high speed signals. The designer must be prepared for the case when the design may fail in EMI test even after taking care of all possible design rules. The designer should make a provision for the Spread spectrum oscillator and a faraday cage, in case, the design marginally fails in EMI test. This will avoid costly re-spin.

Medical standard require that the fire enclosure for any unit with power rating 15W or greater should be 94V0 or better. The mechanical designer must work with the electrical engineers to find if the power consumption of the board is expected to stay within 15 Watts.

Electrostatic Discharge (ESD) is the abrupt release of charge from one object) to another. Such a discharge can permanently damage or otherwise upset the function of sensitive electronic circuits. ESD requirement can usually be fulfilled if we make provisions for the ESD diodes at all connector pins. ESD tests can be destructive if provisions for ESD safety are not provided with the board.

If power supply modules are used, we must ensure that they have follow required safety standards. All power system should be designed such that the short and open circuit conditions do not create hazard. The power supply regulators should have current limiting features. Reverse battery protection must be provided.

FDA Approval

Once we determines that the device falls into the category of the Medical Device, we will  have to get FDA approval to be able to sell the device in US market.

FDA classifies the Medical devices in three categories Classification identifies the level of regulatory control that is necessary to assure the safety and effectiveness of a medical device. We must understand the processes involved in getting the FDA approval. Different categories of the devices have different requirements. When taking the product requirement we must know the quality norms and requirements that must be adhered to. FDA recommends you validate your device under actual or simulated use conditions to ensure the device conforms to defined user needs and intended uses. As  part of the verification test, the devices verification test must be performed and recorded.

A detailed discussion about the approval process is beyond the scope of this paper. FDA approval process in neither difficult nor technically intensive as far as it does not involve drug and invasion to body parts. However, a prior experience to the FDA approval process greatly helps.

Signal Integrity Requirements

Signal integrity  is a measure of the quality of a electrical signal ( usually high speed). A degradation is the quality of the high speed signals can lead to system failures, data loss.

Most embedded processor based systems now a days have high speed data bus including DDR, PCI-X, USB 2.0, SATA and others. Any failure not to observe signal integrity requirement will lead to unstable system performance and will be catastrophic for the Medical data logging based system. All systems must be analyzed by an expert in the Signal Integrity. Besides that the system must be tested for frequency margin  and voltage margin to see if it fails due to any signal integrity issue.

The signal integrity engineer must be involved at the very beginning of the design cycle, when the team is making critical architectural decisions and selecting component technology. Signal integrity engineer should be able to tell the amount of the efforts that will be required to simulate, if any, the high speed signals and the amount of the time and effort it may take. The Signal integrity and the testing team must develop a comprehensive simulation and measurement strategy that applies the appropriate level of analysis to each bus in the system.

Continued availability of components

As soon as the design starts all the components must be procured, at least in smaller quantity. This exercise will make any long lead component known ahead of time. The PCB designer must get samples of unverified components and ensure that the Library is correct not only by checking the design, but, also by physically inspecting the component.

Medical devices usually have much longer life than the consumer goods. This demands that  the component selection requires additional thought for assurance of continued availability.

The designer should make a checklist of the components that may go out of life in a specified amount of time. A possible alternate source must be listed. If the component does not have any alternate source it must be pointed out if in the check list. All such components should be grouped together and, if possible the electrical nets should go to an add on card connector for a possibly different source alternative.

Analyze the Potential Risk Areas

No matter how good the design is, there are always some risk areas which can derail the deadline. All possible risk areas must be analyzed and documented. This will make everyone aware of the potential pitfalls. Attention must be paid to the high risk areas. It often happens the most of the meeting times are devoted to discuss petty things, like GUI interface and look and feel while more important discussion regarding core system design and the driver software development, potential hardware/ software integration issues get un discussed as these are difficult to follow.

The Engineering Manager’s only way to be able to analyze the risk will depend upon his past experience and his ability to keep himself updated of the technologies followed behind the design. This will be in addition to the feedback and analysis of his team members.

Mechanical Enclosure design

Medical devices have been historically designed with best exotic appearance. The design team must have a team member who not only can apply design techniques, but can also be creative in design. The creativity aspects can only be known from his demonstrated past experience. The team members should ensure the requirements are delivered and rest should be left to the imagination of the enclosure designer.

Vikas Shukla is currently working as Senior Design Engineer at BL Healthcare. He has degree in Computer Science and Engineering from IT-BHU, Varanasi, India. Mr. Shukla has over 15 years of experience in design of microprocessor-based systems. His expertise includes signal integrity, architecture and design of remote patient monitoring systems. The views expressed are his own.

Hardware Design ,