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.
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?
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
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?
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?
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.
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
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
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
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
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
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
Hi,
Hi,
Yes, that is the location.
BR,
Mikko
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
Hi.
Hi.
Don't worry. Thank you for this info.
BR,
Mikko