OneWire Com between 2 MCU's

For general Flowcode discussion that does not belong in the other sections.
Post Reply
Alan_37
Posts: 170
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 51 times
Been thanked: 22 times

Flowcode v10 OneWire Com between 2 MCU's

Post 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 ?

kersing
Valued Contributor
Posts: 180
Joined: Wed Dec 02, 2020 7:28 pm
Has thanked: 73 times
Been thanked: 63 times

Re: OneWire Com between 2 MCU's

Post 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.

mnfisher
Valued Contributor
Posts: 1133
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 114 times
Been thanked: 596 times

Re: OneWire Com between 2 MCU's

Post 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

kersing
Valued Contributor
Posts: 180
Joined: Wed Dec 02, 2020 7:28 pm
Has thanked: 73 times
Been thanked: 63 times

Re: OneWire Com between 2 MCU's

Post 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)

mnfisher
Valued Contributor
Posts: 1133
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 114 times
Been thanked: 596 times

Re: OneWire Com between 2 MCU's

Post 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

Alan_37
Posts: 170
Joined: Thu Dec 03, 2020 7:23 pm
Has thanked: 51 times
Been thanked: 22 times

Re: OneWire Com between 2 MCU's

Post 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
2024-06-17 16 18 14.jpg (40.68 KiB) Viewed 2193 times

Thanks for your help I will look for an Alternative .
Last edited by Alan_37 on Mon Jun 17, 2024 4:05 pm, edited 1 time in total.

kersing
Valued Contributor
Posts: 180
Joined: Wed Dec 02, 2020 7:28 pm
Has thanked: 73 times
Been thanked: 63 times

Re: OneWire Com between 2 MCU's

Post 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.

Post Reply