We are testing some new hardware that has a camera device at I2C address 0x78 using the i2cdetect, i2cget, and i2cset Linux utilities.
These only allow addressing devices in the 0x03-0x77 range. Have tried using the address range override but the commands will not accept the 0x78 address.
Does anyone know how to override this limitation or know of another Linux command line utility that would provide access to this address?
Thanks,
JBG
Related
I'm in confusion that will an I2C device get detected in raspberry pi even when there
are no device drivers and DTS files related to it.
Will it show up when we use this command
ls /dev/i2c-*
and are we able to detect its address when I try to probe using
i2cdetect -y bus_number
In short:
... when there are no device drivers and DTS files related to it.
Will it show up when we use this command
ls /dev/i2c-*
No. This command will list available I2C buses, not devices.
and are we able to detect its address when I try to probe using
i2cdetect -y bus_number
Maybe. In most cases yes.
A bit more elaborated:
Depending of what kind of I2C device it is, and what you want to do with it, you might still be able to communicate with it.
driver - best case
If you have relevant device tree change to describe this I2C device (on what bus it is located, its address, extra signals if needed - like interrupt pin, etc) and associated driver is present (built-in or as a module, check *_defconfig options in Linux kernel source) - driver should probe device during either boot or manual module loading.
Why best case? If you have a driver you don't have to think about protocols and programming, and, as an example, reading a value from ADC device might be as simple as:
root#pi:~# cat /sys/bus/iio/devices/iio:device0/in_voltage0_raw
291
i2ctools
Another approach would be to use i2cget/i2cset tools from i2ctools package. No device tree changes needed. With these tools you can talk with any unclaimed I2C device on any enabled I2C bus in device tree.
You'll need to implement communication with I2C device by your own. From security and stability perspective - IMO this is the worst case to go, but is good for hardware debugging and, in some cases, initial bring-up.
Example is here.
Note regarding i2cdetect - this command tries to detect devices on particular bus, but gives no warranty. As per man i2cdetect:
As there is no standard I2C detection command, i2cdetect uses arbitrary SMBus commands (namely SMBus quick write and SMBus receive byte) to probe for devices.
I am running a setup of 4 ESP32 which are connected to a PI through serial connections. Is there a way to statically bind all of the ESPs, so the port order after every boot doesn't matter?
It also has to be ID unspecific, since I'm running several similar setups and the code should fit all.
Also, in case of a replacement, I just want the system to know that there is the same device on the same port.
I'm sorry if I wrote it confusing, but generally, I want the ESPs to be replaceable, while the port describes the function of the device.
Thanks guys and happy coding
The only practical approach is ID based, sorry. USB devices are created in the same order they are initialized, so no guarantees whatsoever. If it helps, here's an udev rule which creates symlinks from the serial number of the Silabs USB-serial chip, e.g. /dev/EDK-d80d38b81e. Tested with DevKitC and LOLIN32 boards.
# udev rules for the Espressif ESP32-DevKitC and Wemos LOLIN32 dev boards to
# allocate symlinks with fixed names for each device using its serial number.
# CP2102N/CP2104N with idVendor=10c4, idProduct=ea60
#
# Instructions:
# 1. Copy udev rules and restart daemon:
# $ sudo ln -s "$PWD/70-cp210xn_ESP32-DevKitC.rules" /etc/udev/rules.d/ && sudo systemctl restart udev
# 2. Disconnect and connect the board to USB
# Espressif ESP32-DevKitC with CP2102N.
# Sample serial in chip is "7063b99e4b74ea11b6f52208cf25bb41" where only first
# 10 chars seem to be unique. We cut the serial down to those and create a
# symlink from the result, e.g. "/dev/EDK-7063b99e4b"
SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{manufacturer}=="Silicon Labs", ATTRS{product}=="CP2102N USB to UART Bridge Controller", PROGRAM="/usr/bin/awk -- 'BEGIN { print substr(\"$attr{serial}\",1,10) }'" SYMLINK+="EDK-%c", GROUP="dialout", MODE="0660"
# Wemos LOLIN32 with CP2104N, sample serial in chip is "01DFA32C".
# We create a symlink "EDK-01DFA32C" (cropping to first 10 chars just in case).
SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{manufacturer}=="Silicon Labs", ATTRS{product}=="CP2104 USB to UART Bridge Controller", PROGRAM="/usr/bin/awk -- 'BEGIN { print substr(\"$attr{serial}\",1,10) }'" SYMLINK+="EDK-%c", GROUP="dialout", MODE="0660"
I had a similar issue, where I needed to statically bind physical USB ports to devices, in my case they are cheap serial/USB converters and they don't have a unique ID, so the only way to identify them was using physical port mapping.
I solved creating udev rules with aliases, like this:
SUBSYSTEM=="tty",KERNELS=="2-2:1.0",SYMLINK+="device1"
SUBSYSTEM=="tty",KERNELS=="2-3:1.0",SYMLINK+="device2"
Now I open the connection with the devices using the symlinks. In this way as long as you don't swap connectors, each device will always have the same symlink.
Unfortunately, the Raspberry Pi (don't know about linux in general) is reassigning the USB ports after each boot or when connecting/disconnecting devices. So the serial port numbers change more or less randomly. You need some other way of identifying which device is which. Probably the best method is to use unused pins for identifying the device and query the device id from the host at startup, so you know which ESP32 is connected on which port.
Can I plug a cisco SPA303 ip phone directly into the ethernet port of a raspberry pi running raspbx?
I have got raspbx setup and running using a wifi dongle to connect to the router. The system works with the Cisco phone plugged into the router. However, the router is on the other-side of my house and ideally, as the raspbx is wifi, I would like to plug the phone directly into the pi and have it as one unit I can have anywhere in the house.
I have spent a painful amount of hours trying to set this up and I am sure there is a simple fix I am overlooking. Any ideas would be greatly appreciated.
Yes, you can. But you should setup static ip on phone or setup dhcpd server on RPi
Also some cisco phones have double ports(internal simpler switch inside). If so, you can connect one-by-one upto 8 phones.
There are several layers to take into consideration:
Link layer MDI/MDI-X detection of crossover/patch ethernet cable detection.
Static IP address for Raspberry Pi and a DHCP server for the IP phone
TFTP server to provisionize the IP phone
A peer in asterisk for the IP phone
I bought a new Arduino Ethernet Shield and hooked it to the Arduino Uno.
I am trying to set the IP address of the device to 192.168.1.177 tried File-> Examples -> Ethernet-> Webserver.
When I upload this - I get a "server is a 0.0.0.0'message in serial monitor !
My IP is set to 192.168.1.177 and setup a mac address of 0xB8, 0x27, 0xEB, 0x98, 0x46, 0x61 in the webserver code.
Appreciate any help in setting this IP address. ( I tried other combinations as well )
The Arduino Ethernet shield is mounted on the Arduino Uno, and connections are lined up .
i fix this problem by pressing firmly the shield to the board
This can manifest from many different causes. I ran into this and figured out that in my case, my the USB port + cable were not allowing sufficient power to the Ethernet chip.
I have 3 cables, 6in, 3ft, and 6ft. Only the 6" one had sufficiently low voltage drop to power the shield.
I honestly couldn't believe it, but there was a 0.1V drop between the 6in and the 6ft cables. When plugged into A USB 3.0 port with the Arduino loaded, I measured ~4.5V for the working 6in cable vs ~4.4V for the non-working 6ft cable.
I have 3 types of USB ports: 1.1, 2.0, and 3.0. Only the USB 3.0 ports provided enough power to power the shield. Thus for my case, I had to use the shortest USB cable on the 3.0 port.
When the Arduino's 5V rail was sufficiently sagging, the 3.3 Linear Regulator entered dropout mode and on all the non-working configurations I saw ~3.1V on the Ethernet shield's 3.3V rail, which is apparently sufficient to cause this symptom.
As part of my project requirement I want to make a system which will detect all the WiFi devices in my router range either its connected or not, I did some research on it then I found something like wireshark ,kismate etc I just tried the wireshark by making my Mac machine's WiFi as an adhoc network and its all fine I am able to list all the WiFi devices in wireshark, now I want to make a real-time system based on a real WiFi router I don't know how I will configure my router using my PC and how I will monitor the router from my PC , one more thing if I am using this wireshark how I will use this data for my requirement. If any one worked with similar scenarios please help me..thanks in advance
To do that you will need more than the usual API that you have on commercial WiFi routers (by that I mean a full SSH access). I would:
flash my router with OpenWRT (you can search for your router on this page for detailed instructions)
Install the aircrack-ng suite on the flashed router with
opkg update
opkg install aircrack-ng
Put my WiFi card in monitor mode and run the airodump service:
airmon-ng start wlan0 #Put your NIC in monitor mode
airodump-ng mon0 #Sniff surrounding packets
You don't necessarily have to install aircrack-ng, you can just put your card in monitor mode using command line (look at the documentation for your WiFi driver) and then run tcpdump (command line equivalent to wireshark) but aircrack works very well and has a nice format.
Also, I should warn you that you can brick your router by flashing it. I never had such a problem when flashing router mentioned on the OpenWRT wiki and there are (most of the times) ways to restore a bricked router depending on the brand but I am not responsible if you break it ;)