I2CRead & I2CWrite not working as expected


Closed Thread
Results 1 to 31 of 31

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    good luck to find it in french... unless you want to try GooGLE or else on-line translator that will'nt be better
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Feb 2013
    Posts
    1,163


    Did you find this post helpful? Yes | No

    Default Re: I2CRead & I2CWrite not working as expected

    Code:
    SDA var PORTA.1
    SCL var PORTA.2 
    T1 var byte
    T1=15
    I2CAddress var word 'I2C address
    I2CDevice var byte 'I2C device add
    i2CDevice=$A0
    I2CAddress=8
    I2CWrite SDA,SCL,I2CDevice,I2CAddress,127
    pause 100
    i2cread SDA,SCL,I2CDevice,I2CAddress,T1
    LCDOUT $FE,$c0, "value ", dEC T1
    pause 1000 
    stop
    Ports are set to digital, analog and comparators turned off. 4.7K resistors in place, 24C32 chip is brand new and authentic.
    Only VDD/VSS and SDA/SCL pins are used, others are left floating, according to datasheet.
    The interesting thing is, that i2cread returns nothing - I mean, I added T1=15 just for test, so that 15 is displayed, instead of 127
    whole i2croutine doing nothing?

  3. #3
    Join Date
    Jan 2005
    Location
    France
    Posts
    97


    Did you find this post helpful? Yes | No

    Default Re: I2CRead & I2CWrite not working as expected

    hello
    start a TEST first to see if your I2C unit is OK
    let go here
    https://playground.arduino.cc/Main/I2cScanner/

    francois

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,721


    Did you find this post helpful? Yes | No

    Default Re: I2CRead & I2CWrite not working as expected

    Only VDD/VSS and SDA/SCL pins are used, others are left floating, according to datasheet.
    start a TEST first to see if your I2C unit is OK
    let go here
    or read the data sheet again and work out the consequences of floating address pins on the device address
    Warning I'm not a teacher

  5. #5
    Join Date
    Feb 2013
    Posts
    1,163


    Did you find this post helpful? Yes | No

    Default Re: I2CRead & I2CWrite not working as expected

    From the datasheet:


    DEVICE/PAGE ADDRESSES (A2, A1, A0): The A2, A1 and A0 pins are device address
    inputs that are hard wired or left not connected for hardware compatibility with
    AT24C16. When the pins are hardwired, as many as eight 32K/64K devices may be
    addressed on a single bus system (device addressing is discussed in detail under the
    Device Addressing section). When the pins are not hardwired, the default A2, A1, and A0
    are zero.
    WRITE PROTECT (WP): The write protect input, when tied to GND, allows normal write
    operations. When WP is tied high to VCC, all write operations to the upper quandrant
    (8/16K bits) of memory are inhibited. If left unconnected, WP is internally pulled down to
    GND.


    The A2, A1, and A0 pins use an internal proprietary circuit that biases them
    to a logic low condition if the pins are allowed to float.

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,721


    Did you find this post helpful? Yes | No

    Default Re: I2CRead & I2CWrite not working as expected

    to my surprise i found the 24c32 on my ds3231 module did not behave as expected when the resistor block [circled] was removed
    to conserve energy for a battery device
    Name:  Screenshot 2021-10-08 164704.jpg
Views: 16761
Size:  60.7 KB

    the address was still 0xAE, contrary to the datasheet , so i looked at a data sheet from another manufacturer, where for a 24c32n
    they did not describe this address pin biased low behavior for their version

    to ensure 0xA0 the pins needed to be grounded

    so how sure are you that the datasheet matches the chip?
    its an easy test
    Warning I'm not a teacher

  7. #7
    Join Date
    Feb 2013
    Posts
    1,163


    Did you find this post helpful? Yes | No

    Default Re: I2CRead & I2CWrite not working as expected

    I will try grounding. I will also hook up scope to see what happens.
    I do have pull up resistors in place for SDA/SCL pins.
    Regarding how I know about datasheet?
    I bought this IC from digikey, and downloaded datasheet from the SKU page
    This is genuine atmega part.

Similar Threads

  1. I2cwrite - I2cread
    By savnik in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 5th July 2006, 01:12
  2. Problem with I2Cread and I2CWRITE function
    By Tony85 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th June 2006, 20:03
  3. Problem with I2Cread and I2CWRITE function
    By Tony85 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th June 2006, 18:32
  4. PFC8583 Connection and I2Cwrite I2cread!
    By uludere72 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 27th February 2006, 13:32
  5. I2CWRITE and I2CREAD
    By Tomas in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd April 2004, 02:30

Members who have read this thread : 3

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts