c - Cannot Wake up Atmel ATSHA204 Using I2C -


i've been given task of writing drivers of i2c devices in our product. complete beginner @ this, i've managed use mixture of i2cset , i2cget along smbus control leds.

my latest task read 7 byte serial number eeprom of atmel atsha204 chip. first job wake chip. data sheet says done follows

the wake condition requires either system processor manually drive sda pin low twlo, or data byte of 0x00 transmitted @ clock rate sufficiently slow sda low minimum period of twlo. when device awake, normal processor i2c hardware and/or software can used device communications , including i/o sequence required put device low-power (sleep) mode.

so seems have manually set 1 of i2c pins low time of twlo apparently @ least 60 microseconds before can use conventional i2c calls. i'm not sure how done, ideally i'd in c, variation of following work?

int file;      file = open("/dev/i2c-0", o_rdwr); if (file < 0) { exit(1); }  int addr = 0x64; // address of led driver  if(ioctl(file, i2c_slave, addr) < 0){  return 1; }  write(file, 0x00, 1); //write 0x00 chip wake 

i guess i'm not sure last bit, how keep writing until device has woken up? i'd appreciate this, low-level programming such new me.

you don't want pass 0x00 write function. param isn't value, it's pointer buffer containing data. need know clock speed i2c running. determine how many bytes of 0x00 need written satisfy required duration wakeup.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -