Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

multi-drop slaves

multi-drop slaves

2006-05-17 by David Collier

I want to string a load of simple slaves out along a serial bus.

Does anyone think I could implement a 1-wire slave using an ATtinyx5?

Yes I know it's patented.

Alternatively does anyone have a better suggestion? Would the I2C 
look-alike mode do it for me? Anyone got any experience of such a thing, 
or know where to scrounge the necessary code?

All suggestions gratefully received.

David

Re: [AVR-Chat] multi-drop slaves

2006-05-17 by Jim Wagner

Both SPI and TWI (I2C) are multi-drop. SPI requires a
separate enable (chip select) for each device so that could
mean a lot of "wires". Neither is designed for more than a
few meters.

For regular serial, RS422 is the one-talker, many listener
protocol and RS485 is the many-talk, many listen version
though they pretty much use the same hardware. National
Semiconductor, Linear Tech, and Maxim all have good app
notes on RS422/485. I have some experience and can help if
needed. These are good for a few km and use twisted pair.
They both tend to want linear topology rather than star
because of termination issues. Depending on the
transceiver, you can put 32 or more on a single system.
There is no predefined "protocol"; you have to make that up
for yourself.

CAN is like RS485 with a protocol built on top, as I
recall.

Jim


On Wed, 17 May 2006 11:02 +0100 (BST)
 "David Collier" <from_yahooAVRchat@dexdyne.com> wrote:
> 
> I want to string a load of simple slaves out along a
> serial bus.
> 
> Does anyone think I could implement a 1-wire slave using
> an ATtinyx5?
> 
> Yes I know it's patented.
> 
> Alternatively does anyone have a better suggestion? Would
> the I2C 
> look-alike mode do it for me? Anyone got any experience
> of such a thing, 
> or know where to scrounge the necessary code?
> 
> All suggestions gratefully received.
> 
> David
> 


---------------------------------------------------------------
The Think Different Store
http://www.thinkdifferentstore.com/
For All Your Mac Gear
---------------------------------------------------------------

Re: [AVR-Chat] multi-drop slaves

2006-05-17 by Ned Konz

Jim Wagner wrote:
> Both SPI and TWI (I2C) are multi-drop. SPI requires a
> separate enable (chip select) for each device so that could
> mean a lot of "wires". Neither is designed for more than a
> few meters.

Though Philips has some interesting new I2C bus extenders.

> For regular serial, RS422 is the one-talker, many listener
> protocol and RS485 is the many-talk, many listen version
> though they pretty much use the same hardware. 

> CAN is like RS485 with a protocol built on top, as I
> recall.

No, it's much more than that. For one thing, there are no masters.
And it's electrically more robust (it's differential, and typically will
work at a reduced speed even if one of the 2 wires is shorted to ground
or power). Good for several km easily.
Among other things, there are actually specifications regarding timing,
error detection and correction, etc., and is always implemented in
hardware (to be really CAN compliant).
See http://www.can-cia.org/

It's probably too heavy-duty for a TinyX5.

> On Wed, 17 May 2006 11:02 +0100 (BST)
>  "David Collier" <from_yahooAVRchat@dexdyne.com> wrote:
>> I want to string a load of simple slaves out along a
>> serial bus.
>>
>> Does anyone think I could implement a 1-wire slave using
>> an ATtinyx5?

Sure. You could do something very much like the Dallas/Maxim 1-wire bus.
You would have to switch between input mode and output LOW mode on the pin.

>> Yes I know it's patented.
>>
>> Alternatively does anyone have a better suggestion? Would
>> the I2C 
>> look-alike mode do it for me? Anyone got any experience
>> of such a thing, 
>> or know where to scrounge the necessary code?

Another scheme to look at would be the LIN bus; it's one wire and good
for limited distances (and slow; 19200 bps). Typically implemented using
standard UARTs.

http://www.interfacebus.com/Design_Connector_LIN_Bus.html

Atmel have an app note with C code in it (for another micro family, but
might be useful):

http://www.atmel.com/dyn/resources/prod_documents/doc4189.pdf
http://www.atmel.com/dyn/resources/prod_documents/Code_4189B.zip


-- 
Ned Konz
ned@bike-nomad.com
http://bike-nomad.com

Re: [AVR-Chat] multi-drop slaves

2006-05-17 by Peter Jakacki

David Collier wrote:
> I want to string a load of simple slaves out along a serial bus.
> 
> Does anyone think I could implement a 1-wire slave using an ATtinyx5?
> 
> Yes I know it's patented.
> 
> Alternatively does anyone have a better suggestion? Would the I2C 
> look-alike mode do it for me? Anyone got any experience of such a thing, 
> or know where to scrounge the necessary code?
> 
> All suggestions gratefully received.

You didn't say how far apart these slaves would be and what sort of 
environment etc. If they are within a metre or two you could use TWI aka 
I2C as this is well suited for low-speed local multi-drop. Although I2C 
is not suited for long stretches I used to run LCD displays off I2C over 
10's of metres many years ago in harsh environments, but this is not 
recommended practice :)

There is also SPI but not in the regular way which requires slave 
selects etc. You can use it in two wire mode by multi-dropping the 
clocks and the MOSI pins, forgetting the MISO as it becomes redundant.
For the USI on the Tiny it looks like you need to join the DI and DO 
together to achieve this. It's usually good practice to isolate each pin 
via a small value resistor (I use 220R). Software leaves each device in 
slave mode until one wants to talk, and provided there are no collisions 
then each slave device gets the same message. When one wants to reply, 
well it does the same thing and switches to master mode temporarily. I 
have used this method on other micros at high-speed for locally 
connected modules.

Also, the tinys do seem to work in half-duplex asynchronous mode, at 
least according to the docs. This is the method I have used on other 
micros where you can simply tie the txd and rxd of a uart together 
(assuming txd can be tristated) and form a 1-wire asynchronous 
multi-drop bus. Once again it is good practice to isolate the txd pin 
with a small value resistor and include a high-value resistor and 
optional filtering cap in the rxd pin for extra protection.

If you want distance then there are many options with RS485 being the 
most common and quite doable on the tinys.

*Peter*

Re: [AVR-Chat] multi-drop slaves

2006-05-17 by Robert Adsett

At 11:02 AM 5/17/2006 +0100, David Collier wrote:

>I want to string a load of simple slaves out along a serial bus.
>
>Does anyone think I could implement a 1-wire slave using an ATtinyx5?
>
>Yes I know it's patented.
>
>Alternatively does anyone have a better suggestion? Would the I2C
>look-alike mode do it for me? Anyone got any experience of such a thing,
>or know where to scrounge the necessary code?

LIN maybe?

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Re: [AVR-Chat] multi-drop slaves

2006-05-18 by David Collier

Thanks Jim,

I'm looking at 10 feet or so, so I want I2C or similar.

I'm trying to do a "conceptual replacement" for something resembling a 
1-wire architecture.

I've just looked at the various ATtinies, and I hadn't realised what a 
variety of serial interfaces ( or lack of them ) there are.

David
Show quoted textHide quoted text
> *Subject:* Re: [AVR-Chat] multi-drop slaves
> *From:* "Jim Wagner" <jim_d_wagner@applelinks.net>
> *To:* AVR-Chat@yahoogroups.com
> *Date:* Wed, 17 May 2006 11:18:46 -0400

Re: [AVR-Chat] multi-drop slaves

2006-05-18 by David Collier

fred fred fred
X-Ameol-Version: 2.55.2048, Microsoft Windows XP Professional Service Pack 2 (Build 2600)

thanks Ned.

The Lin-bus does look like a good candidate - very frustrating that my 
vehicle supply is 24V, but I can live with that.

question is - can I do it on a micro which doesn't have a UART... could 
be fun and games. I feel a 2313 coming on.

Melexis do a regulator+transceiver which looks good. Funnily enough, 
it's one of their sensor chips I'm trying to interface!

Many thanks

Re: [AVR-Chat] multi-drop slaves

2006-05-18 by David Collier

fred fred fred
X-Ameol-Version: 2.55.2048, Microsoft Windows XP Professional Service Pack 2 (Build 2600)

> You didn't say how far apart these slaves would be and what sort of 
> environment etc. If they are within a metre or two you could use TWI 
> aka I2C as this is well suited for low-speed local multi-drop. 
> Although I2C is not suited for long stretches I used to run LCD 
> displays off I2C over 10's of metres many years ago in harsh 
> environments, but this is not recommended practice :)

3 metres total, auto environment, 24V supply

I reckon I2C with a checksum would do it ... but LIN is a better 
standard, if I can do it without a h/w UART

> There is also SPI but not in the regular way which requires slave 
> selects etc. You can use it in two wire mode by multi-dropping the 
> clocks and the MOSI pins, forgetting the MISO as it becomes redundant.
> For the USI on the Tiny it looks like you need to join the DI and DO 
> together to achieve this. It's usually good practice to isolate each 
> pin via a small value resistor (I use 220R). Software leaves each 
> device in slave mode until one wants to talk, and provided there are 
> no collisions then each slave device gets the same message. When one 
> wants to reply, well it does the same thing and switches to master 
> mode temporarily. I have used this method on other micros at 
> high-speed for locally connected modules.

Hmmm... that would work... but does it end up with any advantage over 
s/w I2C? At least that defines a start and a stop condition.

> Also, the tinys do seem to work in half-duplex asynchronous mode, at 
> least according to the docs. This is the method I have used on other 
> micros where you can simply tie the txd and rxd of a uart together 
> (assuming txd can be tristated) and form a 1-wire asynchronous 
> multi-drop bus. Once again it is good practice to isolate the txd pin 
> with a small value resistor and include a high-value resistor and 
> optional filtering cap in the rxd pin for extra protection.

but I though there was only one tiny with a "true UART"???

> If you want distance then there are many options with RS485 being the 
> most common and quite doable on the tinys.

I'm not keen on adding the cost of a 485 transceiver, but it may come to 
that.

Many thanks 

David

Re: [AVR-Chat] multi-drop slaves

2006-05-18 by David Collier

fred fred fred
X-Ameol-Version: 2.55.2048, Microsoft Windows XP Professional Service Pack 2 (Build 2600)

yup, AVR have some example code....

they say in one place that it can work with a tiny45/85 using the USI... 
but give no detail.

I haven't looked at the source code yet.

David
Show quoted textHide quoted text
> *Subject:* Re: [AVR-Chat] multi-drop slaves
> *From:* Ned Konz <ned@bike-nomad.com>
> *To:* AVR-Chat@yahoogroups.com
> *Date:* Wed, 17 May 2006 13:53:14 -0700

Re: [AVR-Chat] multi-drop slaves

2006-05-18 by David Collier

fred fred fred
X-Ameol-Version: 2.55.2048, Microsoft Windows XP Professional Service Pack 2 (Build 2600)

and yes, indeed, the Atmel description says it includes examples for the 
ATtiny using the USI, but the zip file does not appear to contain any C 
source to cover that possibility.

David
Show quoted textHide quoted text
> *Subject:* Re: [AVR-Chat] multi-drop slaves
> *From:* Ned Konz <ned@bike-nomad.com>
> *To:* AVR-Chat@yahoogroups.com
> *Date:* Wed, 17 May 2006 13:53:14 -0700

Re: [AVR-Chat] multi-drop slaves

2006-05-18 by Ned Konz

David Collier wrote:

> The Lin-bus does look like a good candidate - very frustrating that my 
> vehicle supply is 24V, but I can live with that.

Some LIN bus transceivers come with voltage regulators. I believe the 
Atmel one does; Freescale (the Semiconductor Company Formerly Known As 
Motorola) also tend to put beefy regulators on their automotive parts, 
though I don't know about their LIN devices. (For instance, their 
(first, larger) efield sensor chip has both a supply regulator and a 
self-monitoring lamp driver).

> question is - can I do it on a micro which doesn't have a UART... could 
> be fun and games. I feel a 2313 coming on.

The USI is pretty easy to use, along with the timer and/or edge 
triggers. Atmel have sample code for this.


Thanks,
-- 
Ned Konz
ned@bike-nomad.com
http://bike-nomad.com

Re: [AVR-Chat] multi-drop slaves

2006-05-18 by David Collier

fred fred fred
X-Ameol-Version: 2.55.2048, Microsoft Windows XP Professional Service Pack 2 (Build 2600)

yeah I suppose I need to stop looking for examples of "USI as LIN" and 
start looking for "USI  as UART"

Be fine if I don't have to train the clock with the sync sequence...

David

STK525 and zipped files

2006-05-19 by Peter Gargano

Anyone out there with an STK525 (or even the new USBKEY with the 
AT90USB1287) ? I'm trying to get the zip password for these files on 
the disk - Soanar have not been able to come up with a password that 
works, and Atmel didn't reply overnight :

   at90usb128-stk525-demo-3enum-host-mouse-1_0_0.zip
   at90usb128-stk525-demo-storage-df-1_0_0.zip

Please reply off-list if you do, or mention you have them and I'll 
email you direct - ie. they are passwords!

Is anyone else playing with the new USB1287 AVR chip? I'll be trying 
to get host-mode working with USB Mass-Storage-Class (MSC) support 
when I get hold of some code to start off with. I have not been able 
to locate any Atmel code to do this yet - the closest is host-mode HID 
(the mouse file above) and device-mode MSC (the other file).

Peter.

Re: [AVR-Chat] multi-drop slaves

2006-05-19 by David Collier

> *Subject:* Re: [AVR-Chat] multi-drop slaves
> *From:* Robert Adsett <subscriptions@aeolusdevelopment.com>
> *To:* AVR-Chat@yahoogroups.com
> *Date:* Wed, 17 May 2006 18:40:01 -0400
> 
> LIN maybe?

Absolutely - thank you for the lead.

David

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.