Go to advanced search

by krisss
Wed Feb 27, 2019 5:59 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: [SOLVED] I2C clock error when repeatedly using read_byte
Replies: 1
Views: 804

Re: I2C clock error when repeatedly using read_byte

If anyone cares, I've found what seems to be the answer to what's wrong: http://www.advamation.com/knowhow/raspberrypi/rpi-i2c-bug.html The Broadcomm processor has a glitchy I2C module that can't handle clock stretching apparently. I've implemented a workaround by splitting my data into nybbles and ...
by krisss
Fri Feb 22, 2019 1:40 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: [SOLVED] I2C clock error when repeatedly using read_byte
Replies: 1
Views: 804

[SOLVED] I2C clock error when repeatedly using read_byte

I made a python program that reads the I2C bus and I've encountered a problem that arises when using smbus.read_byte repeatedly. It uses the smbus library. I've found that the clock HIGH signal on the first data bit of the third byte (sensb_val_low) is too short, causing the bit to always be read as...
by krisss
Mon Aug 27, 2018 8:30 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Troubleshooting quick2wire for i2c communication
Replies: 11
Views: 2344

Re: Troubleshooting quick2wire for i2c communication

joan wrote:
Mon Aug 27, 2018 5:15 pm
The following command (executed once) will start the daemon at boot.


sudo systemctl enable pigpiod
This seems to be working. Thanks a lot!
by krisss
Mon Aug 27, 2018 4:37 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Troubleshooting quick2wire for i2c communication
Replies: 11
Views: 2344

Re: Troubleshooting quick2wire for i2c communication

That works! I am now able to read from the chip. Thank you a lot. One small problem, though: the program is supposed to run at startup but without turning on the gpio demon first in the console, it won't run. Is there a way to do this from my program?
by krisss
Fri Aug 24, 2018 8:53 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Troubleshooting quick2wire for i2c communication
Replies: 11
Views: 2344

Re: Troubleshooting quick2wire for i2c communication

Wow! Thanks for your dedication. That code only works after I start the pigpio daemon in the console but after that it prints 'bytearray(b'\x1d\xf4eL')' once followed by 'bytearray(b']\xf4eM')' once per second ad infinitum.
by krisss
Fri Aug 24, 2018 7:36 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Troubleshooting quick2wire for i2c communication
Replies: 11
Views: 2344

Re: Troubleshooting quick2wire for i2c communication

That returned the following: 4 26 128 101 200 I'm curious to see if the last 4 bytes are good data. I assume the '4' is meaningless? How would I get quick2wire to default to the correct bus? EDIT: Running the last 4 bytes through a conversion program, it seems to be actual data, but slightly inaccur...
by krisss
Fri Aug 24, 2018 7:08 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Troubleshooting quick2wire for i2c communication
Replies: 11
Views: 2344

Troubleshooting quick2wire for i2c communication

I'm using a raspberry pi zero to communicate with a Chipcap 2 temp/humidity sensor via i2c. I've followed users' advice to use quick2wire for i2c communication: https://github.com/quick2wire/quick2wire-python-api/blob/master/doc/getting-started-with-i2c.md I believe it installed properly. Just in ca...
by krisss
Fri Aug 24, 2018 5:47 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: 'bus.read_i2c_block_data' writes a 0 first then reads data
Replies: 17
Views: 5474

Re: 'bus.read_i2c_block_data' writes a 0 first then reads data

That's what I figured. Is there a way for me to edit the smbus code? I searched on my Pi but couldn't find anything.

EDIT: Thanks everyone, I'm going to take your advice and abandon smbus and use quick2wire. I'll start a new thread as well.
by krisss
Thu Aug 23, 2018 6:08 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: 'bus.read_i2c_block_data' writes a 0 first then reads data
Replies: 17
Views: 5474

Re: 'bus.read_i2c_block_data' writes a 0 first then reads data

Thanks for finding that. It's very similar to my own code. Unfortunately I tried it and it spits out the same numbers as before. The code again reads 32 bytes from the device, all garbage.
by krisss
Thu Aug 23, 2018 3:21 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: 'bus.read_i2c_block_data' writes a 0 first then reads data
Replies: 17
Views: 5474

Re: 'bus.read_i2c_block_data' writes a 0 first then reads data

I think this is a really simple problem: I just need to read four bytes using a repeated start condition. Can I do that with smbus or is there a python library that can do this? I'm sure I'm not the first person with this problem.
by krisss
Wed Aug 22, 2018 7:46 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: 'bus.read_i2c_block_data' writes a 0 first then reads data
Replies: 17
Views: 5474

Re: 'bus.read_i2c_block_data' writes a 0 first then reads data

stevend wrote:
Wed Aug 22, 2018 7:30 pm
If I've found the right reference, your line should be:

Code: Select all

block = bus.read_i2c_block_data(sens_addr,  4) #read 4 bytes
This causes it to read 32 bytes now. I don't have it connected to the scope anymore but I'm getting the same nonsense numbers indicating it's writing a 0 first.
by krisss
Wed Aug 22, 2018 6:49 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: 'bus.read_i2c_block_data' writes a 0 first then reads data
Replies: 17
Views: 5474

'bus.read_i2c_block_data' writes a 0 first then reads data

I've been frustrated with my efforts to read a temp/humidity sensor, so I connected my board to a scope and read the data being transferred. When I use the command read_i2c_block_data(addr, 0, 4), I noticed that the raspberry pi first writes a '0' to the device, then immediately reads 4 bytes in suc...
by krisss
Mon Aug 06, 2018 5:39 pm
Forum: Python
Topic: Opening the matchbox keyboard from tkinter GUI
Replies: 0
Views: 592

Opening the matchbox keyboard from tkinter GUI

I'm using a touch screen and I'd like to open the matchbox keyboard when an entry box is tapped in my GUI. Something like below: freq_entry = Entry(root, textvariable=entrytext) freq_entry.bind("<1>", numpad_open) where the function numpad_open opens the keyboard. So what would numpad_open...

Go to advanced search