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. HardFault When Calling Cl_updateValue In GuruxDLMS.c

HardFault when calling cl_updateValue in GuruxDLMS.c

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 José Torres , 3 September, 2020
Forums
Gurux.DLMS

Hi,
I am using GuruxDLMS.c to try reading object logical name 0.0.0.2.1.255, attribute 2, HLS using GMAC, connects ok.

Following the http://gurux.fi/Gurux.DLMS.Client readObject example.

The call to cl_updateValue causes a hard fault due to an impossible pointer value.
I could track it to file variant.c, line 373, data->Arr is not NULL but data->Arr->data has a value that is not reachable.
See the picture below.

My system is gcc GNU Tools for STM32, version 7-2018-q2-update, with the following flags:-mcpu=cortex-m4 -std=gnu11
-g3 -Og -ffunction-sections -fdata-sections -Wall -Wextra -fstack-usage --specs=nano.specs -mfpu=fpv4-sp-d16
-mfloat-abi=hard -mthumb.

Please ask me for more information if you need it.

Thanks in advance,
José Torres

Image
Profile picture for user Kurumi

Kurumi

5 years 9 months ago

Hi,

Hi,

What object did you try to read when this happens? Can you read the meter using ANSI C client from the Linux or Windows? Can you read the meter with GXDLMSDirector?

How much RAM you have?

BR,
Mikko

José Torres

5 years 9 months ago

Hi Mikko,

Hi Mikko,
I was trying to read the object with logical name "0.0.0.2.1.255" it is an octet-string[15] with the firmware version.
I can read this with GXDLMSDirector. I was wondering if this can be a problem with initialization of the object argument to the function cl_updateValue.
I am using a STM32F413 microcontroller with 320KB of SRAM with freeRTOS.
Thanks,
José Torres

Profile picture for user Kurumi

Kurumi

5 years 9 months ago

Hi,

Hi,

Are you sure that you try to read the firmware version? In your picture, your data is coming back as array, structure, or compact data.

Can you use malloc?

BR,

Mikko

José Torres

5 years 9 months ago

Hi Mikko,

Hi Mikko,

yes, I am sure I tried to read firmware version. The code went to that case because the type in object was filled with DLMS_DATA_TYPE_STRUCTURE and I don't know why...
In any case, when I initiated the object structure like this:
static gxObject object;
unsigned char memoryArea[256] = {};
object.access = (gxAccess*)memoryArea;
bb_init(&object.access->methodAccessModes);
bb_init(&object.access->attributeAccessModes);
bb_capacity(&object.access->methodAccessModes, 50);
bb_capacity(&object.access->attributeAccessModes, 50);

I didn't get any more hardfault.

Is this correct? Shouldn't this be done automatically by gurux?

Thanks,
José Torres

Profile picture for user Kurumi

Kurumi

5 years 9 months ago

Hi,

Hi,

Can you read the firmware version with GXDLMSDirector? If you can can you add trace here so I can check the bytes?

Are you using malloc or have you define DLMS_IGNORE_MALLOC?

BR,
Mikko

José Torres

5 years 9 months ago

Hi Mikko,

Hi Mikko,

At this moment I can't use GXDLMSDirector, but I can get you the bytes if you tell me exactly where to put a breakpoint in gurux. Is it at the same point I showed in the picture?

I have not defined DLMS_IGNORE_MALLOC.

Thanks,
José Torres

Profile picture for user Kurumi

Kurumi

5 years 9 months ago

Hi,

Hi,

Yes, that is the location.

BR,

Mikko

José Torres

5 years 9 months ago

Hi Mikko,

Hi Mikko,
I can't reproduce the problem now, reading 0.0.0.2.1.255 it does not stop at case STRUCTURE... and it returns the rigth info. Now I am not sure anymore that I was reading this object. Sorry for the waste of time.

Thanks,
José Torres

Profile picture for user Kurumi

Kurumi

5 years 9 months ago

Hi.

Hi.

Don't worry. Thank you for this info.

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