Bad memory access by wm_lstGetCount. Updated!

I programmed an SL6087 with my program and I repeatedly get this exception in the traces:

So I checked the Memory Access View in Developer studio to find what function lies at 0x341F00. It appears to be the function wm_lstGetCount wich starts at address 0x00341EF6 and is 22 bytes long.

Then I commented this line in my code:

u16 cellCount = wm_lstGetCount(cellList);

I recompile, download and the exception no longer occurs.

What could be the cause of this exception? Am I doing something wrong? :frowning:

Update:
I have defined an A&D area size, which was missing on the new CPU (I guess since it is no longer recommended to use A&D but rather the newer Filesystem). Anway, since this is legacy code it is using A&D storage.

Now I get a different exception though! I narrowed the cause down to this line of code:

adl_ioWriteSingle( MyGpioHandle1, &Gpio_to_write , false );

The exception:

Does anyone have an idea of what I could try next?

Hiya,

Sounds like you haven’t defined/allocated a variable correctly.

In the case that you’ve presented (the adl_ioWrite), check that the Handle subscription returned correctly and that you have a valid handle.

Also, is

a valid variable that has been initialized correctly?

ciao, Dave

Thank you for your response David :smiley:

You were right, I had to check the return value. It was ADL_RET_ERR_DONE, for wich I had to check the adl_ioError_e type in adl_ioDef_t.

My gpio config looks like this:

adl_ioDefs_t MyGpioConfig1[7] =
{
		ADL_IO_GPIO | 24 | ADL_IO_DIR_OUT,	// OUT1
		ADL_IO_GPIO | 23 | ADL_IO_DIR_OUT,	// OUT2
		ADL_IO_GPIO | 20 | ADL_IO_DIR_OUT,	// ENABLE3V3
		ADL_IO_GPIO | 19 | ADL_IO_DIR_IN,	// IN2
		ADL_IO_GPIO | 22 | ADL_IO_DIR_IN,	// IN1
		ADL_IO_GPIO | 21 | ADL_IO_DIR_OUT,	// LED
		ADL_IO_GPIO | 18 | ADL_IO_DIR_OUT	// WATCHDOG
		//ADL_IO_GPIO | 17 | ADL_IO_DIR_IN	// CHARGESTAT
};

I fetched the adl_ioError_e’s value like this:

adl_ioDefs_t ioDef = MyGpioConfig1[6];
TRACE((MAIN_TRACE_LEVEL, "adl_ioError: %d", (ioDef & ADL_IO_ERR_MSK) >> ADL_IO_ERR_POS));

Wich turned out to be 2 and if I am correct this would be ADL_IO_ERR_USED.

EDIT:
I forgot I had to free a GPIO by running AT+WFM=0,7
It’s working now :slight_smile:

Hiya,

Excellent.

The multiplexing of I/O pins between different modules is a sneaky trap.

Glad that you’ve got it going. Thanks for letting us know how you solved it.

ciao, Dave