SetCommMask() ERROR Invalid argument (22)


#1

I have an application that uses relays to control AC Contactors (coil is 120v) and they seem to work for sometime. After running my sketch with the relays, several times, I get disconnection from the serial port. The following continuous message appear on the command prompt of the serial connection:

SetCommMask() ERROR Invalid argument (22)

If I close the serial command prompt window (containing the serial connection) and run again the Cayenne-ser.bat batch file, it starts working again for sometime and then I get the same error. Have you seen this before? Not sure if it started after one of the Windows updates…


#2

@adam @eptak tagging for this.


#3

Sorry, I have only used the serial connection method a few times. May I ask why you are using it? It’s meant more for testing/debugging than to be a “production” solution.


#4

Hi Adam,

I’m using a Latte Panda board, which is a Windows 10 Home computer with a built-in Arduino Leonardo. The board has Wireless and Ethernet ports, but they “belong” or can be seen by the Windows 10 OS. As far as I know, using the serial connection is the only way to connect to the Cayenne Portal. The Latte Panda has like a “virtual” serial port connection for the built-in Arduino Leonardo. That is the reason I’m using the serial connection.


#5

I guess it really depends on what you’re trying to do and at what level. I don’t have a LattePanda so I’m not quite sure how it works or what sensors/devices you are using and how they are connected. Are you able to get everything you need through the windows 10 OS? If so, you can use a program/script in the Windows 10 OS to send the data using the MQTT API.


#6

Hi Adam,

Just to let you know that it seems I found what was causing the issue. Between reading and contacting the relay supplier, we were able to narrow the problem to induction noise. I bought two induction suppression caps and the SetCommMask() error disappear!


#7

Thanks for posting back!