APPLICATION NOTE A Discussion of the AS2Cwire™ Single-Wire Interface Introduction The Advanced Simple Serial Control single-wire (AS Cwire) interface offers the simplest control possible for programmable power I/C devices. Using only a single wire, the AS2Cwire serial interface is designed to be driven by a wide range of systems in a simple, flexible way. This interface benefits system designers by bringing to market digitally programmable, high performance power I/Cs with minimal pinouts and tiny packaging. 2 AS2Cwire is easily integrated into a wide range of portable systems. The interface does not have a strict timing protocol, simplifying integration for software systems and eliminating any need for specialized hardware. The interface is simple, flexible, and compatible with processor chips found in nearly all of today's portable systems. This Application Note provides details about programming Skyworks power management I/Cs with the AS2Cwire single-wire interface are provided in the following discussion. Insight is also provided for system integration. AS2Cwire Details AS2Cwire is not defined by a strict timing and signaling scheme, but rather by a simple mechanism of toggling a line to program an AS2Cwire device. By avoiding strict timing requirements, the AS2Cwire interface remains flexible. The method for programming a device is simple; it consists of toggling the line of an I/O port so that rising edges are received by the EN/SET pin of an AS2Cwire device. This can be done with the digital I/O ports found in many processors, or any other digital or analog output capable of sending a line high and low in a pulsed fashion. Toggling the line submits edges to the AS2Cwire device, where each rising edge is counted. Timing is flexible due to the interface's generous tolerance level. The rising edges that program a part can be fast, slow, or inconsistently spaced. Timing of the edges is bound only by the loose timing specification. The AS2Cwire interface is simple to integrate with complex, multi-tasking systems, as well as slow, isolated subsystems dedicated to system management. Voltage Levels Two voltage level specifications are associated with the AS2Cwire serial interface. The high-impedance input at the EN/SET pin detects logic high and logic low levels when the high and low voltage level thresholds are reached for the specified times. The high and low threshold levels are clearly defined in the product Data Sheets as a minimum and a maximum specification, respectively. Table 1 provides an example of the voltage level specifications found in most AS2Cwire device Data Sheets. For VIH, the enable high threshold is given as 1.4 V. This means that the applied enable high signal must be 1.4 V or greater. For VIL, the enable low threshold is given as 0.4 V. This means that the enable low signal must be 0.4 V or lower. To submit a rising edge to the EN/SET pin, the line should be taken below 0.4 V and then taken above 1.4 V. To submit a set of rising edges, the line should be taken below 0.4 V and then above 1.4 V in a repetitive fashion. See Figure 1 for an illustration of this process. Table 1. Example of EN/SET Threshold Specifications Symbol Description Conditions VIL Enable threshold low VIN = 2.7 V VIH Enable threshold high VIN = 5.5 V Minimum Typical Maximum Units 0.4 V 1.4 V Skyworks Solutions, Inc. • Phone [781] 376-3000 • Fax [781] 376-3100 • [email protected] • www.skyworksinc.com 202739B • Skyworks Proprietary Information • Products and Product Information are Subject to Change Without Notice • March 25, 2013 1 APPLICATION NOTE • A DISCUSSION OF THE AS2CWIRE™ SINGLE-WIRE INTERFACE Figure 1. Voltage Level Thresholds Table 2. Example of EN/SET Timing Specifications Symbol Description tEN/SET_LO EN/SET low time tEN/SET_HI_MIN Minimum EN/SET high time tEN/SET_HI_MAX Maximum EN/SET high time Conditions Minimum Typical 0.3 Maximum Units 75 µs 50 ns 75 tOFF EN/SET off timeout 500 µs tLAT EN/SET latch timeout 500 µs Timing A few timing specifications are associated with the AS Cwire interface. These relate to how fast or slow the interface can detect rising edges, as well as when to expect the data registers to update. Internally, a counter counts the rising edges and, after the line has been held high, the data is latched and the addressed register(s) are updated. At this point, the Digital-to-Analog Converter (DAC) and, therefore, the output are updated. 2 Table 2 provides an example of the EN/SET timing specifications found in most AS2Cwire product Data Sheets. The specifications that correspond to edge detection are the tEN/SET_LO and tEN/SET_HI. To determine the tLO time, the Data Sheet gives a minimum and a maximum specification for tEN/SET_LO. This results in a straightforward set of limits. To ensure edge detection, the tLO time must be at least the minimum time and no greater than the maximum time. If edges are submitted outside of this range, there is a risk that the edges are not detected or that a latch timeout occurs when not intended (see Figure 2). To determine the tHI time, the Data Sheet gives two specifications. There is a typical value for tEN/SET_HI_MIN and a maximum value for tEN/SET_HI_MAX. To determine the minimum tHI time, double the typical value for tEN/SET_HI_MIN. To determine the maximum value for the tHI time, use the maximum value from the tEN/SET_HI_MAX specification. If edges are submitted outside of this range, there is a risk that the edges are not detected or that a latch timeout occurs when not intended. The Data Sheet gives two additional specifications that detail the AS2Cwire interface. One is tLAT, which is given as a maximum specification. This means that after submitting data and then holding the line high, the latch timeout is guaranteed to occur by this time. Typically, the tLAT timeout occurs more towards the middle of the window created by tEN/SET_HI_MAX and maximum tLAT (e.g., between 75 μs and 500 μs). The output updates after tLAT, as illustrated in Figure 2. The last relevant timing specification is tOFF. The tOFF time is given as a maximum specification. This means that after taking the line low, the part is guaranteed to enter shutdown within this time. Note that when the part is shut down, all registers are reset to zero as shown in Figure 3. Skyworks Solutions, Inc. • Phone [781] 376-3000 • Fax [781] 376-3100 • [email protected] • www.skyworksinc.com 2 µs March 25, 2013 • Skyworks Proprietary Information • Products and Product Information are Subject to Change Without Notice • 202739B APPLICATION NOTE • A DISCUSSION OF THE AS2CWIRE™ SINGLE-WIRE INTERFACE Figure 2. Latch Time Figure 3. Shutdown Time Programming Programming an AS Cwire device is simple. This section details what is involved and is intended to be general so that it applies to all AS2Cwire devices. A basic block diagram for a sample device, used to facillitate the programming discussion, is shown in Figure 4. The available operating modes for this device are presented in the same fashion as found in the Data Sheet for a real device. 2 The example device has two simple operating modes: it can operate as a constant voltage source, or it can operate as a constant current source. In either case, the output voltage or output current is set by programming the device using the AS2Cwire interface. There are 16 programmable settings available for each mode and each mode is assigned an address. The available settings are defined in Tables 3 and 4. In the Data Sheet of an AS2Cwire device, the complete functionality of the device is detailed in Tables similar to those shown in Tables 3 and 4. In this case, the first Table lists the addresses for each mode register and the second Table lists the settings for each register. The example device has a voltage register and a current register. The voltage register is assigned Address 0 and the current register is assigned Address 1. Programming an output voltage or current is accomplished by submitting address edges followed by data edges and then holding the EN/SET line high. The registers maintain their value while EN/SET remains high or until they are reprogrammed. Taking EN/SET low shuts down the device and resets all of the registers to zero. If no edges are clocked-in, but EN/SET is taken high, the device operates in the default state (Address 0, Data 1 or 5.0 V in this case). Programming Examples A few simple programming examples illustrate some of the details of operation. As a first example, assume that an event occurs and it is necessary to enable the constant current source output to 30 mA. The output is programmed to this level by submitting the appropriate number of address edges to the EN/SET pin, followed by the appropriate number of data edges. Figure 4. Sample Device Block Diagram Table 3 indicates that 18 edges are required to address the current register. From Table 4, the 30 mA setting corresponds to Data 16. This information indicates that the user must address the current register with 18 edges, and then program the current to 30 mA with 16 edges in that sequence. Skyworks Solutions, Inc. • Phone [781] 376-3000 • Fax [781] 376-3100 • [email protected] • www.skyworksinc.com 202739B • Skyworks Proprietary Information • Products and Product Information are Subject to Change Without Notice • March 25, 2013 3 APPLICATION NOTE • A DISCUSSION OF THE AS2CWIRE™ SINGLE-WIRE INTERFACE Table 3. Register Addresses Address EN/SET Edges Addressed Register 0 17 Voltage 1 18 Current Table 4. Mode Settings Data Voltage (V) Current (mA) Data Voltage (V) Current (mA) 1 5.00 0 9 3.00 16 2 4.75 2 10 2.75 18 3 4.50 4 11 2.50 20 4 4.25 6 12 2.25 22 5 4.00 8 13 2.00 24 6 3.75 10 14 1.75 26 7 3.50 12 15 1.50 28 8 3.25 14 16 0 30 Figure 5. Turn-On Current Output After clocking in 18 edges for Address 1, waiting for an amount of time equal to tLAT, and then clocking in 16 edges for data, the device turns on the output to 30 mA, as shown in Figure 5. Next, assume that a different event occurs and it is necessary to turn on the voltage output to 4.25 V. Since Address 0 is the default, there are two ways to program the output to 4.25 V. The first is to address the voltage register and then clock in edges for the desired data setting; the alternative is to skip the address edges and just clock in data. In Table 4, 4.25 V corresponds to Data 4. To bring the device out of shutdown and turn on the voltage output to 4.25 V, clock in 17 edges to address the voltage register (Address 0), wait for an amount of time equal to tLAT, and then clock in 4 edges for Data 4. After the latch timeout, the output updates to the programmed output level, as illustrated in Figure 6. The alternative is to program 4.25 V on the voltage source output by clocking in only data; this is possible because the device resets to Address 0 during shutdown. In other words, all that is needed is to clock in 4 edges and hold EN/SET high. After the latch timeout, the device turns on to the same state as described in the previous paragraph for the address and data sequence (see Figure 7). Skyworks Solutions, Inc. • Phone [781] 376-3000 • Fax [781] 376-3100 • [email protected] • www.skyworksinc.com 4 March 25, 2013 • Skyworks Proprietary Information • Products and Product Information are Subject to Change Without Notice • 202739B APPLICATION NOTE • A DISCUSSION OF THE AS2CWIRE™ SINGLE-WIRE INTERFACE Figure 6. Turn-On Voltage Output Figure 7. Device Shutdown Next, assume that the device is operating with both the voltage and current outputs active. An event occurs and it is necessary to keep the voltage output active, but turn off the current output. This is accomplished by clocking in the appropriate number of edges (i.e., EN/SET does not need to be pulled low to reset registers first). Address the current register and program it to zero. The sequence is to submit 18 address edges, wait tLAT, and submit 1 data edge. The current output turns off, and the voltage output remains unchanged, as shown in Figure 8. Finally, the device needs to be shut down. The device has been in an operating state because the EN/SET pin has been held high. Simply bring the EN/SET line low to enter shutdown mode. After taking the line low, there is a delay (tOFF) before shutdown mode is entered (see Figure 9). Note that shutdown resets the registers to zero. general timing diagram used in product Data Sheets. The central theme is that to program an AS2Cwire device, the user submits a set of address edges, pauses for a period of time at least equal to tLAT, submits a set of data edges, and then holds the line high. After tLAT has expired, the addressed data register is written, and the DAC is updated. To put the part into shutdown mode, simply take the EN/SET pin low. When tOFF has expired, the part enters shutdown and all of the registers are reset. In summary, programming or reprogramming an AS2Cwire device simply amounts to addressing the desired register and then programming it to the desired setting. To ensure that AS2Cwire programming is successful, make certain that the signals fall within the timing specifications and that the signals achieve the voltage level thresholds. To turn the part off, the EN/SET pin is simply pulled low. All of the information explained in the previous examples is illustrated in the single diagram shown in Figure 10, a more Skyworks Solutions, Inc. • Phone [781] 376-3000 • Fax [781] 376-3100 • [email protected] • www.skyworksinc.com 202739B • Skyworks Proprietary Information • Products and Product Information are Subject to Change Without Notice • March 25, 2013 5 APPLICATION NOTE • A DISCUSSION OF THE AS2CWIRE™ SINGLE-WIRE INTERFACE Figure 8. Turn-Off Voltage Output Figure 9. Device Shutdown Figure 10. Example of Data Sheet Timing Diagram Skyworks Solutions, Inc. • Phone [781] 376-3000 • Fax [781] 376-3100 • [email protected] • www.skyworksinc.com 6 March 25, 2013 • Skyworks Proprietary Information • Products and Product Information are Subject to Change Without Notice • 202739B APPLICATION NOTE • A DISCUSSION OF THE AS2CWIRE™ SINGLE-WIRE INTERFACE Software Integration There are a number of practical ways to integrate AS Cwire functionality into embedded software systems. Many of today's cell phones and hand-held devices are built around low-power, high-performance 16- and 32-bit processors that run Real-Time Operating Systems (RTOSs) and application Operating Systems (OSs). These systems are balancing heavy loads with many hard, real-time deadlines. As a result, careful consideration is given to every additional piece of code added to a system. In line with today's methodologies, AS2Cwire is flexible so that it is easy to integrate. 2 Due to the simplicity of the AS2Cwire interface, very little code is needed (see the example in Figure 11). Routines can just write 1s and 0s to an I/O port to toggle the line that is connected to the EN/SET pin of the part. The code can be fast and small, allowing it to be implemented as a high-priority task. A high priority task, dedicated to writing sets of edges, can run to completion extremely quickly since the AS2Cwire timing specification allows for fast timing. This fast execution time results in minimal impact to the software system. Generally, there are two different programming sequences to deal with: there can be multiple bursts of edges that comprise address and data, or there can be a single burst of edges for only data (see Figure 12). For either case, the actual burst itself can be handled the same way by the software. During the actual burst of edges, the code should execute with high priority. Between bursts, the execution priority is insignificant due to tLAT. There is no upper time limit for tLAT, but there is for tHI and tLO. If using a preemptive, multi-tasking system, such as an RTOS, a high priority task can be used during the data burst. Then, the waiting between bursts (tLAT between address and data) can occur at the application level. Since the AS2Cwire interface accepts fast timing, the high-priority task could toggle the I/O line quickly and minimize CPU time, as illustrated in Figure 13. Figure 11. Example of Code Figure 12. Single Burst and Multiple Bursts of Edges Skyworks Solutions, Inc. • Phone [781] 376-3000 • Fax [781] 376-3100 • [email protected] • www.skyworksinc.com 202739B • Skyworks Proprietary Information • Products and Product Information are Subject to Change Without Notice • March 25, 2013 7 APPLICATION NOTE • A DISCUSSION OF THE AS2CWIRE™ SINGLE-WIRE INTERFACE Figure 13. A2SCwire Code Implemented as a High Priority Task Figure 14. Preemption of AS2Cwire Code Since the actual data burst is of primary concern, it is useful to estimate the execution time. The calculation focuses purely on the AS2Cwire pulse timing and does not account for any OS latencies. To minimize execution time, the fastest EN/SET timing should be used (300 ns for tLO and 100 ns for tHI). With this timing, the longest execution time occurs for the highest address. In the preceding example, Address 1 is the highest address and requires 18 edges. This is the largest burst of edges and should be used to estimate the time, which can be calculated as follows: tRUN = max_edges х (tLO(MIN) + tHI(MIN)) tRUN = 18 х (300 ns + 100 ns) = 7.2 μs Skyworks Solutions, Inc. • Phone [781] 376-3000 • Fax [781] 376-3100 • [email protected] • www.skyworksinc.com 8 March 25, 2013 • Skyworks Proprietary Information • Products and Product Information are Subject to Change Without Notice • 202739B APPLICATION NOTE • A DISCUSSION OF THE AS2CWIRE™ SINGLE-WIRE INTERFACE From this calculation, it can be seen that the necessary execution time for the longest burst of edges is 7.2 μs. A slow rate of edges can also be detected by the AS2Cwire interface. This gives a task dedicated to AS2Cwire a high degree of tolerance so that it can be preempted by more important code. However, a major concern is whether the task has a high enough priority. Using the previous example, the task should have a high enough priority that control returns within 75 μs (since this is the tEN/SET_HI_MAX and tLO maximum specifications). If the task is kept waiting for more than 75 μs, it could cause a delay within the burst of edges exceeding 75 μs. If tHI or tLO are allowed to exceed 75 μs, a tLAT or tOFF timeout may occur and interfere with the intended programming. A simplified example is shown in Figure 14. To implement a delay between the bursts of edges (i.e., to delay tLAT between address and data), wait at the application level. There is no time limit for tLAT. For our example device, it is only necessary to wait at least 500 μs between address and data bursts; if the wait becomes much longer than 500 μs due to higher priority code, it is not a concern. Therefore, a sequence similar to the example shown in Figure 15 is sufficient. An illustration summarizing AS2Cwire software implementation is shown in Figure 16. The AS2Cwire serial interface fits into commonly-used general multi-tasking RTOS environments, as well as custom-rolled software solutions tailored to a specific application. With little effort, AS2Cwire control can be easily integrated into today's software/hardware platforms. Summary This Application Note has presented details of the AS2Cwire single-wire interface and possible approaches to software integration. The overall discussion is intended to offer additional insight towards using the interface in target applications and to clarify the conceptual aspects of the AS2Cwire single-wire interface. With this knowledge, designers can more effectively take advantage of the features and benefits offered by Skyworks digitally programmable, high performance power I/C devices. Figure 15. Submitting Address and Data Skyworks Solutions, Inc. • Phone [781] 376-3000 • Fax [781] 376-3100 • [email protected] • www.skyworksinc.com 202739B • Skyworks Proprietary Information • Products and Product Information are Subject to Change Without Notice • March 25, 2013 9 APPLICATION NOTE • A DISCUSSION OF THE AS2CWIRE™ SINGLE-WIRE INTERFACE Figure 16. AS2Cwire Implementation Summarized Copyright © 2005-2012, 2013 Skyworks Solutions, Inc. All Rights Reserved. Information in this document is provided in connection with Skyworks Solutions, Inc. (“Skyworks”) products or services. These materials, including the information contained herein, are provided by Skyworks as a service to its customers and may be used for informational purposes only by the customer. Skyworks assumes no responsibility for errors or omissions in these materials or the information contained herein. Skyworks may change its documentation, products, services, specifications or product descriptions at any time, without notice. Skyworks makes no commitment to update the materials or information and shall have no responsibility whatsoever for conflicts, incompatibilities, or other difficulties arising from any future changes. No license, whether express, implied, by estoppel or otherwise, is granted to any intellectual property rights by this document. Skyworks assumes no liability for any materials, products or information provided hereunder, including the sale, distribution, reproduction or use of Skyworks products, information or materials, except as may be provided in Skyworks Terms and Conditions of Sale. THE MATERIALS, PRODUCTS AND INFORMATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, INCLUDING FITNESS FOR A PARTICULAR PURPOSE OR USE, MERCHANTABILITY, PERFORMANCE, QUALITY OR NON-INFRINGEMENT OF ANY INTELLECTUAL PROPERTY RIGHT; ALL SUCH WARRANTIES ARE HEREBY EXPRESSLY DISCLAIMED. SKYWORKS DOES NOT WARRANT THE ACCURACY OR COMPLETENESS OF THE INFORMATION, TEXT, GRAPHICS OR OTHER ITEMS CONTAINED WITHIN THESE MATERIALS. SKYWORKS SHALL NOT BE LIABLE FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO ANY SPECIAL, INDIRECT, INCIDENTAL, STATUTORY, OR CONSEQUENTIAL DAMAGES, INCLUDING WITHOUT LIMITATION, LOST REVENUES OR LOST PROFITS THAT MAY RESULT FROM THE USE OF THE MATERIALS OR INFORMATION, WHETHER OR NOT THE RECIPIENT OF MATERIALS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Skyworks products are not intended for use in medical, lifesaving or life-sustaining applications, or other equipment in which the failure of the Skyworks products could lead to personal injury, death, physical or environmental damage. Skyworks customers using or selling Skyworks products for use in such applications do so at their own risk and agree to fully indemnify Skyworks for any damages resulting from such improper use or sale. Customers are responsible for their products and applications using Skyworks products, which may deviate from published specifications as a result of design defects, errors, or operation of products outside of published parameters or design specifications. Customers should include design and operating safeguards to minimize these and other risks. Skyworks assumes no liability for applications assistance, customer product design, or damage to any equipment resulting from the use of Skyworks products outside of stated published specifications or parameters. Skyworks, the Skyworks symbol, and “Breakthrough Simplicity” are trademarks or registered trademarks of Skyworks Solutions, Inc., in the United States and other countries. Third-party brands and names are for identification purposes only, and are the property of their respective owners. Additional information, including relevant terms and conditions, posted at www.skyworksinc.com, are incorporated by reference. Skyworks Solutions, Inc. • Phone [781] 376-3000 • Fax [781] 376-3100 • [email protected] • www.skyworksinc.com 10 March 25, 2013 • Skyworks Proprietary Information • Products and Product Information are Subject to Change Without Notice • 202739B