Page 1 of 1
OneWire Com between 2 MCU's
Posted: Mon Jun 17, 2024 12:32 pm
by Alan_37
hello
I am trying to communicate between a PIC12F1280 and an STM32F411 using OneWire .
I chose OneWire cos the PIC has few I/O pins .
I just wanted to Know if this is possible before dedicating the time for it .
So far I can see 2 issues :
1 , The One wire component is designed to be the host and dose not have any ROM identifier .
for this can do skip rom since there will be only 2 devices ?
2, Both of the MCU will be Host ( Master ) can they still communicate ?
Do we have a OneWire slave component in flowcode ?
Re: OneWire Com between 2 MCU's
Posted: Mon Jun 17, 2024 1:49 pm
by kersing
You need one host and a slave, two hosts can”t communicate using one-wire. Given that one-wire is very timing critical I would suggest looking at alternate options. If you have a second free pin software serial springs to mind.
Re: OneWire Com between 2 MCU's
Posted: Mon Jun 17, 2024 2:39 pm
by mnfisher
The timing is fairly 'loose' for 1-wire (see
https://en.wikipedia.org/wiki/1-Wire) It would be surely possible to implement a 'slave' component (or just protocol)
The master sends a low pulse (reset) to start comms - after which slaves reply b holding the bus low. The pulses need to be within 'limits' (<15us for 1 and >60us for 0) which should be easily achievable on an MCU?
But yes - serial, i2c etc would be easier?
Martin
Re: OneWire Com between 2 MCU's
Posted: Mon Jun 17, 2024 3:05 pm
by kersing
The timing is fairly 'loose' for 1-wire
Have you used one-wire devices with PIC controllers? With the official ones you’ll be hard pushed to use them with a PIC that isn’t running at least 4MHz and even then you might have timing issues. (I still have stock of hundreds of 1-wire devices from the time DalSemi produced them, haven’t used them for the last 5 years because of the timing issues)
Re: OneWire Com between 2 MCU's
Posted: Mon Jun 17, 2024 3:23 pm
by mnfisher
Not with PIC no.... Something running at a reasonable speed (32MHz - 8MHz instruction rate) should be okay though?
The wikipedia page made it look so easy too - though generating the '1' pulse would be the sticking point on a slow MCU - the slave only has to check that the line is still low at about 30us?
I got some of the 1024 bit eeproms working nicely with an Arduino recently (and some iButtons - which just seem to be a unique id tag)
Martin
Re: OneWire Com between 2 MCU's
Posted: Mon Jun 17, 2024 3:30 pm
by Alan_37
Hello again
Well good thing I asked before trying

, I think a One wire slave would be a good addition to flowcode 10
maybe I should post a request on Feature Request for this .
I stand to correction but I think
As in almost all comm protocols timing is important, although 1 wire dose not have a specific baud rate
it relays on timing to distinguish from 1 to 0 , timing is in us so I guess it wont be possible with an MPU running at low frequency
.
.

- 2024-06-17 16 18 14.jpg (40.68 KiB) Viewed 4755 times
Thanks for your help I will look for an Alternative .
Re: OneWire Com between 2 MCU's
Posted: Mon Jun 17, 2024 3:52 pm
by kersing
mnfisher wrote: ↑Mon Jun 17, 2024 3:23 pm
Not with PIC no.... Something running at a reasonable speed (32MHz - 8MHz instruction rate) should be okay though?
The wikipedia page made it look so easy too - though generating the '1' pulse would be the sticking point on a slow MCU - the slave only has to check that the line is still low at about 30us?
I got some of the 1024 bit eeproms working nicely with an Arduino recently (and some iButtons - which just seem to be a unique id tag)
Martin
Atmel chips run at high instruction rates compared to most 8 bit PICs. Trust me, getting the sample point timing right is a challenge.