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.

Michiel

Member Since 14 Feb 2011
Offline Last Active Apr 09 2016 08:44 PM
-----

#65038 [N3] Serial loopback: second byte missing

Posted by Michiel on 26 March 2016 - 11:06 PM

Hi all,

 

I'm doing some tests with my Netduino 3's UART ports, and I've come across something weird.

 

When doing a loopback on any serial port, the second byte that was written to the port, is missing from the bytes read back from that same (or other, doesn't matter) port.

 

Simplified code snippet:

namespace NetduinoApplication4
{
    public class Program
    {
        public static void Main()
        {
            var sp = new SerialPort(SerialPorts.COM1, 2400, Parity.None, 8, StopBits.One);
            sp.Open();

            var writeBuffer = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05 };
            var readBuffer = new byte[writeBuffer.Length];

            while (true)
            {
                sp.Write(writeBuffer, 0, writeBuffer.Length);
                sp.Flush();

                var read = sp.Read(readBuffer, 0, readBuffer.Length);

                Debug.Print("Read: " + readBuffer[0] + " " + readBuffer[1] + " " + readBuffer[2] + " " + readBuffer[3] + " " + readBuffer[4]);

                Thread.Sleep(1000);
            }
        }
    }
}

Output:

Read: 1 3 4 5 0
Read: 1 3 4 5 0
Read: 1 3 4 5 0

Of course, I'm expecting those lines to read "1 2 3 4 5". Also, the variable "read" is set to 4, instead of the expected 5.

 

I can reproduce this on every COM port and with different array sizes.

 

Netduino deploy tool output:

HalSystemInfo.halVersion:               4.3.1.0
HalSystemInfo.halVendorInfo:            Netduino 3 (v4.3.2.2) by Secret Labs LLC
HalSystemInfo.oemCode:                  34
HalSystemInfo.modelCode:                177
HalSystemInfo.skuCode:                  4103
HalSystemInfo.moduleSerialNumber:       00000000000000000000000000000000
HalSystemInfo.systemSerialNumber:       0000000000000000
ClrInfo.clrVersion:                     4.3.1.0
ClrInfo.clrVendorInfo:                  Netduino 3 (v4.3.2.2) by Secret Labs LLC
ClrInfo.targetFrameworkVersion:         4.3.1.0
SolutionReleaseInfo.solutionVersion:    4.3.2.2
SolutionReleaseInfo.solutionVendorInfo: Netduino 3 (v4.3.2.2) by Secret Labs LLC
SoftwareVersion.BuildDate:              Jul 14 2015
SoftwareVersion.CompilerVersion:        410894

Am I doing something wrong, or is this a bug?  :o




#61202 [Library] NXP Semiconductors MFRC522 Mifare RFID reader/writer

Posted by Michiel on 09 January 2015 - 10:22 PM

Hi everyone,
 
I wanted to share with you a small library I've written to interface with the MFRC522.
 
I needed an RFID reader for a project and, rather uninformedly, ordered a kit with this IC from eBay, similar to this one.
Turns out it wasn't as straightforward as: swipe a tag and some data comes out ;-)
Fortunately, the datasheet is pretty good, and after a lot of reading and googling the ISO14443 standard, I sort of understood how it worked.

Anyway, the library can be found here. It should work properly with the Mifare Classic 1K tags.
It lets you detect tags, select them, read their UID and read and write blocks on the tag.

I hope someone finds it useful!

Michiel


#57754 [Library] Nordic Semiconductor nRF8001 Bluetooth LE

Posted by Michiel on 25 April 2014 - 11:21 AM

Hi everyone,

 

For a little project I'm doing I needed a way to do Bluetooth LE with my Netduino Plus, and I found the nRF8001 by Nordic.

Turns out it's a nice chip with good documentation (as most Nordic stuff tends to have).

However, I found out there wasn't a .NET library written for it yet!

 

So I decided to write one and put it on GitHub for everyone to use, because I can't imagine other people aren't interested in using this great BLE device.

 

It may be a little premature, seeing how most functionality isn't implemented yet, but I'm expanding this library every time I need more functionality from the nRF8001. For now at least, it is possible to get the device initialized and connect to a peer device.

 

I hope someone can make good use of it!

 

Link: https://github.com/m...s/nrf8001-netmf

 




#12196 Socket.Connect(); crashes netduino

Posted by Michiel on 18 April 2011 - 08:39 AM

Connect() doesn't throw an exception when it times out, it just continues executing the rest of the code.


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.