1. Technical Field
Embodiments of the present disclosure generally relate to data read and write devices and methods, and more particularly to a data read and write device and method for a USB port of a 1-wire device.
2. Description of Related Art
Integrated circuits (ICs) are more expensive when they have more pins. To reduce the number of pins in a package, many ICs use a serial bus to transfer data when speed is not important. Some examples of such low-cost serial buses include Serial Peripheral Interface (SPI) bus, I2C, Scalable Coherent Interface (SCI), and 1-Wire. Because they provide low-speed data, signaling, and power over a single signal, the 1-Wire is typical used to communicate with small inexpensive devices such as digital thermometers and weather instruments. However, it is difficult to test a 1-Wire device because the 1-Wire device does not have a read and write tool.
The disclosure is illustrated by way of example and not by way of limitation in the figures of the accompanying drawings in which like references indicate similar elements. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean at least one.
As shown in
In the embodiment, the data read/write device 1 is connected to the 1-wire slave 3 via the connector 13, and is connected to the host computer 2 via the USB connector 15. The microcontroller 10 further includes a USB buffer 110 that stores the data transferred between the 1-wire slave 3 and the host computer 2, such as feedback data from 1-wire slave 3, for example.
In the embodiment, the power supply 11 provides a first voltage to the USB interface 200. The voltage regulator 12 transmits the first voltage to the connector 13. As illustrated in
When the host computer 2 sends a USB command to the data read/write device 1 via the USB connector 15, the microcontroller 10 receives the USB command, and converts the USB command to a 1-wire command.
The 1-wire host 300 controls one of the DIO pins 120 to simulate the 1-wire bus, to transfer the 1-Wire command to the 1-Wire slave 3 that is connected to the connector 13. After receiving the 1-wire command, the 1-wire slave 3 may feedback data to the microcontroller 10. The 1-wire host 300 receives the feedback data, and temporarily stores the feedback data into the USB buffer 110. And then the microcontroller 10 sends the feedback data to the host computer 2.
In the embodiment, one terminal of the ESD protect unit 14 is electrically connected to the microcontroller 10 and the USB connector 15, and the other terminal of the ESD protect unit 14 is electrically connected to the power supply 11 and the voltage regulator 12. The ESD protect unit 14 is used for performing overvoltage protection on the microcontroller 10 and the USB connector 15.
In block 5600, the host computer 2 sends a USB command to the USB interface 200 via the USB connector 15. In the embodiment, the USB command represents data having a USB transfer format.
In block 5602, the microcontroller 10 converts the USB command to a 1-wire command, and transmits the 1-wire command to the 1-wire host 300. In one embodiment, the 1-wire command represents data having a 1-wire transfer format and can be transferred through 1-wire buses.
In block 5604, the 1-wire host 300 controls one of the DIO pins 120 of the microcontroller 10 to simulate the 1-wire bus, to transfer the 1-Wire command to the 1-Wire slave 3 that is connected to the connector 13 via the 1-wire bus. After receiving the 1-wire command, the 1-wire slave 3 may feedback data to the microcontroller 10.
In block 5606, the 1-wire host 300 receives the feedback data from the 1-wire slave 3, and temporarily stores the feedback data into the USB buffer 110.
In block 5608, the microcontroller 10 sends the feedback data to the host computer 2 via the USB connector 15.
Although certain inventive embodiments of the present disclosure have been specifically described, the present disclosure is not to be construed as being limited thereto. Various changes or modifications may be made to the present disclosure without departing from the scope and spirit of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
201010268115.0 | Aug 2010 | CN | national |