wm_ioSingleWrite returns error -2 (WM_IO_INPUT_CANT_BE_SET)

Hi,

I am trying to write to the output pin WM_IO_Q24CLASSIC_GPIO_5 (Q24CLASSIC) using the following code:

wm_ioConfig_t BL_LIGHT;
u32 bl_light_label;
s32 bl_light_handle;

BL_LIGHT.eLabel.Q24CLASSIC_Label = bl_light_label = WM_IO_Q24CLASSIC_GPIO_5;
BL_LIGHT.eDirection = WM_IO_OUTPUT;
bl_light_handle = wm_ioAllocate(1, &BL_LIGHT);

result = wm_ioSingleWrite(bl_light_handle, bl_light_label, WM_IO_HIGH);    
debug_string("GPIO ERROR [bl_light_handle]: RESULT = %i", result);

The debug output shows the following outputline:
“GPIO ERROR [bl_light_handle]: RESULT = -2”

According the documentation -2 means “WM_IO_INPUT_CANT_BE_SET (The function failed to set an input pin)”

Can someone tell me what my problem is? It is a verry strange error, because I am trying use an output and not set an input.

You could start by cleaning the code a little…
Double assignments like:
BL_LIGHT.eLabel.Q24CLASSIC_Label = bl_light_label = WM_IO_Q24CLASSIC_GPIO_5;
is incredibly ugly and I’m not sure how that works anyway…

The next thing is to check the return value from wm_ioAllocate.
I think the problem is in wm_ioAllocate(1, &BL_LIGHT); <-- size of BL_LIGHT is definitely not 1… try with a sizeof(BL_LIGHT) instead of the 1.

Hi tobias,

Sorry for the late response. Your suggestions did not help solving my problem. Tnx anyway for your response.
At this moment I am in a discussion with engineers at Wavecom about this problem. As soon I have an awnser to my problem I will add a new reply in this thread.

It might be more appropriate to add something in the Peripheral IO Interfaces forum, as this doesn’t seem to have anything to do with the Flow Control Manager (FCM):

wavecom.com/modules/movie/sc … m.php?f=46

(be sure to include a cross-reference link, though)