0
votes

I am trying to get a simple Serial Port connection between dotnet 5 and a Marlin based printer board which is running some variant of a micro controller (LPC1768FBD100 https://www.arrow.com/en/products/lpc1768fbd100551/nxp-semiconductors).

I can open a connection to the board using other tools, send a "M503\n" command and receive a response, the tools I've used successfully are

  • Pronterface (Windows)
  • Arduino Serial Monitor (Windows)
  • miniterm (Linux)
  • putty (Windows)

So I know the board to be functioning correct in both Linux and Windows, but when attempting from .net, I am yet to succeed in getting any response back from the board. I have uploaded a simple tool in .net 5 that connects to a serial port and allows you to TX / RX strings,

https://github.com/devoctomy/SerialPortTester

I have tested this code in Windows and Linux, same port settings, no response back. I have also tested this exact code against a simple echo program running on an Arduino Uno board and it all works as expected, but for the life of me I can't get anything back from the other board.

I'm wondering if there's something about serial comms that these other apps are doing that I just don't know about. I'm using the same port settings which are shown in device manager across the board when testing in Windows, and also the same settings when testing in Linux.

In Linux the board comes up as ttyACM0, which is how my Arduino Uno is also mounted.

Any suggestions? I'm sure this isn't a "Marlin" issue, as only one of the other tools I've tested with is specific for Marlin and the Arduino serial monitor is about as basic as you can get. There's something I'm not doing in the .net code I think...

I've also tried someone elses old .net code and it also doesn't get a response back from this board, but does from my Arduino Uno running the echo program.

https://www.codeproject.com/Articles/23656/Termie-A-Simple-RS232-Terminal

Nick.

Edit:

I'm currently looking to see if it's just .net and the underlying mechanisms that is effected here and have found this page,

https://www.sparxeng.com/blog/software/must-use-net-system-io-ports-serialport

I've modified my tester code to access to base stream for sending / receiving data just in-case, but this has not fixed the issue.

1

1 Answers

0
votes

Okay I got it, I knew I was missing something,

port.DtrEnable = true;

This fixes it and now I'm receiving and sending data to the Marlin board.