2

I have written a windows app for my project which facilitates serial communication with a microcontroller using a virtual COM port. This has been pretty straightforward - the chip manufacturer (atmel) provides usb drivers (not even necessary for Windows 10, only lower versions) and accessing the port is some basic code.

However I wanted it to work on other systems, mainly osx, too. I just found out about mono, ran my app through the mono migration analyzer and to my delight, apart from a couple invokes the app is relatively good to go (only a couple issues I think I can resolve).

There are 2 big issues that remain:

  1. How can I access mac com ports using mono? According to this it is not easy.
  2. Even if I can get the right serial port, how do I communicate with it? Atmel only provides windows drivers, so I'm afraid that won't work at all.

I have asked a similar question regarding the second issue on avr forum and a helpful user replied with this:

Might be as simple as linking the macOS's USB device file system "somehow" into Mono's run-time.

which I must shamefully say I'm not sure what it means and if is at all achievable by me - with my limited programming knowledge and basically no experience with osx. So I'm afraid solutions like Class Compliance are far out of my reach.

Thanks in advance!

Avalyah
  • 81
  • 1
  • 3
  • What have you tried so far? (Specifically, have you tried the answer alluded to if you scroll down a bit in your linked thread to [this](https://stackoverflow.com/a/6679152/1586231)?) Good luck, and welcome to Stack Overflow! – Max von Hippel Aug 16 '18 at 23:17
  • 1
    Well I'll be... I managed to somehow port my app to at least run at all on a friend's macbook Air (although it took me much longer than anticipated even though monoanalyzer told me my app is 100% ready to go) and it seems that I'm able to list all the ports using the basic SerialPort.GetPortNames() (and there are many!) one of which appears to be my device - though why it's called usbmodem1421 I have no idea. Still, after connecting to it using the name it seems to be working without any drivers! Now I need to find out how to identify the proper com port, preferably by VID/PID. – Avalyah Aug 18 '18 at 21:41

1 Answers1

0

To answer my own questions:

  1. I managed to access the ports using SerialPort.GetPortNames() - there are many of them (lists a couple dozen), however it does work and the port with my device connected had a differentiating name. Still there are a couple kinks to work out, mainly identifying if the port is really active (it stays listed even after I shut down my device without unplugging the USB cable), but using the name to connect to serial port works.
  2. The communication with my xmega mcu requires no drivers, works out of the box.
Avalyah
  • 81
  • 1
  • 3