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.

366cobra's Content

There have been 8 items by 366cobra (Search limited from 26-April 23)


By content type

See this member's

Sort by                Order  

#61088 I2C issue with multiple sensors

Posted by 366cobra on 28 December 2014 - 05:00 AM in Netduino Plus 2 (and Netduino Plus 1)

just to close things off, the solution was to use the right resistor values.

 

did not know about having to use certain ohms depending on the capacitance of the bus.

When I was using one device, I had the right resistance and it worked.

using two devices, the capacitance changed, but the resistance stayed the same, which did not let the bus function properly.

the more devices you have, the less resistance you need.

 

Hope this will help someone who got stuck like i did ;)




#60898 uNFC - NFC library

Posted by 366cobra on 07 December 2014 - 10:37 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi Paolo,

 

Thanks for doing the hard yards.

 

I have got the following NFC board http://www.aliexpres...2038722238.html

Have configured it to use I2C, but not having any luck communicating with it.

Using 2.2KOhm pull up resistors and have tried both 3.3V and 5V.

 

The Execute in I2CWrite fails with write = 0

 

Any idea on what it could be?

PN532 is a specific chip from one company only, right?

 

I have an I2c lux meter and that works fine.

NP2

FW 4.3.1




#60505 I2C issue with multiple sensors

Posted by 366cobra on 22 October 2014 - 12:40 PM in Netduino Plus 2 (and Netduino Plus 1)

Have you looked at this for multiple devices on the I2C bus?
http://forums.netdui...e-i2cbus-class/

Thanks for the reply and sorry for the late response.

I am using something similar to the second post in the link.




#60383 I2C issue with multiple sensors

Posted by 366cobra on 10 October 2014 - 02:15 PM in Netduino Plus 2 (and Netduino Plus 1)

do you have the 2 devices on the same I2C address, thats the first thing you have to tackle.

Thanks for the reply.

 

the PH sensor has addr 0x4D and the Lux sensor has 0x23

the thing i do not understand is that even though the second sensor is not even initialized, the reading of the first one fails.

the app is setup to only read the Lux sensor and by just adding the second hardware to the bus, reading of the firs one fails.




#60375 I2C issue with multiple sensors

Posted by 366cobra on 09 October 2014 - 11:23 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi,

 

If I use one device, all is good.

If I connect a second one, without even communicating with it, I cannot get any more readings.

 

My base class creates only one I2CDevice and for a read, the configuration is assigned and then the "Execute" is called inside a lock of the device.

Have found a post of someone using a similar technique: http://forums.netdui...bus/#entry41552

Only difference I have, is that I create the array inside the function and throw an exception in case of an error.

 

I have no idea where I am going wrong.

Would be great, if someone has an idea or comment.

 

Thanks

Martin

 

Netduino Plus 2, firmware 4.3.1

I2C Lux sensor

I2C PH meter

 




#59830 FileStream Write blocks multi threaded app

Posted by 366cobra on 21 August 2014 - 11:03 AM in Netduino Plus 2 (and Netduino Plus 1)

Not a nice workaround, but It seems all good now.




#59795 FileStream Write blocks multi threaded app

Posted by 366cobra on 20 August 2014 - 12:19 PM in Netduino Plus 2 (and Netduino Plus 1)

have changed

m_oWriteFile.Flush();

to

VolumeInfo.GetVolumes()[0].FlushAll();

and the app has been running at least twice as long as before.

will see if it still runs after hours.




#59794 FileStream Write blocks multi threaded app

Posted by 366cobra on 20 August 2014 - 11:18 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi,

 

I have updated my NP2 to 4.3.1 about 3 weeks ago and also upgraded my app to .NET 4.3.

Now I am noticing that the file write seems to kill the whole app.

 

The app is multi threaded, reading different sensors, which write the data to a file.

i am using the file as a buffer, as the network may be cut, but the app should not miss any readings.

 

The write is inside a lock, so the threads will not be able to use the same file obj at the same time.

I open the file once in a singleton obj and use it to write and flush the data to file.

Since there is a lot of data going into the file, I do not want to open, wite, flush and close it all the time.

The app can log dozens of readings per sec.

 

Below is the line where the file gets opened and below that how the data get written to the file.

The last log that is printed is "WriteToFile lock" and after that the whole app just dies.

All thread seem to get blocked.

I would expect multiple "WriteToFile begin" lines, until all thread are stuck at the "WriteToFile begin"

e.g.

 

WriteToFile begin

WriteToFile lock

WriteToFile begin

WriteToFile begin

WriteToFile begin

WriteToFile begin

m_oWriteFile = new FileStream(m_sLogFileName, FileMode.OpenOrCreate, FileAccess.Write);
   protected void WriteToFile(byte[] a_sData)
   {
      Debug.Print("WriteToFile begin");
      lock (m_oFileLock)
      {
         Debug.Print("WriteToFile lock");
         try
         {
            if (m_oWriteFile != null)
            {
               m_oWriteFile.Write(a_sData, 0, a_sData.Length);
               m_oWriteFile.Flush();
            }
         }
         catch (Exception ex)
         {
            Debug.Print("EXCEPTION: CSdCard:WriteToFile - " + (ex.InnerException == null ? ex.Message : ex.InnerException.Message));
         }
      }
      Debug.Print("WriteToFile end");
   }

With an older firmware version the code above worked fine.

Has anyone got an idea what this could be?

Bug in 4.3.1?

 





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.