Dynamic addressing I2C slaves; making it plug-and-play - labview

I'm controlling a couple of i2c slaves (PCA9505) using the I2C module of National Instruments LabVIEW. I need to improve the project so I can add new slaves to the bus without manually adjusting the address of the slaves. (pins A0 A1 A2 on PCA9505). As a consequence, hardcoding the addresses is not a option.
Also, PCA has only 3 pins, so I can add max 8 slaves. I need to go for 16.
How can I give the slaves dynamic addresses?
How can I expand to 16 slaves?
Thanks for your help!
PS: PCA9505 = 40-bit parallel input/output (I/O) port expansion for I2C-bus applications

Personally, I like to use a configuration file to set the parameters needed for an application. In this case, it would define the addresses for each device you need to talk to. Arrays also help a lot here for expandability.
As far as extending your I2C bus, you can use something like a PCA9544A I2C mux. This chip allows for controlling 4 different buses. You will have to control the mux as part of your addressing of the individual chips.

From a brief read of the PCA9505 datasheet it doesn't look as if there's any way of selecting the device's address other than using those address lines. You are either going to have to multiplex the bus as crossrulz suggests, so that each device is at the same address on a different I2C bus, and add code to control which one you talk to at any one time, or add some hardware that sets the address lines differently for each device.
Will the devices be added to the bus via some sort of connector? If so could you include the address lines in the connector, so that each connector on the master adapter sets a different address for the device that's plugged in to it? Or if you connect devices in a daisy chain, each device could add 1 to the address on its upstream connector and output the new address on its downstream connector?

Related

Determine GPIB primary/secondary addresses using GPIB commands

How do I determine the General Purpose Interface Bus primary/secondary addresses using General Purpose Interface Bus commands?
If you want to see what addresses are in use on the bus you can send an unlisten. Then send an address to listen for each address on the bus, monitoring for the NDAC going low. You have to unlisten each device. The 488.2 spec has a command look for all Devices. There is also the 488.2 command *STB? To get the status byte from each instrument. But that requires all instruments to conform to 488.2. A serial poll with a check for each device then check the status byte.
The secondary addresses are private to each device. They are not necessarily addresses. They may be device specific commands. You’ll need the manuals.

LoRa UART or SPI?

I have a Gateway - Node application using the LoRa module but I don't know whether to choose the LoRa module to interface UART or SPI.
Can someone help me distinguish the difference when using these two types? Example: when I have 5 Nodes connected to Gatewway, which one should I use? and same when I have 50 Nodes.
Thanks!
A UART converts the signals to RS232 signaling(NOT VOLTAGES, You will need an additional adapter chip like the FTDI 232H) to hook up to a serial port on a computer. Speeds are usually limited to less than 400 Kilobits per second(varies based on distance and devices)
If you are connecting multiple devices to the same micro-controller(Arduino), use SPI. The connection speeds are not limited by standards. It is a bus arrangement with 4 pins (clock SCLK, input MISO, output MOSI and Slave select SS) The SCLK, MISO, MOSI are connected to all devices.To chain additional devices it requires an additional SS pin per device.
SPI is going to be faster(several (<5?)Megabits per second is not uncommon (depends on length(not greater than .3 meters), wire quality, environmental noise and device specifications) and requires less discrete components.
Since LoRa speeds max out around 300kbps, a single SPI connected gateway could theoretically handle 15 LoRa transceivers on a single gateway.
Doing 15 devices may violate local RF duty cycle restrictions resulting in fines and/or imprisonment.
Please check with your regulatory institutions prior to implementation of any solution.
I would suggest using four transceivers with external antennas each pointing in a different cardinal direction(possibly offset) at each gateway. This configuration should permit 400+(depending on usage patterns) client devices per gateway.

USB host/peripheral design

I'm looking to create a device that acts as a host to a USB peripheral, format the data, then send it out to another host (the PC). Are on-the-go chips capable of accomplishing this or would you need to implement both a host USB microcontroller and a peripheral USB controller? I don't see much information out there for creating a middleman that performs data molding for USB prior to reaching a host. Any information would be appreciated, hopefully I didn't butcher this concept.
you should use a microcontroller with 2 USB busses.
One should act as a host, and the other as a slave.
You will need to implement them both.
USB OTG is used to create a host and a slave in 1 device with 1 connector,
so it's impossible to use them together at the same time.

Sending Files Directly through phone lines

As you know we can use our ADSL modems to send/receive data with high bandwidth through our phone line to/from ISP servers. I'm interested to write a program to use this capability of ADSL modem to send/receive files directly between computers (like Hyper Terminal application which was used for 56k serial modems). Is it possible? Also I want to know does it need governmental support or not? :)
Best Regards
While this is definitly possible (at least with the Alcatel ADSL modems), it is not worth the hassle. Some random points - please mind that this is written from a european POV, things might be a little different in the USA.
Carriers are not amused, if you change the configuration of your modem. Some will call it "hacking" and disconnect you.
It is not possible, to use the modem for both (Internet access and file transfer) at the same time.
It won't work between modems on different carrier networks or even in different LM segments of the same carrier - the ADSL signal is terminated at the multiplexer in your carrier's LM switch. It does however work between modems attached to the same multiplexer.
For your problem, the solution ist to use a TCP connection instead of a fake serial - even HyperTerminal can do that AFAIR

Send and receive data simultaneously on Parallel Port

If I understand the parallel port right, sending data from (D0 to D7) simultaneous, but that it can control the sticks individually?
example:
D0 = Input
D1 = Input
D2 = Output
...
...
...
D7 = Input
would it work?
what I want to do is to both send and receive data simultaneously.
Data wires (D0-D7) are being read or set simultaneously. For various tecniques for bidirectional I/O read the attached articles:
Standard parallel port: http://www.beyondlogic.org/spp/parallel.htm
EPP: http://www.beyondlogic.org/epp/epp.htm
ECP: http://www.beyondlogic.org/ecp/ecp.htm
This site is a good source for programming the parallel port.
The basic idea is that you need a DLL, add-on or library that allows you to access the I/O Ports of the PC. For Windows XP on up you need a specific driver that will allow you do this as the OS doesn't offer access out of the box.
The Parallel port will generally reside at one of three address 278,378, 3BC. This port. have the bytes you are reading or writing.
The (base)+1 port allows access to the status bytes. IE. 279,379, 3BD
The (base)+2 port allows access to the control bytes. IE. 27A,37A,3BE
The parallel port documentation will tell not only how to implement the common modes (like bi-directional) but how to control the port at the byte level to implement your own custom.
Back in the day there was only the standard mode available. You pump out your bytes at the (base) port. Some application, like mine, manipulated individual bits of that ports as form of cheap Digital I/O Controller. We did use the status and control bytes as additional inputs and outputs. There were commands you can send to the Parallel Port chip configure the modes precisely.
Today there are are hundreds of sites with example of using the Parallel Port to solve all kinds of problems. I would be surprised that one of doesn't have something you can use for you specific application.
Again the book I recommend starting with is Parallel Port complete. It tells just about everything you need to start with. If your application is too esoteric for that book it will give a springboard from which you can find the exact setup you need.
Of course by sending a number that has just the required bit set (2n) you'd get the expected result.
I'm not sure about bidirectional access though. I guess it's achieved by using control pins along with the data pins but that's just a guess.
Parallel ports doing EPP or ECP only allow D0-D7 to be all input or all output. Trying to do otherwise may fry your hardware.
See http://www.nor-tech.com/solutions/dox/ieee1284_parallel_ports.pdf, page 6.
However, parallel ports have several control lines that may be useful if you only need a small amount of input/output in the "other" direction.
I believe its bit 5 in the port's control register (base address + 2) that switches direction. (no hardware line attached)