Skip to main content
Home
for DLMS smart meters

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. Problem With Linux-arm64 Build On Raspberry PI

Problem with linux-arm64 build on Raspberry PI

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

Profile picture for user hivesoft
By hivesoft, 26 June, 2022
Forums
Gurux.Terminal

Hi guys,
i tried to compile this console application with core 3.1 - but i also tried with net6.0 - for linux-arm64 and run it on a Raspberry PI:

GXTerminal TerminalMedia = new GXTerminal
{
PhoneNumber = "xxxxxxx", //hide the right telephone number
PortName = "/dev/ttyUSB0",
BaudRate = 9600,
DataBits = 8,
Parity = System.IO.Ports.Parity.None,
StopBits = System.IO.Ports.StopBits.One,

ConnectionWaitTime = 60000,
CommandWaitTime = 5000,
HangsUpDelay = 2000,
ReadTimeout = 10000,
WriteTimeout = 10000,
Trace = System.Diagnostics.TraceLevel.Verbose
};

TerminalMedia.OnClientConnected += Cl_OnClientConnected;
TerminalMedia.OnClientDisconnected += Cl_OnClientDisconnected;
TerminalMedia.OnError += Cl_OnError;
TerminalMedia.OnMediaStateChange += Cl_OnMediaStateChange;
TerminalMedia.OnReceived += Cl_OnReceived;
TerminalMedia.OnTrace += Cl_OnTrace;

try
{
TerminalMedia.Open();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
if (TerminalMedia.IsOpen) TerminalMedia.Close();
TerminalMedia = null;
}

...

Launching the project I get the following exception from the Open:
Failed to receive answer from the modem. Check serial port.

As you can see in the following trace, the modem responds correctly but the Terminal does not intercept it:

Cl_OnTrace: Opening
Cl_OnMediaStateChange: Opening
Cl_OnTrace: Settings: Port: /dev/ttyUSB0 Baud Rate: 9600 Data Bits: 8 Parity: None Stop Bits: One Eop: None
Cl_OnTrace: AT
Cl_OnTrace: AT
OK

Cl_OnTrace: AT
Cl_OnTrace: A
Cl_OnTrace: T
Cl_OnTrace:
OK

Cl_OnTrace: Closing
Cl_OnMediaStateChange: Closing
Cl_OnTrace: Closed
Cl_OnMediaStateChange: Closed
Failed to receive answer from the modem. Check serial port.

Thanks a lot!
Christian

Profile picture for user Kurumi

Kurumi

3 years 6 months ago

Hi Christian,

Hi Christian,

I believe that the reason is that data is handled asynchronously and data is received from Cl_OnReceived method.

If you want to do this synchronously, you can do it like this:
ReceiveParameters<byte[]> p = new ReceiveParameters<byte[]>()
{
Eop = 0x7E, //End of packet.
Count = 5, //Minimum byte count.
AllData = true, //Is all data read from the serial port.
WaitTime = 1000, //How long the reply is waited.
};

lock (TerminalMedia.Synchronous)
{
TerminalMedia.Send(data, null);
if (!TerminalMedia.Receive(p))
{
//No reply. Thrown an exception or read again.
}
//Received data
byte[] tmp = p.Reply;
}

BR,
Mikko

Profile picture for user hivesoft

hivesoft

3 years 6 months ago

Hi Mikko,

Hi Mikko,
sorry but I do not understand.
This exception is thrown by the Open method of the GXTerminal library.
Going to see the sources, this function already executes the AT command in Synchronous mode:

GXTerninal.cs, Row 1157:
lock (Synchronous)

If I launch the same project on Win32 architecture everything works fine!

Some trobleshuting: If I set off the ECHO with ATE0 everything also works on linux.

BR
Christian

Profile picture for user Kurumi

Kurumi

3 years 6 months ago

Hi Christian,

Hi Christian,

OK. Now I get it. I believe that you are right and the ECHO might cause the problem.
Can you live with this if you set echo off for now? This can be fixed, but it takes some time to get a modem for testing. Our customers do not use them on a daily basis anymore. :-)

BR,
Mikko

Profile picture for user hivesoft

hivesoft

3 years 6 months ago

Hi Mikko,

Hi Mikko,
you're very lucky if you don't use these damn modems anymore. In Italy, even for installations in new systems, the authorities still demand gsm modems !!! :p

Anyway, yes, I don't have any major problems.
However I created a pool request on the Terminal GitHub where I publicly expose the InitializeCommands property which was currently only accessible via the Settings method.

Then I would not see particular problems also in exposing the SendCommand method as public that sometimes it could be useful to have available to do some checks on the modem.

BR
Christian

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Mon, 12/29/2025 - 10:38
    Gurux.Serial.Android 3.0.5
  • Mon, 12/15/2025 - 08:11
    Gurux.DLMS.Net 4.0.87
  • Fri, 12/12/2025 - 08:38
    Gurux.DLMS.Python 1.0.195
  • Thu, 12/11/2025 - 13:22
    Gurux.DLMS.Python 1.0.194
  • Thu, 12/11/2025 - 11:01
    gurux.dlms.java 4.0.88

New forum topics

  • Gurux DLMS Android App
  • AMR support for bidirectional meters.
  • addition of new object in object list, meter not working
  • old meter take to much time(l&t)
  • Unable to connect L&T ER300P Meter
More

Who's new

  • brianmon
  • dejanm
  • Edward J TMA
  • zenagy
  • Bhanu Prakash
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin