Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/06/08 18:43
Read: times


 
#150386 - Detecting Start Condition
Responding to: ???'s previous message
If you intend to do software bit-bang implementation of an I2C slave mode one of the biggest problems is being aware of when the transaction begins and when the transaction is addressed to "me".

The best way to handle this is through use of a hardware supported I2C peripheral which can be set to listen until the start and slave address are present and then generate an interrupt. From there the I2C hardware can be setup to process the transaction state by state to receive/send commands and/or data as appropriate.

If you do not have an I2C hardware then a software polling technique can be used. It is possible to connect the SDA and SCL lines to two port bits and if the SCL is connected to a low edge active interrupt pin one can achieve a low overhead way to detect the beginning of a bus transaction. However when a transaction starts the software has to be giving a good amount of focus to the SW polling function. I have found that a slave mode peripheral is feasible for a MCU to perform in bit-bang polled mode ONLY if the device can really be dedicated to the I2C slave function and perform only the very simplest other functions related to the I2C slave operation.

If the MCU must perform other functions requiring a goodly amount of the processor bandwidth then it is fully necessary to search out an MCU with an I2C peripheral function. Programming a successful implementation of a simple hardware supported slave mode is straightforward but does take a certain amount of MCU expertise. A beginner is likely to be facing a challenge to make a successful implementation, particularly if the slave command set is to include more than a single format I2C command that includes both read, write, repeated starts, and/or veriable length data transfers.

Michael Karas


List of 7 messages in thread
TopicAuthorDate
I2C Slave?            01/01/70 00:00      
   NXP application notes            01/01/70 00:00      
   Do you have I2C hardware?            01/01/70 00:00      
      Detecting Start Condition            01/01/70 00:00      
         bit-banging IIC slaves is a bitch            01/01/70 00:00      
   NXP & bit bang IIC slave            01/01/70 00:00      
      why not bit-banged UART            01/01/70 00:00      

Back to Subject List