Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 17:44 02 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : I2CPort

     Page 2 of 2    
Author Message
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 09:03am 20 Mar 2018
Copy link to clipboard 
Print this post

And a bit more I have a SD1306 lcd and an INA219 on the I2C pins

This works as expected

I2C open 100,100
Dim d(5)

For I = 8 To &H77
I2C Read I, 1, 1, d()
If MM.I2C = 0 Then Print "Address is ";"&H";Hex$(I):F=1
Pause 5
Next I

If F=0 Then Print "No I2C device found"

Result

Address is &H3C
Address is &H40

This does not work


Dim d(5)

For I = 8 To &H77
r = I2CPort(2, 18, 17, I, 1, d())
If r = 1 Then Print "Address is ";"&H";Hex$(I):F=1
Pause 5
Next I

If F=0 Then Print "No I2C device found"


Result
No I2C device found

So not sure whats going here

Regards
Jman

Edited by jman 2018-03-21
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 01:38pm 20 Mar 2018
Copy link to clipboard 
Print this post

Give me a day or two. I am setting up a test jig to try and discover what is happening.
Geoff Graham - http://geoffg.net
 
GoodToGo!

Senior Member

Joined: 23/04/2017
Location: Australia
Posts: 188
Posted: 02:02pm 20 Mar 2018
Copy link to clipboard 
Print this post

  Geoffg said   Give me a day or two. I am setting up a test jig to try and discover what is happening.


Would you like me to send you an INA219 module to play with?

Cheers,

GTG!
...... Don't worry mate, it'll be GoodToGo!
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 06:10pm 20 Mar 2018
Copy link to clipboard 
Print this post



Thanks Geoffg

Regards
Jman
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 10:13pm 20 Mar 2018
Copy link to clipboard 
Print this post

This is very strange. Watching this thread with interest.
Smoke makes things work. When the smoke gets out, it stops!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 06:03am 21 Mar 2018
Copy link to clipboard 
Print this post

OK, this is embarrassing. Somewhere along the line the speed of the I2CPort CFunction got set at 100Hz instead of 100KHz. I don't know when it happened - perhaps it has been that way since the start.

Anyway, below is the correct CFunction running at 100KHz. I'm hoping that this explains why the INA219 did not respond correctly. I have tested this on other I2C devices and it works with them.

Thanks for the offer GoodToGo. I might take you up on that if we still have trouble.

Geoff

CFunction I2CPort(INTEGER,INTEGER,INTEGER,INTEGER,INTEGER,INTEGER) INTEGER
00000125 40024800 00442021 40024800 0044102B 1440FFFD 00000000 03E00008
00000000 27BDFFD8 AFBF0024 AFB30020 AFB2001C AFB10018 AFB00014 00808821
00A09821 00C09021 3C109D00 8E02001C 0040F809 2405FFFE 8E02001C 02602021
0040F809 2405FFFE 02402021 0411FFE5 00000000 8E02001C 02202021 0040F809
2405FFFD 02402021 0411FFDE 00000000 8E02001C 02602021 0040F809 2405FFFD
02402021 0411FFD7 00000000 8FBF0024 8FB30020 8FB2001C 8FB10018 8FB00014
03E00008 27BD0028 27BDFFD8 AFBF0024 AFB30020 AFB2001C AFB10018 AFB00014
00808821 00A09021 00C09821 3C109D00 8E02001C 00A02021 0040F809 2405FFFD
8E02001C 02202021 0040F809 2405FFFD 02602021 0411FFBB 00000000 8E02001C
02402021 0040F809 2405FFFE 02602021 0411FFB4 00000000 8E02001C 02202021
0040F809 2405FFFE 02602021 0411FFAD 00000000 8FBF0024 8FB30020 8FB2001C
8FB10018 8FB00014 03E00008 27BD0028 27BDFFD8 AFBF0024 AFB30020 AFB2001C
AFB10018 AFB00014 00A08821 00C09821 8FA20038 10400007 00E09021 3C029D00
8C42001C 0040F809 2405FFFE 10000006 2664FFF4 3C029D00 8C42001C 0040F809
2405FFFD 2664FFF4 0411FF8E 00000000 3C029D00 8C42001C 02202021 0040F809
2405FFFE 00001021 40824800 10000005 3C109D00 40024800 0052102A 1040000E
8FBF0024 8E020020 0040F809 02202021 1040FFF8 02602021 0411FF7A 00000000
3C029D00 8C42001C 02202021 0040F809 2405FFFD 8FBF0024 8FB30020 8FB2001C
8FB10018 8FB00014 03E00008 27BD0028 27BDFFD8 AFBF0024 AFB40020 AFB3001C
AFB20018 AFB10014 AFB00010 0080A021 00A08821 00C09821 00E09021 3C109D00
8E02001C 0040F809 2405FFFE 0411FF5D 2664FFF2 8E02001C 02202021 0040F809
2405FFFE 0411FF57 2664FFF8 00001021 40824800 10000006 8E020020 40024800
0052102A 50400011 00008021 8E020020 0040F809 02202021 1040FFF8 00000000
3C129D00 8E420020 0040F809 02802021 00408021 8E42001C 02202021 0040F809
2405FFFD 10000002 02001021 02001021 8FBF0024 8FB40020 8FB3001C 8FB20018
8FB10014 8FB00010 03E00008 27BD0028 27BDFFC8 AFBF0034 AFB60030 AFB5002C
AFB40028 AFB30024 AFB20020 AFB1001C AFB00018 00809021 00A09821 00C0A021
00E0A821 8FB10048 00008021 24160008 32220080 AFA20010 02402021 02602821
02803021 02A03821 0411FF79 00000000 26100001 1616FFF6 00118840 02402021
02602821 02803021 02A03821 0411FFA8 00000000 2C420001 8FBF0034 8FB60030
8FB5002C 8FB40028 8FB30024 8FB20020 8FB1001C 8FB00018 03E00008 27BD0038
27BDFFC8 AFBF0034 AFB60030 AFB5002C AFB40028 AFB30024 AFB20020 AFB1001C
AFB00018 00809021 00A09821 00C0A021 00E0A821 00008021 00008821 24160008
00108040 02402021 02602821 02803021 02A03821 0411FF86 00000000 26310001
1636FFF7 02028025 8FA20048 2C420001 AFA20010 02402021 02602821 02803021
02A03821 0411FF42 00000000 02001021 8FBF0034 8FB60030 8FB5002C 8FB40028
8FB30024 8FB20020 8FB1001C 8FB00018 03E00008 27BD0038 27BDFFB0 AFBF004C
AFBE0048 AFB70044 AFB60040 AFB5003C AFB40038 AFB30034 AFB20030 AFB1002C
AFB00028 0080A021 00A08021 00C08821 00E0B821 8FB20064 3C029D00 8C420000
8C530000 8FA20060 8C550000 3C0201C9 3442C380 0262102B 00002021 14400097
00002821 8E040000 3C029D00 8C420088 00041880 00621021 8C430000 24020002
10620005 3C029D00 8C420010 24050002 0040F809 2406000E 8E240000 3C029D00
8C420088 00041880 00621021 8C430000 24020002 10620005 3C029D00 8C420010
24050002 0040F809 2406000E 3C02001E 34428480 0262001B 004001F4 00009812
00131080 0053F021 27DEFFE7 001319C0 00621023 00539821 00131080 02629821
00131080 02629821 00139900 2673FFE7 AFB30018 02A0B021 3C139D00 8E62001C
8E040000 0040F809 24050005 8E62001C 8E240000 0040F809 24050005 8E820000
24030001 1443002A 00002021 03C0A821 8E040000 8E250000 03C03021 0411FE89
00000000 8FB40018 8E040000 8E250000 8EE20000 00021040 AFA20010 03C03021
02803821 0411FF42 00000000 00002021 00002821 1440000C 2413FFFF 10000048
00801021 8E250000 8E420000 AFA20010 02A03021 02803821 0411FF35 00000000
1040003C 26520008 26D6FFFF 16D3FFF5 8E040000 8E250000 03C03021 0411FE92
00000000 24040001 10000034 00002821 24030002 14430031 00002821 AFBE001C
8E040000 8E250000 03C03021 0411FE5D 00000000 8FA20018 AFA20020 8E040000
8E250000 8EE20000 00021040 34420001 AFA20010 03C03021 8FA70018 0411FF14
00000000 00002021 1040001C 00002821 12A00010 26B3FFFF 2414FFFF 8E040000
8E250000 0013102B AFA20010 8FA6001C 8FA70020 0411FF32 00000000 AE420000
000217C3 AE420004 2673FFFF 1674FFF3 26520008 8E040000 8E250000 03C03021
0411FE61 00000000 24040001 10000003 00002821 00002021 00002821 00801021
00A01821 8FBF004C 8FBE0048 8FB70044 8FB60040 8FB5003C 8FB40038 8FB30034
8FB20030 8FB1002C 8FB00028 03E00008 27BD0050
End CFunction

Geoff Graham - http://geoffg.net
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 09:01am 21 Mar 2018
Copy link to clipboard 
Print this post


Thanks Geoff it works spot on now.

Regards
Jman
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 09:41pm 21 Mar 2018
Copy link to clipboard 
Print this post

Now THAT'S a bug I expected to have been discovered before now....

I guess no-one was really using the Cfunction I2C port that much. I have used the Cfunction serial on many occasions(just to immediately send, really), and that has been working just fine. I never got around to playing with the Cfunction I2C port though. I'm surprised that no-one else did before Jman did!
Smoke makes things work. When the smoke gets out, it stops!
 
GoodToGo!

Senior Member

Joined: 23/04/2017
Location: Australia
Posts: 188
Posted: 03:22am 22 Mar 2018
Copy link to clipboard 
Print this post

Top stuff Geoff! Works a treat.



GTG!

...... Don't worry mate, it'll be GoodToGo!
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025