title: Cannot Wake up Atmel ATSHA204 Using I2C
body: <p>I've recently been given the task of writing drivers for some of the I2C devices in our product. I was a complete beginner at this, but I've managed to use a mixture of <code>i2cset</code> and <code>i2cget</code> along with <code>smbus</code> to control some LEDs. </p>
  
  <p>My latest task is to read a 7 byte serial number from the EEPROM of an <a href="http://www.atmel.com/Images/Atmel-8740-CryptoAuth-ATSHA204-Datasheet.pdf" rel="nofollow noreferrer">Atmel ATSHA204</a> chip. My first job is to wake up the chip. The data sheet says this is done as follows</p>
  
  <blockquote>
    <p>The Wake condition requires either that the system processor manually drive 
        the SDA pin low for tWLO, or that a data byte of 0x00 is transmitted at a 
        clock rate sufficiently slow that SDA is low for a minimum period of tWLO.
        When the device is awake, the normal processor I2C hardware and/or software
        can be used for device communications up to and including the I/O sequence
    required to put the device back into low-power (sleep) mode.</p>
  </blockquote>
  
  <p>So it seems I have to manually set one of the I2C pins low for a time of tWLO which is apparently at least 60 microseconds before I can use conventional I2C calls. I'm really not sure how this is done, Ideally I'd do this in <code>C</code>, so would some variation of the following work?</p>
  
  <pre><code>int file;     
  file = open("/dev/i2c-0", O_RDWR);
  if (file &lt; 0)
  {
      exit(1);
  }
  
  int addr = 0x64; // Address of LED driver
  
  if (ioctl(file, I2C_SLAVE, addr) &lt; 0)
  {
      return 1;
  }
  
  write(file, 0x00, 1); // write a 0x00 to the chip to wake it up
  </code></pre>
  
  <p>I guess I'm not sure about the last bit, how do I keep writing until the device has woken up? I'd appreciate any help with this, as low-level programming such as this is new to me.</p>