Propeller and AVR's
Eric Peterson
Posts: 2
Hello,
·
I am new with the Propeller and here is my situation:
·
I need the Propeller to communicate with several Atmel AVRs on a shared bus. I am very limited as far as pins on the bus so I was hoping to use UART's·at TTL levels and incorporate·tri-state ability for the AVR transmitters. Another option would be to use the SPI (MOSI,MISO,SCK) on the AVR's. So my questions are:
·
1. Is there·a source code object that would allow the Propeller to talk to the AVR's using their·SPI?
·
2. Is I2c an option?
·
3. Is there a simpler method than tri-stating the transmitters on the AVR's?
·
Any info is greatly appreciated.
·
Eric···
·
I am new with the Propeller and here is my situation:
·
I need the Propeller to communicate with several Atmel AVRs on a shared bus. I am very limited as far as pins on the bus so I was hoping to use UART's·at TTL levels and incorporate·tri-state ability for the AVR transmitters. Another option would be to use the SPI (MOSI,MISO,SCK) on the AVR's. So my questions are:
·
1. Is there·a source code object that would allow the Propeller to talk to the AVR's using their·SPI?
·
2. Is I2c an option?
·
3. Is there a simpler method than tri-stating the transmitters on the AVR's?
·
Any info is greatly appreciated.
·
Eric···
Comments
2) There is an I2C master package also in the Object Exchange Library written in SPIN. I have an assembly I2C routine that's part of the Propeller OS that is usable on its own as well.
3) On a shared bus, you'll have to have some kind of party line. You can tri-state the transmitters. You can use the transmitters to feed a transistor (bipolar or MOSFET) that provides an open-collector (open-drain) bus with a pullup resistor. If you have a limited number of AVRs, you could use a 1:8 or 1:16 multiplexor to select which AVR you're going to listen to. If you have enough spare Propeller pins, you could just wire a separate pin to each AVR's transmit line, but use a single Propeller pin to transmit to all the AVRs. You could effectively do a "wired-or" in software in the serial input routines to simplify some of the coding (change the references from a single pin (INA[noparse][[/noparse]x]) being a one to a range of pins (INA[noparse][[/noparse]x..y]) being non-zero.
How many AVR's ?
How long one from another ?
Did you think in a RS485 line ? It's not difficult.....
RS485 line using FullDuplexSrial propeller object could be fine.
Regards.
Alberto.
How far? Inches or meters?
If it is mere inches I2C is likely the best as it has acknowledge and can indicate the need to resend, upto 400K bits per second in some case.
SPI is much simpler and much faster, up to Mhz of bits per second - good for being on the same board, but not much else.
Technically RS485 is never full duplex. Full duplex is RS-422. But that can go for kilometers using the RS-232 software with the TTL going into RS-422 Transmiters and Recievers.
So if the AVR uses full duplex serial, it is likely the simplest for both distance and speed.
I2C and SPI don't over the full duplex and usually require timing a Master/Slave link. More complex software control.
I am not sure what 'tristating the transmiters on the AVRs' means. And this is an awkward place to ask for tech support on the AVR side of it all. I just don't have time to learn them too, the PDFs are huge
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"If you want more fiber, eat the package.· Not enough?· Eat the manual."········
I decided to use the UARTs and add a 74hc125 to tristate the unused transmit lines. Works great.
BTX: The distance is inches accross the same board.
Kramer: Tristating is putting the unused transmitters into a high impedance state so that the other transmitters can use the same line.
Thanks again,
Eric