New answers tagged

3

I initially amended everything to put out a dummy first byte and then just started at the second one. This worked but I was not happy with it. Trawled the internet lots more. Tried many things. No difference. Noticed that compared to the MCU downstream communications, the I2C to PI was very slow. About half the speed. Editing /boot/config.txt and amending: ...


1

I don't know what (if anything) the stuff you used will do. I would just use the Device Tree overlay as documented in /boot/overlays/README dtoverlay=mcp23017 If you NEED to to use a different address add the addr parameter. Don't modprobe ANYTHING - this is obsolete Name: mcp23017 Info: Configures the MCP23017 I2C GPIO expander Load: dtoverlay=...


1

The Arduino and Raspberry Pi commands are substantially different. The Arduino command is sending: start condition data 0x80 to address 0x27 data 75 to address 0x27 end condition The RPi commands are sending. start condition data 0x80 to address 0x27 end condition start condition data 75 to address 0x27 end condition Frankly I'm surprised the device ...


1

You should use wiringPiI2CWriteReg8 instead of the raw wiringPiI2CWrite: dimmer = wiringPiI2CSetup(0x27); wiringPiI2CWriteReg8(dimmer, pin, value); This keeps everything together in one neat interface. TBH I am not sure how it differs internally, but it certainly gives you a cleaner interface.


0

Setting up a software I2C bus is very simple with device tree. For I2C bus 3 using GPIO 5 as SDA and GPIO 6 as SCL add the following entry to /boot/config.txt and then reboot. dtoverlay=i2c-gpio,i2c_gpio_sda=5,i2c_gpio_scl=6,bus=3 A new I2C device with bus number 3 will then appear in /dev. $ ls /dev/i2c* /dev/i2c-1 /dev/i2c-3 $ You may use the same ...


-1

Question Setup (1) I have installed micropython-mpu9250. (2) I have detected the i2c bus using "i2cdetect -y 1". Problem How come my program don't run? Answer (1) What does the command "i2cdetect ..." do? The commend "i2cdetect -y 1" is used to detect if there is any working I2C devices connected to the bus, and display the devices' ...


0

It's preferable that the code listing is in your question and that the error message is cut&pasted into your question. At a guess you should be importing I2C not i2c.


0

The Pi's I2C bus defaults to 100 kbps. It may be changed by the i2c_baudrate setting in /boot/config.txt. Those are the settings used by the Linux driver.


1

I can't find any pull-up resistors for SDA1 and SCL1 on the schematics for the Raspberry Pi 4B. I don't know if this is because they have been removed on the new boards or it is just an omission on the simplified schematics. Maybe including the pull-up resistors on the add-on/HAT boards, although redundant in the RPi 3 and previous models, was a good ...


2

I have found this github that forked the arduino's ads1115 library to be compatible with the raspberry pi.


1

"Connecting directly" in this context is ambiguous. Applications running directly on the Pi, using the I2C bus, would generally use some kind of library interface, such as the various Pi specific (eg. pigpio) or linux specific (I would guess python has something like that) things or the kernel API. Point being, there is no singular "connect to the bus" ...


Top 50 recent answers are included