I2c Help please
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi,
The Datasheet is not really that descriptive, however is says that it has 10k pull ups, so i am guessing that I can take out the ones i connected to the chip..
cheers
Acestu
The Datasheet is not really that descriptive, however is says that it has 10k pull ups, so i am guessing that I can take out the ones i connected to the chip..
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi,
I took out the resisters but I still get 255, any ideas anybody please ?
cheers
Acestu
I took out the resisters but I still get 255, any ideas anybody please ?
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
-
- Posts: 170
- Joined: Sat Dec 10, 2011 7:21 pm
- Location: Canada
- Has thanked: 20 times
- Been thanked: 52 times
- Contact:
Re: I2c Help please
Looks like all the pullups are on the level shifter.
Edit: Guess I'm too slow on the keyboard!
Edit: Guess I'm too slow on the keyboard!
Last edited by GTF on Sat Dec 28, 2013 8:35 pm, edited 1 time in total.
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: I2c Help please
Have you connected pin 2 of the sensor? If so to what is it connected? Also, do you have a 3.3v supply connected? Are the grounds and voltage supplies of 5v and 3.3v both connected to the level shifter?
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi Kersing,GTF
yes I have a 5v rail and a 3.3v rail, the level shifter has 3.3v + gnd connected with the clock and data lines, and on the high side I have 5v + gnd clock and data, on the sensor there is no pin 2, just 3.3 gnd and the data and clock lines as per pic enclosed...I have also checked my rails and they are fine...
cheers
Acestu
yes I have a 5v rail and a 3.3v rail, the level shifter has 3.3v + gnd connected with the clock and data lines, and on the high side I have 5v + gnd clock and data, on the sensor there is no pin 2, just 3.3 gnd and the data and clock lines as per pic enclosed...I have also checked my rails and they are fine...
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
-
- Posts: 170
- Joined: Sat Dec 10, 2011 7:21 pm
- Location: Canada
- Has thanked: 20 times
- Been thanked: 52 times
- Contact:
Re: I2c Help please
What about the pullups that are on the sensor board? Or are these what you removed?
With no connection/jumper for pin 2 (address select), is it NC to any traces?
Also, it appears you can use the sensor board as is without the level shifter if you have no 5V I2c devices on the bus.
http://learn.adafruit.com/tsl2561/wiring
With no connection/jumper for pin 2 (address select), is it NC to any traces?
Also, it appears you can use the sensor board as is without the level shifter if you have no 5V I2c devices on the bus.
http://learn.adafruit.com/tsl2561/wiring
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi,
I have 2 push buttons now, one for powering up the sensor and one to power it down, both print the results on screen, I also read the register first before anything and print the results in the middle of the lcd, however everything has the value 255, I am enclosing the new chart........
thanks
Acestu
I have 2 push buttons now, one for powering up the sensor and one to power it down, both print the results on screen, I also read the register first before anything and print the results in the middle of the lcd, however everything has the value 255, I am enclosing the new chart........
thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi GTF,
I am working off the Datasheet for the TSL2561, however the sensor that I have is the one pictured above from Adafruit and there is no proper datasheet for it, it looks like the TSL2561 is the sensor in the middle of the board, so I am trying to find out now what the address pin is connected to etc......
cheers
Acestu
EDIT: it may be worth just trying the other 2 addresses and seeing what happens, or I could connect it to a i2c address scanner !
I am working off the Datasheet for the TSL2561, however the sensor that I have is the one pictured above from Adafruit and there is no proper datasheet for it, it looks like the TSL2561 is the sensor in the middle of the board, so I am trying to find out now what the address pin is connected to etc......
cheers
Acestu
EDIT: it may be worth just trying the other 2 addresses and seeing what happens, or I could connect it to a i2c address scanner !
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi GTF,
That is the wrong board on your link, this is the sensor:
http://www.adafruit.com/products/1246
cheers
Acestu
That is the wrong board on your link, this is the sensor:
http://www.adafruit.com/products/1246
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi,
I have just taken the sensor off and connected it to an i2c line scanner, it says that it is present on 39 as per pic,
cheers
Acestu
I have just taken the sensor off and connected it to an i2c line scanner, it says that it is present on 39 as per pic,
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi,
I have just ordered a 5 volt i2c compass, I think there is a problem with the level shifter somewhere and I don't think the i2c communication is working, I will post again when the item arrives, thanks everybody for all your help so far ...........
cheers
Acestu
EDIT: I have come to this conclusion because when connected to an arduino without a level shifter and run the demo program, the sensor works fine..
I have just ordered a 5 volt i2c compass, I think there is a problem with the level shifter somewhere and I don't think the i2c communication is working, I will post again when the item arrives, thanks everybody for all your help so far ...........
cheers
Acestu
EDIT: I have come to this conclusion because when connected to an arduino without a level shifter and run the demo program, the sensor works fine..
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
-
- Posts: 170
- Joined: Sat Dec 10, 2011 7:21 pm
- Location: Canada
- Has thanked: 20 times
- Been thanked: 52 times
- Contact:
Re: I2c Help please
They are the same the same other than the fixed address on the one you have.acestu wrote:Hi GTF,
That is the wrong board on your link, this is the sensor:
http://www.adafruit.com/products/1246
cheers
Acestu
Then pin 2 is NC.acestu wrote:Hi,
I have just taken the sensor off and connected it to an i2c line scanner, it says that it is present on 39 as per pic,
cheers
Acestu
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi GTF,
Yes according to the Datasheet the addresses are 29h , 39h and 49h 39h when address pin is floating, but I have been trying all sorts all day to get it going, that's why I am going to wait till I get the other sensor in the post now........
Cheers for your help
Acestu
Yes according to the Datasheet the addresses are 29h , 39h and 49h 39h when address pin is floating, but I have been trying all sorts all day to get it going, that's why I am going to wait till I get the other sensor in the post now........
Cheers for your help
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
-
- Posts: 170
- Joined: Sat Dec 10, 2011 7:21 pm
- Location: Canada
- Has thanked: 20 times
- Been thanked: 52 times
- Contact:
Re: I2c Help please
I think we also have not had the chart quite right yet. Take a look at the I2C component help in V5 for a little more information.
- Attachments
-
- TSL2561_MK3b.fcfx
- (16.31 KiB) Downloaded 168 times
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi,
I have been having another mess today and I think you are right, the chart wasn't right, here is my updated chart, I have programmed the chip but it is very erratic when pushing the switches I get values of 255, 0, 51, and eventually I get 3, so something is still a miss......
cheers
Acestu
I have been having another mess today and I think you are right, the chart wasn't right, here is my updated chart, I have programmed the chip but it is very erratic when pushing the switches I get values of 255, 0, 51, and eventually I get 3, so something is still a miss......
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi Grant,
So sorry, my head was spinning yesterday and I missed that post, however I have just downloaded your chart and loaded it, OMG you have cracked it, occasionally I get the value 51 could this be due to pull ups ?
cheers
Acestu
So sorry, my head was spinning yesterday and I missed that post, however I have just downloaded your chart and loaded it, OMG you have cracked it, occasionally I get the value 51 could this be due to pull ups ?
cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi Grant,
Could the 51 message mean that you are sending a Write ON message to a register that is already ON ?
Because that seems to be the logic of how the buttons are working, ie if you press on then off, then on then off all is well but if you press on then on again you get the 51....
cheers
Stuart
Could the 51 message mean that you are sending a Write ON message to a register that is already ON ?
Because that seems to be the logic of how the buttons are working, ie if you press on then off, then on then off all is well but if you press on then on again you get the 51....
cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
-
- Posts: 170
- Joined: Sat Dec 10, 2011 7:21 pm
- Location: Canada
- Has thanked: 20 times
- Been thanked: 52 times
- Contact:
Re: I2c Help please
Hmm....... It appears that after 2 successive ON commands you are reading back 0011<<4|0011 (3<<4|3)
Which is 51 decimal. 4 bits are being written to the Control register on each write, pushing whatever is in there left 4 bits.
Does the attached code work to ensure that the upper 4 bits of the Control register are cleared before 03h is written?
Edit: updated attached chart
Which is 51 decimal. 4 bits are being written to the Control register on each write, pushing whatever is in there left 4 bits.
Does the attached code work to ensure that the upper 4 bits of the Control register are cleared before 03h is written?
Edit: updated attached chart
- Attachments
-
- TSL2561_MK3d.fcfx
- (16.45 KiB) Downloaded 166 times
Last edited by GTF on Sun Dec 29, 2013 11:02 pm, edited 1 time in total.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi GTF,
That seems to of cured things, it's working perfectly now thanks, can I just ask you though, how do yo get 80 for the control register when its address is 0x0 ?
thanks
Stuart
That seems to of cured things, it's working perfectly now thanks, can I just ask you though, how do yo get 80 for the control register when its address is 0x0 ?
thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
-
- Posts: 170
- Joined: Sat Dec 10, 2011 7:21 pm
- Location: Canada
- Has thanked: 20 times
- Been thanked: 52 times
- Contact:
Re: I2c Help please
0x80 = 10000000 Which is written to the Command register. The command byte must always start with "1" according to the datasheet. The next 3 bits are set according to the options in the datasheet. The lower 4 bits are the address of the register you want to write to in the following byte. In the case of the Control register the address is 0000.acestu wrote:Hi GTF,
That seems to of cured things, it's working perfectly now thanks, can I just ask you though, how do yo get 80 for the control register when its address is 0x0 ?
thanks
Stuart
I have edited and re-posted the last chart. I removed an extra Command byte (0x80) that may not be necessary. Not sure which version you tested?
Grant
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi GTF,
That's great thanks, I did try the first chart before your edit but I will try the second one now and let you know.....
cheers
Stuart
That's great thanks, I did try the first chart before your edit but I will try the second one now and let you know.....
cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi Grant,
The edited chart works fine also thanks...in the next few days I hope to expand on this project now and maybe get a lux value on the screen, thanks for all your help again.........
cheers
Stuart
The edited chart works fine also thanks...in the next few days I hope to expand on this project now and maybe get a lux value on the screen, thanks for all your help again.........
![Very Happy :D](./images/smilies/icon_biggrin.gif)
cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
- acestu
- Posts: 1720
- Joined: Thu Dec 01, 2011 9:36 pm
- Location: Macclesfield UK
- Has thanked: 783 times
- Been thanked: 223 times
- Contact:
Re: I2c Help please
Hi Grant,
If you don't mind I am going to update the chart with explanation remarks so that others can understand it...
cheers
Stuart
If you don't mind I am going to update the chart with explanation remarks so that others can understand it...
cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.
Computers are like air conditioners. They work fine until you start opening windows.
-
- Posts: 170
- Joined: Sat Dec 10, 2011 7:21 pm
- Location: Canada
- Has thanked: 20 times
- Been thanked: 52 times
- Contact:
Re: I2c Help please
Good to hear you have communication! What is the readback value from the OFF macro after an ON>OFF cycle?