Simplify TWS Headphone Solutions with 1-Wire Technology

[Introduction]This design applies ADI’s unique 1-Wire® technology to the TWS headset solution for the first time, using the 1-Wire bidirectional bridge DS2488, on the basis of meeting the requirements of energy transmission and data communication, with low cost, With many advantages such as low power consumption, high precision, small size, and high efficiency, it is an ideal solution for TWS headphones.

Introduction

The most striking feature of TWS earphones is the ease of wearing them wirelessly. Compared with traditional Bluetooth headsets, TWS headsets have many advantages such as small size, good sound quality, and high stability, as well as certain waterproofness and intelligence, which quickly attracted the attention of consumers. At present, the shipment volume and overall market size of TWS earphones are constantly expanding, and it is a hot research and development field of consumer electronics.

system structure

The 1-Wire TWS headset solution MAXREFDES1302 introduced in this article includes two parts: the charging box and the headset. The overall hardware architecture of the system is shown in Figure 1.

Simplify TWS Headphone Solutions with 1-Wire Technology

Simplify TWS Headphone Solutions with 1-Wire Technology

Figure 1. 1-Wire TWS charging case and headphone system architecture.

The charging box uses a 3.7V 1500mAh single-cell lithium battery to power the system, and the charger MAX77651 that supports the USB Type-C protocol is used to charge the lithium battery. Users only need to use a single USB Type-C data cable to charge the whole machine . In terms of power rails, the charging box uses the MAX17224 boost module to boost the system voltage of the charger to 5V. The 5V voltage is generated by the MAX38640 step-down module to generate 3.3V to supply power to the microcontroller MAX32655. At the same time, the 5V voltage is also passed through The 1-Wire control circuit is transmitted to the headphone, which acts as a charging power source for the headphone system. In terms of power monitoring, the charging box uses the MAX17262 fuel gauge with a built-in current-sense resistor to monitor the battery. The fuel gauge combines traditional coulomb counting methods with the innovative ModelGauge™ m5 EZ algorithm, eliminating the need for battery characterization, flexible configuration, and ease of use. In terms of microcontroller, the charging box adopts the microprocessor MAX32655 with BLE 5.2 module and built-in SIMO power module. Read and write control to the DS2488 on the headphone side, providing great convenience for 1-Wire communication and charging. The SWD interface of the charging box can be connected to the MAX32625PICO downloader, which can update the firmware of the MAX32655 of the charging box and Display battery information on the computer through the virtual serial port. Information about the battery can also be displayed through the OLED screen on the charging case.

The headset uses a 3.7V 130mAh single-cell lithium battery to power the system, and uses a DS2488 bidirectional 1-Wire bridge to realize the data interaction between the headset and the charging box, and to control the 5V charging power source from the charging box. On the controller side, the headset also uses the MAX32655 as a microcontroller, which uses the UART interface to simulate 1-Wire timing to read and write to the DS2488, and also uses the SWD interface to connect to the MAX32625PICO downloader to download programs. In terms of power rails, a 3.3V LDO output of the charger MAX77734 used by the headset supplies power to the microcontroller MAX32655. At the same time, the 3.3V and the 1.8V and 1.2V power supplies generated by the built-in SIMO module of the MAX32655 together form an audio encoder. Power rail for the decoder MAX98050. In terms of power monitoring, the headset also uses the fuel gauge MAX17262 to monitor the battery.

Figure 2 is a physical image of the 1-Wire TWS charging case and earphones. The actual size of the charging box is 10.20cm × 5.80cm, and the actual size of the earphones is 10.20cm × 6.50cm. Since this design is a prototype to assist customers in design, testing and research, the actual product size can be obtained by simplifying the test points. It can be greatly compressed to meet the size requirements of the actual application of TWS earphones.

Simplify TWS Headphone Solutions with 1-Wire Technology

Figure 2.1-Wire TWS charging box and headphone PCBA physical map.

1-Wire data communication and energy transfer

In the TWS headset application, it is very important to realize the data communication and energy transmission between the charging box and the headset in a reliable and convenient way. The common TWS earphones currently on the market usually use 3 or more contacts to connect with the charging box to realize the functions of data communication and energy transmission. However, too many contacts usually lead to an increase in system cost, which is extremely detrimental to low-cost wearable product design. In addition, more contacts usually require more space, which goes against the small size requirement of TWS earphones. Additionally, more contacts tend to increase the likelihood of failure. This design uses ADI’s proprietary 1-Wire bidirectional bridge DS2488 designed for the TWS solution to achieve energy transmission and data interaction between the headset and the charging box. The DS2488 supports the 1-Wire bus protocol, enabling communication and charging with a single wire. Since the system requires an extra contact to connect the earphone and the ground of the charging box, the overall solution only needs to use two contacts, which can greatly improve system reliability and reduce size and cost. The block diagram of the 1-Wire communication charging circuit used in this design is shown in Figure 3.

Simplify TWS Headphone Solutions with 1-Wire Technology

Figure 3.1-Wire communication charging circuit block diagram.

How DS2488 works

As shown in Figure 3, DS2488 is a 1-Wire bidirectional bridge with two 1-Wire communication pins, IOA and IOB, for the microcontrollers on both sides to control. IOA is controlled by the microcontroller of the charging box, and IOB is controlled by the headset microcontroller control. The IOA supports input voltages up to 5.5V and supports different communication and charging levels on the 1-Wire bus (IOA). As a 1-Wire device, each DS2488 device also has a unique 64-bit ROM ID for user identification and authentication. There is also an 8-byte buffer inside the DS2488, which can be read and written by the microcontroller to update the battery information on both sides of the storage in real time. In this design, the information stored in the buffer is shown in Table 1.

Table 1. Information Stored in the DS2488 Buffer

Simplify TWS Headphone Solutions with 1-Wire Technology

The TOKEN pin of DS2488 indicates the control status of DS2488: TOKEN is low, indicating that the microcontroller of the charging box obtains the control authority of DS2488; TOKEN is high indicating that the microcontroller on the earphone side obtains the control authority of DS2488. The CD/PIOC pin of the DS2488 controls whether the charging box charges the headset: when the voltage on the 1-Wire bus (IOA) is less than 4V, the CD/PIOC is in a high-impedance state, the transistor is turned off, and charging stops; when the 1-Wire bus (IOA) is in a high-impedance state When the voltage on (IOA) is greater than 4V, CD/PIOC is low, the transistor is turned on, and the voltage on the 1-Wire bus (IOA) is directly applied to the charger of the headset, and charging starts. The selection logic of earphone charging and communication is mainly realized by a MOSFET connected to 5V. The on-off of the MOSFET is controlled by the microcontroller of the charging box. The use of the charging box and the earphone is mainly divided into the following situations.

The headset is in the charging case and the charging case lid is open

At this time, the microcontroller of the charging box turns off the MOSFET and obtains the control authority of the DS2488, TOKEN is low, and CD/PIOC is in a high-impedance state. The charging box reads and writes the internal 8-byte buffer of the DS2488 through the IOA, reads the byte information of the earphone battery, and updates the byte information written to the charging box battery. At this time, charging stops and communication is performed.

The headset is in the charging case and the charging case lid is closed

At this time, the microcontroller of the charging box turns on the MOSFET, and 5V is directly transmitted to the earphone through the 1-Wire bus (IOA). At this time, TOKEN is high and CD/PIOC is low. The 5V voltage of the charging box is transmitted to the earphone side to charge the lithium battery of the earphone. At the same time, the microcontroller of the headset obtains the control authority of the DS2488, reads and writes the internal 8-byte buffer of the DS2488 through the IOB, updates the byte information written to the headset battery, and reads the byte information of the charging box battery. At this time, communication stops and charging is performed.

The headset is not in the charging case or the charging case battery is dead

At this point, the 1-Wire bus (IOA) is in a high-impedance state, TOKEN is high, and CD/PIOC is in a high-impedance state. At this time, the microcontroller of the headset obtains the control authority of the DS2488, reads and writes the internal 8-byte buffer of the DS2488 through the IOB, and updates the byte information written into the battery of the headset.

DS2488 1-Wire Data Communication

As mentioned above, this design uses the DS2488 as a bridge between the charging box and the microcontrollers on both sides of the headset to realize data interaction between the microcontrollers on both sides. DS2488 supports typical 1-Wire communication protocol. The sequence of the protocol is divided into reset and response sequence and read and write sequence. The read and write sequence is divided into write 0 time slot, write 1 time slot and read time slot, as shown in Figure 4 and Figure 5 shown. The detailed data of the time range of each timing high and low level phase can refer to the DS2488 data sheet.

Simplify TWS Headphone Solutions with 1-Wire Technology

Figure 4. DS2488 1-Wire reset and response timing.

Simplify TWS Headphone Solutions with 1-Wire Technology

Simplify TWS Headphone Solutions with 1-Wire Technology

Simplify TWS Headphone Solutions with 1-Wire Technology

Figure 5. DS2488 1-Wire read and write timing.

All 1-Wire devices are internally composed of state machines, and the state transition diagram is shown in Figure 6. As shown in Figure 4, when the microcontroller sends a reset signal to the DS2488 device, the 1-Wire bus will be pulled low for 48μs to 80μs, and then the bus will be pulled high and released by the pull-up resistor. If the DS2488 is connected to the bus, the DS2488 will respond to this reset signal by pulling the 1-Wire bus low again for 6 to 10 μs after the bus is released 48 μs. At this time, the microcontroller can detect the level change on the bus, that is, whether there is a DS2488 connected to the 1-Wire bus by detecting whether the bus is pulled low again.

Simplify TWS Headphone Solutions with 1-Wire Technology

Figure 6. State transition diagram for a 1-Wire device.

When the DS2488 responds to the reset signal, the microcontroller will send the ROM Function Command. The ROM function commands are the same for all 1-Wire devices, and some common ROM function commands are shown in Table 2. Due to the design of TWS earphones, two earphones usually need to be accommodated in the charging box, so two DS2488s are usually connected to the 1-Wire bus (IOA). This design first uses the Read ROM command (0x33) and the Match ROM command (0x55) to read the ROM IDs of the two DS2488s on the 1-Wire bus (IOA) and the DS2488 device matching the specific ROM ID respectively, to realize the identification and identification of the left and right earphones. strobe.

Table 2. Common 1-Wire ROM Function Commands

Simplify TWS Headphone Solutions with 1-Wire Technology

After sending the ROM function command, the microcontroller will send the Device Function Command to perform further operations on the device. Different 1-Wire devices have different device function commands. For the DS2488, some common device function commands are shown in Table 3. In this design, the Write Buffer command (0x33) and the Read Buffer command (0x44) are used to read and write the 8-byte buffer inside the DS2488 to realize the interaction between the charging box and the earphone battery information.

Table 3. Commonly used DS2488 device function commands

Simplify TWS Headphone Solutions with 1-Wire Technology

The two sets of GPIOs (P0.6 and P0.7, P0.18 and P0.19) of the microcontroller MAX32655 of the charging box can be configured as the OWM_IO pin and OWM_PE pin of the 1-Wire module, respectively, which are the same as those of the DS2488. communication and 5V transmission. This design connects the OWM_IO pin of the MAX32655 to the IOA pin of the DS2488 to implement 1-Wire communication between the charging box and the DS2488.

The difference is that, considering that some microcontrollers on the market do not have 1-Wire interface, for the convenience of user design, the microcontroller MAX32655 of the headset uses UART interface to simulate 1-Wire timing, and communicates with DS2488 through IOB. As shown in Figure 3. The microcontroller does this by configuring a specific UART baud rate and sending a specific pattern. Taking the reset and response sequence shown in Figure 4 as an example, when the baud rate is 115200, the time length for the UART to send and receive each bit of data is about 8.68 μs. Therefore, the time length of 1 byte (8 bits) of data is about 69.44 μs, and 0xE0 (binary: 11100000) (UART sends low-order data first) corresponds to the timing of the 1-Wire reset signal. At this time, if the microcontroller sends 0xE0 (reset signal) through TX, the DS2488 on the 1-Wire bus (IOB) will respond to this reset signal and pull the bus down for 6μs to 10μs, and the signal received on RX should be 0xC0 (binary: 11000000) or 0x80 (binary: 10000000). The microcontroller can achieve the function of simulating 1-Wire timing through the UART by sending and receiving different patterns and comparing the received and sent signals.

DS2488 1-Wire Power Delivery

As shown in Figure 3, the OWM_PE pin of the microcontroller MAX32655 of the charging box controls the on-off of the MOSFET. When the MOSFET is off, the system performs 1-Wire communication; when the MOSFET is on, the 5V voltage passes through the 1-Wire bus ( IOA) is transmitted to the earphone side. At this time, the DS2488 detects 5V, and the CD/PIOC pin changes to a low level to turn on the transistor, and the 5V voltage is transmitted to the charger to charge the lithium battery of the earphone.

Battery Management and Power Configuration

The battery management and power configuration system of the charging box consists of the USB Type-C charger MAX77751, fuel gauge MAX17262, step-up DC/DC converter MAX17224 and step-down DC/DC converter MAX38640. Typically, the end-of-charge voltage of a single-cell lithium battery is 4.2V, so the MAX77751CEFG+ is chosen as the specific charger model. The charging current of this charger is configured by the resistors connected to the IFAST pin and the ITOPOFF pin. Considering the actual needs, a fast charging current of 500mA and a termination current of 100mA are selected, and the corresponding resistances are 2.4kΩ and 8.06kΩ, respectively. The fuel gauge MAX17262 has the ModelGauge m5 EZ algorithm, which can automatically measure the battery after configuring battery parameters such as battery capacity, termination current, and charging voltage threshold, without additional battery modeling. The output voltages of the step-up DC/DC converter MAX17224 and step-down DC/DC converter MAX38640 are both configured by resistors connected to the SEL and RSEL pins, where 0Ω and 56.2kΩ are chosen to output 5V and 3.3V, respectively .

The battery management and power configuration system for the headset consists of the MAX77734 charger and the MAX17262 fuel gauge. The SIMO output of the microcontroller MAX32655 also provides both 1.8V and 1.2V power rails for the system. Since only one 3.3V LDO output is required, the specific model of the charger is MAX77734GENP+. The charger can also be configured via I2C into factory shipping, shutdown and standby modes to extend battery life. The microcontroller MAX32655 provides four SIMO outputs, each of which can be configured to output a different voltage through registers.

Firmware Design

The firmware flow chart of the charging box is shown in Figure 7. After power up, the charging box’s microcontroller will initialize the GPIOs and configure the fuel gauge MAX17262 and the OLED module. The microcontroller then polls the status of the charging case cover. If the charging case door is closed, the microcontroller will disable the 1-Wire module and apply 5V to the 1-Wire bus (IOA) to charge the headset. In this state, if the microprocessor detects that the remaining capacity of the battery in the charging case is less than 5%, charging will stop. If the charging case door is open, the microcontroller disables the 5V charging voltage and enables the 1-Wire module to read and write to the DS2488’s buffer. The battery information of the charging box and the headset is displayed through the OLED module or virtual serial port.

Simplify TWS Headphone Solutions with 1-Wire Technology

Figure 7. The charging case firmware flow chart.

The firmware flow chart of the headset is shown in Figure 8. After power-up, the headset’s microcontroller initializes the GPIOs, configuring the MAX17262 fuel gauge and the MAX77734 charger. The microcontroller then polls the charger for a valid input voltage. If the input voltage is valid and greater than 4V, the microcontroller enables the charger and begins charging. At this point, the microcontroller polls the status of TOKEN, and if TOKEN is low, the charging box has read and write permissions for the DS2488. If TOKEN is high, the headset has the read and write permission of DS2488, and the microcontroller writes the battery information of the headset into the buffer of DS2488 for the charging box to read.

Simplify TWS Headphone Solutions with 1-Wire Technology

Figure 8. Headphone firmware flowchart.

Test Results

The design requirements and test results of the power rails for the charging case and earphones are shown in Tables 4 and 5. It can be seen that this design can meet the design requirements of the system.

Table 4. Design Requirements and Test Results for Charging Box Power Rails

Simplify TWS Headphone Solutions with 1-Wire Technology

Table 5. Design Requirements and Test Results for Headphone Power Rails

Simplify TWS Headphone Solutions with 1-Wire Technology

The test results when the charging box cover is closed and when the charging box cover is open are shown in Figure 9 and Figure 10. It can be seen that this design can Display the information of the charging box and the earphone battery in real time, and read and display the ROM ID of the DS2488 on the earphone.

Simplify TWS Headphone Solutions with 1-Wire Technology

Figure 9. Test results with the charging case cover closed.

Simplify TWS Headphone Solutions with 1-Wire Technology

Figure 10. Test results with the charging case cover open.

in conclusion

Prototyping TWS headsets is often a huge challenge for engineers, balancing ease of use, low cost, portability, and stability. The DS2488 1-Wire bidirectional bridge paves the way for a low-power, high-stability, high-performance TWS headset solution in a smaller space and at a lower cost. Based on the DS2488, the MAXREFDES1302 includes hardware and firmware design for power transfer and data communication through only two contact points, and is an easy-to-use TWS headset prototype.

Reference circuit

TWS solution based on MAXIM PLC technology. Fang Liang, Jia Ning, Electronics World, May 2021.

MAX32655 User’s Guide. Maxim Integrated, March 2021.

The Links:   G121S1-L02 LM215WF3-SLC2 IGBTMODULE