Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

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

Breadcrumb

  1. Home
  2. Forums
  3. STM32F103 Server DLMS C From Scrash By Keil

STM32F103 server DLMS C from scrash by Keil

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.

By rama , 24 June, 2022
Forums
Gurux.DLMS

I am a mcu programmer. i have made an single phase meter .
It can measure rms Voltage, rms Current, active power(A+,A-,|A| with rates), reactive power, power factor, frequency and many other parameters.
i want add DLMS/COSEM to it. i like start a topic about it. and question is: where I must start?and what is the first step?
I hope we could do a complete DLMS server by GURUX library for STM32F103.

Profile picture for user Kurumi

Kurumi

3 years 11 months ago

Hi,

Hi,

There is no ready example for Keil at the moment, but you can use this at the template:
https://github.com/Gurux/GuruxDLMS.c/tree/master/NordicSemiconductor/Gu…

You need only change UART read/write and you can communicate with the meter.
Read also this:

http://www.gurux.fi/Gurux.DLMS.Server

BR,
Mikko

rama

3 years 11 months ago

In reply to Hi, by Kurumi

thank you. i will read and

thank you. i will read and check it.

rama

3 years 10 months ago

Hi Mikko,

ok

rama

3 years 10 months ago

Hi Mikko,

Hi Mikko,
I created a new project in Keil(mdk arm5) IDE for STM32F103C8T6 mcu. i use C language.
and then i added header files only to it(according server template for nordic mcu):
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>

#include "dlmssettings.h"
#include "date.h"
#include "variant.h"
#include "cosem.h"
#include "server.h"
#include "notify.h"
#include "gxserializer.h"
#include "gxignore.h"

and i dont have any in main() function yet.
after compile i have this error:
.\include\variant.h(189): error: #3092: anonymous unions are only supported in --gnu mode, or when enabled with #pragma anon_unions

what it say?

BR,
Rama

rama

3 years 10 months ago

Hi,

Hi,
i solved it. I must activate GNU mode in Keil compiler.

rama

3 years 10 months ago

and i have another problem:

and i have another problem:
../Core/Src/main.c(132): error: #20: identifier "SERIAL_NUMBER" is undefined

i see this error in :

void addLogicalDeviceName(){
char buff[17];
sprintf(buff, "GRX%.13lu", SERIAL_NUMBER);
const unsigned char ln[6] = { 0,0,42,0,0,255 };
cosem_init2((gxObject*)&ldn.base, DLMS_OBJECT_TYPE_DATA, ln);
var_addBytes(&ldn.value, (unsigned char*)buff, 16);
}

wher i can find SERIAL_NUMBER? maybe i must add here my random serial number?

Profile picture for user Kurumi

Kurumi

3 years 10 months ago

Hi,

Hi,

I'm glad that you solved the first question.

Please, create a new topic if you have a new question, otherwise, it's too easy to answer the wrong question.

SERIAL_NUMBER is defined like this:
uint32_t SERIAL_NUMBER = 123456;

BR,
Mikko

rama

3 years 10 months ago

thank you Mikko.

thank you Mikko.
then for new questions i must create a new topics.
ok.

rama

3 years 10 months ago

Hi Mikko.

Hi Mikko.
i have new question and i created a new topic for it, but i dont get any reply for it.
then i ask my question here.
I have errors about the following functions in the kill compiler:
Undefined symbol svr_connected (referred from dlms.o).
Undefined symbol svr_disconnected (referred from dlms.o).
Undefined symbol svr_isTarget (referred from dlms.o).
1- what is problem?
2- what is usage of those functions? because they dont have any imolementation?
Is it up to the user to implement them?

Profile picture for user Kurumi

Kurumi

3 years 10 months ago

Hi,

Hi,

I have answered for your question here:
https://www.gurux.fi/node/20090

BR,
Mikko

rama

3 years 5 months ago

Hi, user must implement these

Hi, user must implement these functions. right?
1- svr_isTarget()
2- svr_connected()
3- svr_invalidConnection()
4- svr_disconnected()
5- svr_preGet()
6- svr_postGet()
7- svr_preRead()
8- svr_preWrite()
9- svr_preAction()
10- svr_postRead()
11- svr_postWrite()

righ?
thanks

Profile picture for user Kurumi

Kurumi

3 years 5 months ago

Hi,

Hi,

That is correct. You need to implement those methods.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin