We are attempting to implement the C code (GuruxDLMSClientExample). We have copied the development dir into the parent dir. On running the Makefile the compilation is shown to be successful and .o files are created in the obj folder as well. However, we get the following linker error:
ue@DESKTOP-7CVAMGN /cygdrive/d/repository/test/GuruxDLMSClientExample $ make
Compiled src/communication.c successfully! src/main.c: In function ‘connectMeter’: src/main.c:311:38: warning: variable ‘outputFile’ set but not used [-Wunused-but-set-variable] 311 | char* p, * readObjects = NULL, * outputFile = NULL; | ^~~~~~~~~~
Compiled src/main.c successfully!
Compiled src/connection.c successfully!
Compiled src/getopt.c successfully!
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgurux_dlms_c collect2: error: ld returned 1 exit status
make: *** [makefile:26: bin/gurux.dlms.client.bin] Error 1
(I am using Cygwin to compile on a Windows machine).
I am attaching a picture of the directory structure.
We are planning on using a Renesas MCU for reading from the meter. We are hoping to make changes to this current C code and use it with the Renesas MCU. Are there any specific C files that we would need edit to do the same? We are currently studying the code for that. Could you kindly point us in the direction we would need to go to translate this code for the MCU.
Thank you very much. We really appreciate your help.
I believe that your linker settings are invalid. Have you built the development folder before trying to build a client example? In your previous topic, you were using Atmel Studio. Do you want to use Atmel Studio or cygwin?
Thank you so much for your reply! I'm sorry, I had not built the development folder. I have done that now. The code compiles successfully. For now, I am trying to communicate with the meter directly through my Windows PC using Cygwin.
However, when I attempt to run the program I get the error: "Failed to open serial port: COM2"
I have already used the Gurux DLMS Director and verified that I am successfully getting all the right values using the same COM port.
------------------------------------------------------------------------------
I have also specified the following settings for meter in the code as follows:
//Initialize settings using Logical Name referencing and HDLC.
cl_init(&con.settings, 1, 32, 1, DLMS_AUTHENTICATION_LOW, "lnt1", DLMS_INTERFACE_TYPE_HDLC);
int ret, opt = 2;
int port = 0;
char* address = NULL;
char* serialPort = "COM2";
char* p, * readObjects = NULL, * outputFile = NULL;
int index, a, b, c, d, e, f;
char* invocationCounter = NULL;
-------------------------------------------------------------------------------
Finally, our aim is to communicate with the meter through a Renesas Microcontroller. That code would be in Embedded C. So, we are attempting to implement the C code provided by you in the hope of converting that to an Embedded code for the target microcontroller.
Could you please guide us about the modifications we would need to make to the code for the same.
Thank you very much for your help it has been instrumental.
UPDATE: The code successfully runs! I got the data from the meter too. I realized that Cygwin being a Linux emulator doesn't take the serial com port value in the form of "COM1" or "COM2" etc. The serial port value needs to be given as /"dev/ttyS1". The Cygwin terminal then maps it to the correct windows COM Port.
Now, however, the mammoth task of port this C code to one that is compatible with an MCU is still ahead of us. We hope you can guide in the direction we can take for the same. Thank you so much!
Hi,
Hi,
I believe that your linker settings are invalid. Have you built the development folder before trying to build a client example? In your previous topic, you were using Atmel Studio. Do you want to use Atmel Studio or cygwin?
BR,
Mikko
BR,
Mikko
Hello Mikko,
Hello Mikko,
Thank you so much for your reply! I'm sorry, I had not built the development folder. I have done that now. The code compiles successfully. For now, I am trying to communicate with the meter directly through my Windows PC using Cygwin.
However, when I attempt to run the program I get the error: "Failed to open serial port: COM2"
I have already used the Gurux DLMS Director and verified that I am successfully getting all the right values using the same COM port.
------------------------------------------------------------------------------
I have also specified the following settings for meter in the code as follows:
//Initialize settings using Logical Name referencing and HDLC.
cl_init(&con.settings, 1, 32, 1, DLMS_AUTHENTICATION_LOW, "lnt1", DLMS_INTERFACE_TYPE_HDLC);
int ret, opt = 2;
int port = 0;
char* address = NULL;
char* serialPort = "COM2";
char* p, * readObjects = NULL, * outputFile = NULL;
int index, a, b, c, d, e, f;
char* invocationCounter = NULL;
-------------------------------------------------------------------------------
Finally, our aim is to communicate with the meter through a Renesas Microcontroller. That code would be in Embedded C. So, we are attempting to implement the C code provided by you in the hope of converting that to an Embedded code for the target microcontroller.
Could you please guide us about the modifications we would need to make to the code for the same.
Thank you very much for your help it has been instrumental.
Hello Mikko,
Hello Mikko,
UPDATE: The code successfully runs! I got the data from the meter too. I realized that Cygwin being a Linux emulator doesn't take the serial com port value in the form of "COM1" or "COM2" etc. The serial port value needs to be given as /"dev/ttyS1". The Cygwin terminal then maps it to the correct windows COM Port.
Now, however, the mammoth task of port this C code to one that is compatible with an MCU is still ahead of us. We hope you can guide in the direction we can take for the same. Thank you so much!
Hi Radhika,
Hi Radhika,
Thank you for this info. Let me know if you have any questions.
BR,
Mikko