Hello,
OS: Torizon 5.0
Module: Colibri iMX6DL 512MB
I am trying to access the UART on the module using .NET Core and its System.IO.Ports Library.
I had added “RUN usermod -a -G dialout torizon” to buildcommands and “/dev/ttymxc0” to devices in the Torizon Container Configuration.
I am getting the following error:
Unhandled exception. System.UnauthorizedAccessException: Access to the port '/dev/ttymxc0' is denied.
---> System.IO.IOException: Unknown error 203
--- End of inner exception stack trace ---
at System.IO.Ports.SafeSerialDeviceHandle.Open(String portName)
at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
at System.IO.Ports.SerialPort.Open()
Code:
using System;
using System.Threading;
using System.IO.Ports;
namespace UART_Test
{
class Program
{
static void Main(string[] args)
{
SerialPort serialPort;
serialPort = new SerialPort();
serialPort.PortName = "/dev/ttymxc0";
serialPort.BaudRate = 115200;
serialPort.Open();
while (true) {
serialPort.WriteLine("Hello, World!");
Thread.Sleep(1000);
}
}
}
}
Am I missing some step in the configuration?
If I try to directly access the UART using stty and echoing text to the device, it works.
Hope you can help.