Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

I2C Software Workaround for Plus 2


  • Please log in to reply
30 replies to this topic

#21 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 19 December 2012 - 11:30 AM

I tried the software I2C and was able to read the device (granted only every 3rd read was a success but that may just be the code) but id still like to figure out whats up with the hardware I2C implementation.

Ryan


Have you double checked the Firmware version on the ND+2 using MFDeploy to ensure you have the latest version 4.2.1.2?

#22 rgoode214

rgoode214

    Member

  • Members
  • PipPip
  • 18 posts
  • LocationSan Antonio, TX

Posted 19 December 2012 - 04:57 PM

I downgraded back to 4.2.1.1 and then upgraded back to 4.2.1.2 as well as reinstalled the framework and the SDK to be sure it wasnt an issue there. Its either a problem with the board or more likely its a compatibility issue with the sparkfun edition of the ds1307. I noticed you said you had the adafruit (which is the one i have on the way) which has 2.2k resistors in the circuits on SDA and SCL. The sparkfun edition is wired directly to the pins on the ds1307 chip. Heres the device capabilities of my N+2: HalSystemInfo.halVersion: 4.2.0.0 HalSystemInfo.halVendorInfo: Netduino Plus 2 (v4.2.1.2) by Secret Labs LLC HalSystemInfo.oemCode: 34 HalSystemInfo.modelCode: 177 HalSystemInfo.skuCode: 4102 HalSystemInfo.moduleSerialNumber: 00000000000000000000000000000000 HalSystemInfo.systemSerialNumber: 0000000000000000 ClrInfo.clrVersion: 4.2.0.0 ClrInfo.clrVendorInfo: Netduino Plus 2 (v4.2.1.2) by Secret Labs LLC ClrInfo.targetFrameworkVersion: 4.2.0.0 SolutionReleaseInfo.solutionVersion: 4.2.1.2 SolutionReleaseInfo.solutionVendorInfo: Netduino Plus 2 (v4.2.1.2) by Secret Labs LLC SoftwareVersion.BuildDate: Dec 3 2012 SoftwareVersion.CompilerVersion: 410894 FloatingPoint: True SourceLevelDebugging: True ThreadCreateEx: True LCD.Width: 0 LCD.Height: 0 LCD.BitsPerPixel: 0 AppDomains: True ExceptionFilters: True IncrementalDeployment: True SoftReboot: True Profiling: False ProfilingAllocations: False ProfilingCalls: False IsUnknown: False

#23 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 19 December 2012 - 05:37 PM

I downgraded back to 4.2.1.1 and then upgraded back to 4.2.1.2 as well as reinstalled the framework and the SDK to be sure it wasnt an issue there. Its either a problem with the board or more likely its a compatibility issue with the sparkfun edition of the ds1307. I noticed you said you had the adafruit (which is the one i have on the way) which has 2.2k resistors in the circuits on SDA and SCL. The sparkfun edition is wired directly to the pins on the ds1307 chip.

Heres the device capabilities of my N+2:
HalSystemInfo.halVersion: 4.2.0.0
HalSystemInfo.halVendorInfo: Netduino Plus 2 (v4.2.1.2) by Secret Labs LLC
HalSystemInfo.oemCode: 34
HalSystemInfo.modelCode: 177
HalSystemInfo.skuCode: 4102
HalSystemInfo.moduleSerialNumber: 00000000000000000000000000000000
HalSystemInfo.systemSerialNumber: 0000000000000000
ClrInfo.clrVersion: 4.2.0.0
ClrInfo.clrVendorInfo: Netduino Plus 2 (v4.2.1.2) by Secret Labs LLC
ClrInfo.targetFrameworkVersion: 4.2.0.0
SolutionReleaseInfo.solutionVersion: 4.2.1.2
SolutionReleaseInfo.solutionVendorInfo: Netduino Plus 2 (v4.2.1.2) by Secret Labs LLC
SoftwareVersion.BuildDate: Dec 3 2012
SoftwareVersion.CompilerVersion: 410894
FloatingPoint: True
SourceLevelDebugging: True
ThreadCreateEx: True
LCD.Width: 0
LCD.Height: 0
LCD.BitsPerPixel: 0
AppDomains: True
ExceptionFilters: True
IncrementalDeployment: True
SoftReboot: True
Profiling: False
ProfilingAllocations: False
ProfilingCalls: False
IsUnknown: False


I didn't realize it didn't have Resistors. You definitely need pullup resistors for I2C devices. If you just add two 2K pull up resistors it should fix the issue.

#24 rgoode214

rgoode214

    Member

  • Members
  • PipPip
  • 18 posts
  • LocationSan Antonio, TX

Posted 19 December 2012 - 05:44 PM

is that true evenw hen not using the square wave function? In reading around on this chip it is mentioned a few times thats the only time you need it (or when theres multiple devices on the bus)? If thats indeed the case i feel stupid... haha Ryan

#25 JerseyTechGuy

JerseyTechGuy

    Advanced Member

  • Members
  • PipPipPip
  • 870 posts

Posted 19 December 2012 - 06:39 PM

The DS1307 Chip documentation says that SDA is open drain and requires the pullup and that SCL should also use a pullup. Sparkfun should have included them. It's definitely not the first I2C breakout from Sparkfun that was badly designed.

http://datasheets.ma...n/ds/DS1307.pdf

#26 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 20 December 2012 - 01:26 AM

Hi Ryan,

Its either a hardware issue or a voltage issue. When i measure the voltage on the SD or SC lines when powered from the arduino its 4.97V and on the netduino its returning 0.1v

What value are you using for your external resistors? And what voltage are they pulled up to?

IF I2C is initialized but not in use, it should register as the voltage of your pull-up resistors (since it will be in high-z mode).

Chris

#27 rgoode214

rgoode214

    Member

  • Members
  • PipPip
  • 18 posts
  • LocationSan Antonio, TX

Posted 25 December 2012 - 10:08 AM

Just an update, i got it working with the pullups in place (opted to use the adafruit model as it has them onboard). so my apologies for the reports of a remaining i2c bug; its working fine for me on 4.2.1.2 =) Ryan

#28 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 25 December 2012 - 10:18 AM

Just an update, i got it working with the pullups in place (opted to use the adafruit model as it has them onboard). so my apologies for the reports of a remaining i2c bug; its working fine for me on 4.2.1.2 =)

No worries :) I'm happy that it's working for you.

Happy holidays,

Chris

#29 iced98lx

iced98lx

    Advanced Member

  • Members
  • PipPipPip
  • 134 posts
  • LocationSouth Dakota

Posted 28 December 2012 - 04:58 PM

Ryan - are you using http://www.adafruit.com/products/815 ? I'm looking to control 15 PWM channels with my Netduino Plus 2



#30 rgoode214

rgoode214

    Member

  • Members
  • PipPip
  • 18 posts
  • LocationSan Antonio, TX

Posted 05 January 2013 - 07:18 AM

Sorry, ive been busy and havent had a chance to get back on here. Im actually using an RTC (the ds1307). One thing i did notice was that when using the SD/SC pins, the analog 4/5 do not work for I2C

 

Ryan



#31 k0fei

k0fei

    Member

  • Members
  • PipPip
  • 10 posts

Posted 31 December 2013 - 11:02 PM

There is a bug in the SoftwareI2CBus module.  Where it calls SoftwareI2C receive, the first parameter needs to be false if it is receiving the last byte of data from a slave.  I2C protocol says the master must send a NAK to the slave on the last byte of data from the slave to tell it that is all the data it is expecting.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.