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

Netduino Plus 2 problems (InterruptPort & I2C)


Best Answer CW2, 20 December 2012 - 03:12 PM

2) I am writing data to an EEPROM using i2c. After writing some data, I read the data again for verification purposes.

Usually, the write operation takes a few milliseconds, you have to wait until it finishes - please refer to the device datasheet, search for 'Write cycle time' or similar. Alternatively, you can use 'Acknowledge polling', if the device supports it. Go to the full post


  • Please log in to reply
7 replies to this topic

#1 MartinK

MartinK

    New Member

  • Members
  • Pip
  • 3 posts

Posted 20 December 2012 - 02:55 PM

Hi, I am using the Netduino Plus in my application before and I just tried switching to the Netduino Plus 2. I have encountered two problems so far: 1) When I try to create instances of the InterruptPorts, the debug session crashes and I have to reflash the netduino to redeploy the binaries. The code that crashs the board is one of the following lines: new InterruptPort(Pins.GPIO_PIN_D4, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth) new InterruptPort(Pins.GPIO_PIN_D5, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth) new InterruptPort(Pins.GPIO_PIN_D6, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth) new InterruptPort(Pins.GPIO_PIN_D7, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth) new InterruptPort(Pins.GPIO_PIN_D8, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth) new InterruptPort(Pins.GPIO_PIN_D9, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth) new InterruptPort(Pins.GPIO_PIN_D10, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth) new InterruptPort(Pins.GPIO_PIN_D11, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth) I will try narrowing it down as soon as I have the time. Did something change with the ports that I should be aware of? 2) I am writing data to an EEPROM using i2c. After writing some data, I read the data again for verification purposes. On the netduino plus 2 the read data does not match the written data when the code is running. When I set a breakpoint between the writing and the reading, the data verification succeeds, which leads me to believe that some arbitrary delay between the writing and reading operation is needed now. Do you have any pointers on the reliability of the i2c communication? fyi: both problems do not exist on the Netduino Plus 1. Thank you, Martin [Edit: grammar]

#2 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 20 December 2012 - 03:12 PM   Best Answer

2) I am writing data to an EEPROM using i2c. After writing some data, I read the data again for verification purposes.

Usually, the write operation takes a few milliseconds, you have to wait until it finishes - please refer to the device datasheet, search for 'Write cycle time' or similar. Alternatively, you can use 'Acknowledge polling', if the device supports it.

#3 tim c

tim c

    Advanced Member

  • Members
  • PipPipPip
  • 31 posts

Posted 20 December 2012 - 03:57 PM


Do you have any pointers on the reliability of the i2c communication?

[Edit: grammar]


Please make sure you have the latest firmware: http://forums.netdui...-v421-update-2/

From what I understand it fixes a lot of I²C issues.

Tim

#4 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 20 December 2012 - 04:55 PM

'Acknowledge polling'


hello. how would i do that ?

greetings

#5 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 20 December 2012 - 07:13 PM

hello. how would i do that ?

I have not verified it using .NET MF, but it is described for example in 24xx256 (and compatible) memory datasheet (.pdf), page 10:

Since the device will not acknowledge during a write cycle, this can be used to determine when the cycle is complete...This involves the master sending a Start condition, followed by the control byte for a Write command (R/W = 0). If the device is still busy with the write cycle, then no ACK will be returned.

So, after issuing a write command, any subsequent write transaction should return zero, until the write cycle is complete.

#6 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 20 December 2012 - 10:06 PM

thank you, ill try that tomorrow

#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 25 December 2012 - 01:42 AM

Hi Martin,

The code that crashs the board is one of the following lines:
new InterruptPort(Pins.GPIO_PIN_D4, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth)
...

Also, if upgrading an application for Netduino Plus to Netduino Plus 2...be sure to swap out the SecretLabs.NETMF.Hardware.NetduinoPlus.dll for SecretLabs.NETMF.Hardware.Netduino.dll. Otherwise the Pins enumeration will point to the wrong pins and you could experience exceptions or debugger lockouts.

We're working on an update to the SDK which automatically takes care of that for you, but in the meantime that's the standard procedure for switching boards in NETMF.

Chris

#8 MartinK

MartinK

    New Member

  • Members
  • Pip
  • 3 posts

Posted 12 February 2013 - 10:05 AM

Thanks CW2, you were spot on! :-)

 

The netduino plus 2 is  faster than the old one and so I never noticed that I ignored the max write cycle time - it just wasn't able to poll the eeprom fast enough.

 

Thanks Chris, this could have been the problem - in the meantime I updated to the newest release so I am not absolutely sure if swapping the reference or updating to the newest firmware solved my problems.

 

Anyway, both problems are fixed - thanks for the support!

 

Take care,

Martin






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.