Serial port communication not working via .net 5 for Marlin board - arduino

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.

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.

Related

ESP32,ESP8266, AND ESP8266 NODE MCU not working

1.I started with esp. 32 i used arduino IDE it only showed COM1 in PORTS. when i was uploading the code i pressed the boot button when connecting..... appears in the window but still an error (timeout....) occurs and code doesn't upload.
i installed the drivers but whenever i plugged in the usb cable a notification pops up that the computer doesn't recognize the device. i installed ch341 but it says the the drivers are preinstalled.
same problem appear with esp8266 node mcu.
Then using the same cable I started working with esp8266 no error popped up it had two options in PORT COM1 and COM4 I choose COM4 and I uploaded the blink code. it worked fine but after that i upload the WIFI SCAN code it started showing same problem as esp32... i disconnected it and connected again error popped up that it doesn't recognized by computer. and furthermore now it only shows com1 in ports option and when I press flash button the code doesn't get uploaded it shows timed out error. i disconnected and connected many times but it doesn't working.
are you setting like this??
this is my setting on the arduino
I mean you can try to install the esp32 USB port library CP210x_Universal_Windows_Driver.exe.
if your system does not detect esp8266 or NodeMCU boards while you installed all possible drivers, as mentioned in this GitHub issue change your USB wire cause the wire maybe is for just charging and not transferring data!
changing it worked for me!

Serial Port not working on Surface Book

I have a Microsoft Surface Book that I've dual booted Linux Mint on. I'm writing a program that needs to read in data from a serial port, but my serial ports don't seem to be working. The behavior is consistent across Mint and Windows (Testing done through Cygwin). It gets a bit of data the first 2-5 seconds that the device is plugged in (viewing the data through screen, same thing happens if I just use pyserial to print data incoming from serial port), then nothing.
What could be happening? I think I've isolated the problem to the serial ports - the Surface Book has 2 USB ports and the same thing happens on both of them, and I've tested the hardware that I'm plugging into it on 2 other computers (One Linux and one Mac OS), and it works fine on both of those.
Your MS Surface, seemingly, has a yellow triangle exclamation mark icon (over the adapter icon) without any driver to install/download. And properties in the device status box window say This device cannot start. (Code 10) or A device which does not exist was specified. Right?
If it's so you should wait for an update from MS. It's notorious problem.
I ended up getting the computer replaced on warranty for an unrelated issue months later, and what do you know, on the new computer the serial ports work fine. That indicates to me some sort of hardware problem, given that the issue persisted across OS's.
maybe this will help:
see Arduino examples for serial port communication - search google:
arduino serial c++
arduino serial c#
arduino serial c++ linux
the point is to open port properly you need to open a file, not a port. not with usual c - assembly write to port code.
another option you are using an unintentionally bought fake USB to serial cable with a Fake PL2303 chip
then you need to install the old version of the driver.
search in google:
Fake PL2303 + your os name:
install driver Fake PL2303 windows 10
another option is maybe it conserves energy and closes the port because it feels it is unused.
in windows> device manager,> properties of a device - usually USB root hub > power management - allow the computer to turn off this device to save power - uncheck it.
https://superuser.com/questions/408683/why-my-usb-mouse-gets-suspended-after-3-seconds-of-inactivity
https://blogs.msdn.microsoft.com/usbcoreblog/2013/11/08/help-after-installing-windows-8-1-my-usb-device-doesnt-charge-or-it-disconnects-and-reconnects-frequently/
also, you could look in windows events - to see what happens. usually, failures like this are registered in the events log.
an unlikely option is it consumes too much current, like a short circuit. and the device protection circuit shuts the chip off. also probably it does not have such circuit. one possibility is to try with an external powered hub.
the most probable of these is the power saving mechanism
I was experiencing the same problem - came across the solution on another site. The USB 3 ports on Surface Book aren't compatible with something or other to do with Com Port but running the device through a cheap USB hub solved my problem straight away and it was instantly recognised by the Arduino IDE

XBee AT communication between PC and Arduino

I need to send data (an integer) from an Arduino to a C program on a PC. I know that the connection is fine, because with X-CTU works perfectly. I need to do this in AT mode but I don't know how to start.
If you're using the XBee modules in AT mode, then it isn't much different than what you'd have to do with a direct serial cable connection between the Arduino and PC. Look for sample programs demonstrating serial communications for both platforms.
Having the connection working with X-CTU is an excellent starting point, since you have confirmed that the radio modules are communicating correctly.
On the PC, you might want to look at this Open Source XBee Host Library on GitHub. It includes a sample program called "xbee_term" that demonstrates a simple serial terminal for using an XBee in AT mode. It also has a layered API to allow for easy use of XBee modules in API mode -- which you would need to use if the PC was going to communicate with multiple Arduino nodes running in AT mode.
As for sending an int, you can use sprintf() to format it as a string to send over the wireless link, and strtol() to convert it back to an int on the PC end.

Arduino com port keeps getting busy

I have got an Arduino Uno R3 on which I have an accelerometer that I'm playing a bit with. This setup has worked for quite a while now, everything working from uploading to checking the serial output.
Today I started having problems with the com port reporting busy or not connected at all. When I use the default IDE it cant find the arduino at all but when I use a modded IDE (Arduino ERW 1.0.5) seems to find the port to communicate on but it reports it being busy.
I have reinstalled the driver like 5 or 6 times now and searched for any other driver that might work but they wont change anything. I have also checked that my pc actually detects the arduino which it does, it is listed among the COM ports on Device Manager. I also tried changing the Com port from COM3 to COM4 and still it worked for like 3 uploads and then the COM port kinda "disappeared" from the serial port list on the IDE.
EDIT: Weirdly, after closing some programs that seem to have to do with serial communication it works. I have to look into what I close and when.
EDIT2: For now it seems that processing sometimes didnt close properly when not using the stop button on the processing application which then didnt close the connection to the arduino. I havent had any problems since I started to use the Stop button on processing.
Win 8.1
Latest driver and IDE(an modded IDE called Arduino ERW 1.0.5 seem to work a bit better but have the same issues)
One thing I noticed is that if I press the reset button when it starts again it wont send anything through serial, is it defaulting to the Blink program after a reset or what?
For those getting the "port busy" error while connecting Arduino and Process, one fix is to close the serial monitor in Arduino.
For anyone who is struggling with this, you have to give again rw rights to ttyACM0
sudo chmod a+rw /dev/ttyACM0
after that I was able to open the serial port.
I found the problem being in Processing itself, on win 8.1 the P3D option for 3D renderer seems to leave the java process open after closure which causes the serial port to be busy even after the main window is closed.
I simply fixed it by using OPENGL instead of P3D which didn't change anything visibly so I'm fine with it.

Arduino programming using USB download fails on Windows 2000

I have a number of Windows 2000 systems that we are trying to use to program the new Arduino Uno and Mega devices. These boards now come with a USB connection, an upgrade from the prior FTDI. I'm not able to download the Arduino code into the board from a Windows 2000 system
The supplied drivers are *.inf files that modify the standard USB driver that comes with Windows (in this case Windows 2000).
I go through the process of setting the port, setting the device and doing the download. The download fails, and the apparent error is that the PC can not communicate with the board. I've checked the port, adjusted the baud rates, etc. I've even moved the port number from a high port number (ie COM12) to a lower port (COM2) without any success. I do see activity on the rec/xmt lights on the Arduino board, so some type of data is being sent and received.
I'm looking for:
Someone who has been able to download files from Windows 2000 to the Arduino
or
A way to shim inside the USB driver to be able to watch the traffic going up and down to the board so I can continue to debug this.
or
Some general tips for things to look at in the .inf file that need to be set/not set to make it work on Windows 2000.
I know the boards work I've used them on a different set of Windows XP systems. So I know to some extent the install is good and that most of what I have works.
Full dumps can be found on the Arduino forum, http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1291090110/.
This is the information produced by the AVRDude program while it's trying to download the code.
this could be a long shot, but I jsut recentlz had problems uploading too. Fist of all, how long is the USB cabele you are uploading from? Mine in one case was too long and th arduino woul lose sync. Secondly, and this might just be a silly oversight (like i did) do you have things wired in the digital pin 0 and 1? These are used for the communication, and if there is anything else plugged in to them the upload will also fail.
As I said, long shot but those were two errors I had.

Resources