-
1. Re: I2C Scan
George.Riggall_1541811 Aug 21, 2016 4:58 AM (in response to George.Riggall_1541811)Ok so..
I believe my answer lies in the I2CMasterSendStart function. I had experimented with it before but I'm getting more sensible results now.Still, if anyone has a good solution to this I'm listening!
-
2. Re: I2C Scan
bob.marlowe Aug 21, 2016 6:07 AM (in response to George.Riggall_1541811)George, give the attached project a try. Use PuTTY @9600bd to display the results. Project probably needs selection of your PSoC chip, this is for a PSoC4-M.
Happy coding
Bob
-
I2CScan.cyprj_.Archive01.zip 25.2 K
-
-
3. Re: I2C Scan
George.Riggall_1541811 Aug 21, 2016 8:25 AM (in response to bob.marlowe)Hi Bob, thanks!
I changed the I2C and UART components as they were not compatible with my device, I left all as default apart from I2C changed to Multi-Master-Slave. I'm using a different UART terminal (Termite @ 115.2 kbps) but that shouldn't matter, right?
The code runs as expected until is reaches address 8. At this point the programs hangs at I2C_I2CMasterSendStart. I added a few debugging lines to see what was going on, here's the output:
[0C]Scanning I2C Addresses...
Sending Start (Address: 0)
Stop sentSending Start (Address: 1)
Stop sent...
Sending Start (Address: 7)
Stop sentSending Start (Address: 8)
I've tried slave addresses 0x10 and 0x14 but no difference. The I2C bus should work, hardware wise, as I've had other I2C test programs running just fine, it's just two pioneer kits linked together with 4k7 pullups on SDA & SCL.
Any thoughts?
-
4. Re: I2C Scan
bob.marlowe Aug 21, 2016 9:54 AM (in response to George.Riggall_1541811)Address 8 "smells" like a PSoC slave's default address.
Where does the program exactly stop? compile the project with optimization set to "None" and when it hangs, press the halt button and see where in I2C.c it waits for whatever.
Bob
-
5. Re: I2C Scan
George.Riggall_1541811 Aug 21, 2016 10:58 AM (in response to bob.marlowe)I2C_I2C_Master.c
Line 337
while(!I2C_CHECK_INTR_MASTER(I2C_INTR_MASTER_I2C_ACK | ......Something weird going on.. It all looked clear with the logic analyser but I'll check with the scope.
Using the code I've been playing with, which is essentially the same, the results are the same. If I start the scan at address 9 it works great.
Something about address 8 then. Hey I've got it. that's module's own flippin' address! I forgot to add the "ignore your own address, dummy" line.
Thanks Bob!
-
6. Re: I2C Scan
George.Riggall_1541811 Aug 21, 2016 11:09 AM (in response to George.Riggall_1541811)This highlighted that I2CSlaveSetAddress function wasn't working.
For anyone reading this and having issues with this function, ensure it is called after I2C_Start.
-
7. Re: I2C Scan
user_44074550 Aug 22, 2016 1:50 AM (in response to George.Riggall_1541811)Hi,
I have now tested the Bob's I2CScan and for DS1307 on the CY8CKIT-042 .... it works as expected.
The 7 bit right justified DS1307 address is scanned as 0x68 which is OK.
Viktor
-
8. Re: I2C Scan
kgrider_2306876 May 7, 2017 7:57 PM (in response to George.Riggall_1541811)I am at my wit's end. I have been slaving away trying to get this Pioneer BLE board to talk to this SI7021 sensor. I stumbled across this i2c scanner and thought that my problems would be solved (or at least I would move forward). I run this code and get nothing. The address is supposed to be 0x40. This code runs and never returns anything. The serial port works as it says 'Scanning I2C Addresses". I am connected to the pins labeled 3v3 and ground and SDA on the chip is connected to P3.4 and SCL is connected to P3.5 (for the i2c bus). When I put this sensor on a teensy 3.0 and run the ADAfruit code, I get temperature and humidity. Works like a champ. Connect it to a Pioneer board and nothing. I have tried using the i2cmasterWrite/ReadByte commands to be similar to the arduino wire.write (in a different project) and I cannot get it to talk. That is why I ended up here. I get no response. Can you point out what I am doing wrong? This bus scan code does not 'see' the sensor. (when I put this sensor on the board and load the BLE beacon code, it reports temp and humidity via bluetooth just like a beacon, so I feel it must be code and not hardware)
-
I2CScan.cyprj_.Archive01_2.zip 624.1 K
-
-
9. Re: I2C Scan
bob.marlowe May 8, 2017 2:56 AM (in response to George.Riggall_1541811)Did you configure your Pioneer kit to run at 3.3V using the jumper at J16?
Bob
-
10. Re: I2C Scan
kgrider_2306876 May 10, 2017 5:29 PM (in response to George.Riggall_1541811)Bob,
Yes, the jumper is set at 3v3. I was able to finally get i2cmasterreadbuff working to read my sensor (Si7021) in the project I was working on. If I run this code on my CY8KIT-042-BLE, I get nothing.