Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Send data with one wire protocol?

Status
Not open for further replies.

ArFa

Junior Member level 2
Joined
Dec 27, 2010
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,438
Hi there,
I want to send data through one wire protocol from stm8.
So, stm8 will act as one wire slave device, and send those data to another device through one wire protocol.

Please if you can, tell me how to solve this problem !
 

Do you want to send data in both directions?

I'm not familiar with the STM8, but if it's got a built-in UART, then use that.
 
Last edited:

Do you want to send data in both directions?

I'm not familiar with the STM8, but if it's got a built-in UART, then use that.

yeah it have a built-in UART, but how to communicate with one wire and UART ?
 

I'm not familar with STM8 either but I have coded several master and slave 1-Wire applications.

You have to write your own timing routines to generate the reset pulse and clock pulses. Their timing is fairly critical. Remember there is only one master device on a 1-Wire bus so the slaves don't need to generate a clock as well.
The master varies the length of the clock pulses to send data out then sends fixed short pulses to read the reply back. After each of the receive clock pulses, switch the clock line direction so it becomes an input and see if the slave is still pulling it low or not to recover the reply.

The slave(s) have to recognize the length of pulses to tell the difference between reset, 0 and 1 being sent and after the required number of clock pulses, switch direction then either pull the line low or not to send it's reply.

Brian.
 

I'm not familar with STM8 either but I have coded several master and slave 1-Wire applications.

You have to write your own timing routines to generate the reset pulse and clock pulses. Their timing is fairly critical. Remember there is only one master device on a 1-Wire bus so the slaves don't need to generate a clock as well.
The master varies the length of the clock pulses to send data out then sends fixed short pulses to read the reply back. After each of the receive clock pulses, switch the clock line direction so it becomes an input and see if the slave is still pulling it low or not to recover the reply.

The slave(s) have to recognize the length of pulses to tell the difference between reset, 0 and 1 being sent and after the required number of clock pulses, switch direction then either pull the line low or not to send it's reply.

Brian.

Brian, this sounds a lot harder than it has to be. If you are communicating at a known baud rate,the UARTs at either end take care of everything. The only thing the host(master) has to manage is changing the port direction.

For example, the host transmits a request to the slave,and then turns the port to receive. Once the message has been received from the slave, the host then turns the port back to transmit. The slave only gets control of the wire when commanded by the host.
 

Brian, this sounds a lot harder than it has to be. If you are communicating at a known baud rate,the UARTs at either end take care of everything. The only thing the host(master) has to manage is changing the port direction.

For example, the host transmits a request to the slave,and then turns the port to receive. Once the message has been received from the slave, the host then turns the port back to transmit. The slave only gets control of the wire when commanded by the host.

look what wikipedia says:
When receiving data, the master sends a 1–15-µs 0-volt pulse to start each bit. If the transmitting slave unit wants to send a "1", it does nothing, and the bus goes to the pulled-up voltage. If the transmitting slave wants to send a "0", it pulls the data line to ground for 60 µs.
do you think that UART will handle that?
 

While I agree that a UART can do bi-directional communication on a single wire if done carefully, they cannot comply with 1-Wire standards. My preference would always be to use a UART because it makes software so easy but there are instances where they simply can't work, 1-Wire is one of them.

UART communication relies on a fixed bit rate and transfers data in or out of a shift register with each bit period having its data driven high or low. 1-Wire is pulled-up and relies on the timing of the master to pull the line low for both outgoing (master -> slave) and incoming bit transfers. The master produces different width pulses to send outgong data and fixed length pulses to clock the response back in again. It relies of the data direction changing on every single bit, a UART based system can only change direction between stop and any following start bits.

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top