Not the typical i2c question

andrewpro

New Member
I've read alot of the posts requiring access to a 1 byte i2c device, and how hte i2c in the picaxe was mainly designed for eeproms and that a device that requires the 1 byte will not work.

My question...what if, in the i2cslave command, you use a reserved adddress, like a general call with the lsb set to 1. This is used for slave to master comms, buut since the picaxe is the only master, the slaves should technically ignore this.

If you set the address in i2cslave to all 0's, then use only the read/writei2c command ( dont remember is the lsb is 1 or 0 for read or write, so whichever it is), it should techically end up sending a "start" general call, then you send the address data as the "location" byte, and the one byte of data needed by the device as the "variable" data, would this allow you to read and write from a one byte device?
 

ylp88

Senior Member
If I understand your concept corrently, I'm not sure if that will work. Setting the i2cslave to an address of %00000000 will send a start command followed by 8 low bits. This will be read on the bus a an address of a device of 00h. As soon as devices see this (assuming of course, that the device's address is not 00h), they will "switch off" and not listen to the line data until it "hears" a stop signal.

ylp88
 

andrewpro

New Member
Hmm. My idea was more of use the "start" general call so it would end up with the slave device being 00000001. In esssence, using a readi2c command as a write, after getting everyones attention (though I'm a bit fuzzy on the way general calls work, hence I'm asking). What I was hoping for was that I could get all the chips attention, then write to the ones that only require one byte by using the readi2c command.

But, since I dont quite understand how general calls work exactly (I think I do, but could be wrong) I was asking to see if anyone would know if this would work :(
 

ylp88

Senior Member
Am I missing something? What is this "start general call"? I just assumed that you referred to the data line being clocked high to indicate the start of a data transmission. You seem to use the "start" term in a slightly different manner.

My alternative reading of your question is whether you can use a "universal" address to attact the attention of ALL the devices on the i2c bus. Is this correct?

http://www.esacademy.com/faq/i2c/general/i2cexcep.htm

This is an interesting situation and I havn't tried it before. I think that you may have to use only certain devices on the bus otherwise you may get some odd results. Of course, you can use as many devices which do not support the "general call", becuase they are not affected by this call.

ylp88

Edited by - ylp88 on 4/11/2005 1:24:20 AM
 

ylp88

Senior Member
So, perhps it is possble to communicate with a device which requires *one* byte.

i2cslave %00000000, i2cbyte, i2cfast
^ all devices on i2c lines

readi2c data, dummy_data
^ write the byte "data" to the device

A few problems I see is that either the device:
a) must not support sequential write (like most EEPROM do) because the byte "dummy_data" will be written to the next register
b) has to have read-only registers which will mean that any data written to the device's next register will not actualy be written, rather, effectively be discarded
c) has to support the "general call" statemnt, as not all devices support this command (luckily for us, devices which do not support this command can still reside on the bus becuase they will not resond to the data sent on the line by the "data" byte)
d) devices which do support this command may not all be able to exist on the bus together because they will accept the data and store it in their registers, possible opverwriting data which is required for other purposes (ie. delete old data, overwrite it with the "data" byte and then use that "data" byte to do something when the original deleted byte whould have been used)

Regarless, I think that this may be a possibility to allow the use of *some* *single* byte devices. Perhaps Technical could shed some light on this issue for us.

ylp88
 

andrewpro

New Member
Ok, the confusion on both our parts is all my fault ;)

The page you read is a much better explenation than the one I read. The one I read called the "Start" general call the one that the slave devices made to the master, but it wasn't clear it was to be made AFTER the general call had been made.

Yes, My intention was to "trick" the slaves and the picaxe itself using data that would be generally ignored by just about everyone after the attention call has been made. By using the slave responses, which will be ignored by the slaves, and I'm guessing ignored by the picaxe, I'm postulating it's possible to actually send only one byte of data to a device after it's address has been sent (the picaxe has now sent two bytes instead of just one, as is required).



Edited by - andypro on 4/11/2005 11:17:01 AM

Edited by - andypro on 4/11/2005 11:18:03 AM
 
Top