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 3 Serial Port Loopback Test

Serial Port Netduno 3 COM2 DataReceived

  • Please log in to reply
1 reply to this topic

#1 Hawkez

Hawkez

    New Member

  • Members
  • Pip
  • 7 posts

Posted 03 August 2015 - 06:06 PM

Hello,

 

In a topic on Netduino Plus 2 I said I would run a simple test on the Netduino 3 COM2 SerialPort and post the results: http://forums.netdui...data-corruption

 

I've attached the very simple serial port loop-back program that I used to test COM2 on the Netduino 3 and Netduino Plus 2.  It has two byte arrays.  One has data in it and the other is created with the same size as the first.   I transmit the data from array 1 over the serial port and receive the data on the same serial port.  The received data is placed in the second array.  After all the data is sent the two arrays are compared.  The test passes (slow .5Hz blink of user LED) when the data is equal.  The test fails (fast 2Hz blink) if the data is not equal.

 

The test uses Request to Send flow control.

 

To set up the test I jumper D7 and D8 (COM2 RTS and CTS) together and D2 and D3 (COM2 RX and TX).  I also put an LED between GND and D13 to know when data is being received.

 

The results are a bit complex.

Running the test on a Netduino Plus 2:

In debug with an SD card in the slot the test passes.

Not in debug with an SD card in the slot the test fails.

Not in debug without an SD card in the slot the test passes.

 

When the test is run on a Netduino 3 data stops being received and the test never completes no matter if it run in debug with or without an SD card in the slot.

 

Thank you!

 

Hawkez

 

Attached File  SimpleSerialPortLoopbackTest.zip   111.47KB   19 downloads



#2 NameOfTheDragon

NameOfTheDragon

    Advanced Member

  • Members
  • PipPipPip
  • 112 posts
  • LocationCanterbury, Kent, UK

Posted 03 August 2015 - 10:58 PM

I tried your code on my ND+2 and I couldn't get it to pass under any circumstances, with or without an SD card in the slot. Fails every time. I'm runnin gthe firmware with Netduino.IP in it, maybe that makes a difference?

 

I also wrote a similar program of my own, which send the test all in one go at the beginning and then waits for it all to be received back. I can get that to pass about 3 times out of 4 with 1,000 bytes of data - but on the times it doesn't work it completely deadlocks. I think what's happening is that RTS/CTS is getting 'stuck' - I captured it happening on my logic analyzer, here's the screen shot:

Attached File  CTS-RTS-Deadlock.PNG   20.66KB   6 downloads

 

I'm guessing the UART may not have an internal buffer (FIFO) because it is pulsing CTS on every character, strangest flow control I've ever seen.

 

I think it is probably important to do as little as possible inside the DataReceived event. The more time spent in there, particularly at higher baud rates, the more risk there is of some sort of overrun happening. At 115200 baud you've only got about 10 microseconds per byte, which isn't long on these little processors.

 

Regards,

TIm Long







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.