element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Moto Mods
  • Products
  • Manufacturers
  • Moto Mods
  • More
  • Cancel
Moto Mods
Forum I2C Addresses Doubled
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Moto Mods to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 10 replies
  • Subscribers 59 subscribers
  • Views 1535 views
  • Users 0 members are here
  • mod
  • i2c
  • moto mod
Related

I2C Addresses Doubled

rdecarre11
rdecarre11 over 8 years ago

Good Evening!

Using Make Menuconfig I set the I2C Address to my address (0x98) 0d152. On my shiny new logic analyzer, I see that the address was 0x30, followed by a NAK.

I changed the address to 0x9A, 0d154, and the address is now 0x34 followed by a NAK.

 

Printing the address on the lldbg seems to agree with the defconfig setting, so that is not the issue.

 

Some maths tells me that this means the Address that the MDK is attempting to use is double that of the one I enter... Strange indeed.

0x98 * 2 = 0x130, since the address is a uint_8t that gets trimmed off at 0x30

0x9A * 2 = 0x134, same, trimmed at 0x34.

 

To finish off the test I tried using 0x4C, 0d76, (half of my real address) and on the scope I see Address 0x98 followed by an ACK and data!

 

Success, shrouded in mystery.

 

Furthermore, the data (a register value from my DAC) is sent back twice after calling a single read. Not sure if anybody has ever seen that before but it is a separate issue.

  • Sign in to reply
  • Cancel

Top Replies

  • COMPACT
    COMPACT over 8 years ago in reply to COMPACT +1
    It's already been said - There are two schools of thought for I2C addresses. 1. Treat the 7 bit address field as though it is left padded with a 0 and ignore the R/~W bit. (Range 0x00-0x7F) (As used by…
Parents
  • COMPACT
    COMPACT over 8 years ago

    The PCM5142 is looking for a repeated start condition in the midst of a register access (read) so you'll have to generate one.

    Have a look 8.4.1.1.2.6 Timing Characteristics of the data sheet.

     

    From your pictures you're not generating one.

     

    i.e. a falling edge of SDA followed by a falling edge of SCLK.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • rdecarre11
    rdecarre11 over 8 years ago in reply to COMPACT

    I appreciate the input. The previous screenshot was about the Address, not about the register read. I was trying to keep this one on the topic of the strange Address behavior.

    I double checked the rest of my I2C exchange and I do in fact have the repeated start. See this other forum about why the 5142 is not behaving.

    https://e2e.ti.com/support/data_converters/audio_converters/f/64/t/578178

     

    Just to maintain one problem at a time image :

    I would like to focus on the fact that even when I put 0d76 (0x4c) in the Menuconfig, the stm32 sends a 0x98 as an address. (depicted in the waveform above)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • COMPACT
    COMPACT over 8 years ago in reply to rdecarre11

    What is the behaviour when you use i2c-tools?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • COMPACT
    COMPACT over 8 years ago in reply to COMPACT

    It's already been said - There are two schools of thought for I2C addresses.

     

    1. Treat the 7 bit address field as though it is left padded with a 0 and ignore the R/~W bit. (Range 0x00-0x7F)

    (As used by Linux)

     

    2. Treat the 7 bit address field combined with the R/~W to form an 8 bit address. (The physical byte transmitted).

    (i.e. Range (0x00-0xFF) with even addresses for writes and odd addresses for reads.)

     

    Does this explain your doubling of I2C addresses?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • COMPACT
    COMPACT over 8 years ago in reply to COMPACT

    It's already been said - There are two schools of thought for I2C addresses.

     

    1. Treat the 7 bit address field as though it is left padded with a 0 and ignore the R/~W bit. (Range 0x00-0x7F)

    (As used by Linux)

     

    2. Treat the 7 bit address field combined with the R/~W to form an 8 bit address. (The physical byte transmitted).

    (i.e. Range (0x00-0xFF) with even addresses for writes and odd addresses for reads.)

     

    Does this explain your doubling of I2C addresses?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Children
  • rdecarre11
    rdecarre11 over 8 years ago in reply to COMPACT

    I understand. Not sure why that took so long for me to grasp. image.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • COMPACT
    COMPACT over 8 years ago in reply to rdecarre11

    I'm glad that it helped.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube