Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 08:00 25 Apr 2024 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 : I2C address below 8

Author Message
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 11:26pm 22 Feb 2020
Copy link to clipboard 
Print this post

Hi
In the change log from version 5.04.05
" Relaxed error checking on I2C addresses to allow addresses 7 and below to be used"

simple test code below tested with ver 5.0501 and ver 5.0502

Master (run when slave is running)

Dim a
I2C open 50,200
a=9

main:
I2C write &H8, 0, 1, A


Slave

Dim a
I2C open 50,200

I2C SLAVE OPEN &H8, 0, 0, i2cWR, i2cREC

Main:
Pause 30
If  MM.I2C <> 0 Then Print "I2c" : Print MM.I2C
GoTo Main

i2cWR:
Print "send"
End

i2cRec:
Print "received"
End


With 8 or above as the address the result is as expected.
When the address is changed to 7 or below the slave never responds.

Is this a bug or I have missed something ?

Regards
Jman
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1094
Posted: 11:46pm 24 Feb 2020
Copy link to clipboard 
Print this post

@jman,

I tried an MM to MM linkup via I2C under 5.05.02(similar to the demo code Geoff had in the old 5.02 manual) and it also seemed to not recognise address &H7 but worked fine with &H8.

Looking at the I2C doco on the web, it does appear that addresses under &H8 are reserved anyway so they should probably not be used except for their special, intended purposes.

panky
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9059
Posted: 12:50am 25 Feb 2020
Copy link to clipboard 
Print this post

  Quote  Looking at the I2C doco on the web, it does appear that addresses under &H8 are reserved anyway so they should probably not be used except for their special, intended purposes.


Yes, that is my understanding too.  I2C addresses are not something that you have TOTAL control over.  Most devices have their I2C addresses fixed with an agreement with whoever looks after the I2C spec these days(still Philips/NXP?).  You normally can only select from a few specific addresses within a range for that device.

Take the common EEPROM chips - they are mostly address 1010xxx with the last bit being the R/W bit.

Therefore, addresses can be between 1010000 and 1010111 only.
&h50 - &h57 in HEX.
80 - 87 in Decimal.

Any other address will be ignored with those EEPROM's.
They ARE a very common slave address arrangement though, so perhaps you could just use the EEPROM slave address set?

IE: set the MM slave address as if it was an EEPROM chip - 1010000.
Smoke makes things work. When the smoke gets out, it stops!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5898
Posted: 02:34am 25 Feb 2020
Copy link to clipboard 
Print this post

The AS3935 lightning detector uses address 0 to 3 so they defy the rule.
It is my playing with this chip that prompted Geoff to relax the rule.
The chip isn't much use anyway.

I haven't tried the chip with the recent MMBasic versions.

Jim
VK7JH
MMedit   MMBasic Help
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 08:58am 25 Feb 2020
Copy link to clipboard 
Print this post

Hi

Looks like in Master mode address's below 8 work but not in slave mode.
I have an LCD that allows control via I2C but the LCD is the master so I need to make the Mite the slave with address 2.

I realize that we should not use address's below 8 but I have no choice in this case.
and as the rule is now relaxed I was hopeful :)
Tried this with an Arduino and it works but would really like to use a Mite for the job.

Regards
Jman
 
Print this page


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

© JAQ Software 2024