Working with GPIO... I only get errors

Hi everyone… i need a little help here…

I´m trying to write on a Wavecom module PIN.

The code I´m trying is:

#include "adl_gpio.h"

s8 HANDLE_GPIO;

HANDLE_GPIO = ADL_ioSubscribe(ADL_IO_Q25X1_GPO_0, 0,0,0, (adl_ioHdlr_f) NULL);

adl_ioWrite(HANDLE_GPIO, ADL_IO_Q25X1_GPO_0, 0);

The Visual C++ doesn´t build and there´s no explicity error message.

I just want to subscribe a PIN as output and set it on or off.

Thanks,

Henrique

HANDLE_GPIO = ADL_ioSubscribe(ADL_IO_Q25X1_GPO_0, 0,0,0, (adl_ioHdlr_f) NULL);

A think the error with your last parameter, must be only NULL if you don’t want polling.

HANDLE_GPIO = ADL_ioSubscribe(ADL_IO_Q25X1_GPO_0, 0,0,0, NULL);

good luck,

tom

Hi TOM… it didn´t work as the old one.

The program works fine without trying the GPIO. When I try the lines above the VC++ send me errors from other functions that are alright.

Any ideas? Anyone?

Thanks!

Henrique

Hi Henrique,

Did you write “ADL_ioSubscribe(…)” or “adl_ioSubscribe(…)” in the code? I f you haven´t defined ADL_ioSubscribe() yourself, then it should be with lower case “adl”… C is case-sensitive and will punish you for not using the correct upper/lower case spelling…

Best Regards,
Jan

Thanks jan, you are right. And sorry sanabiovilela i have not red it thoughtfully.

The correct one is:

HANDLE_GPIO = adl_ioSubscribe(ADL_IO_Q25X1_GPO_0, 0,0,0, (adl_ioHdlr_f) NULL);

tom

Hi! I think I´m having some trouble to find out which PIN is the right one I´m setting on the module.

I have a PDF that shows three Connection IOs. J100, J101 and J102.

My module has J200, J201 and J202.

Does anyone have the right PDF? I checked the VDD and GND pins and they seem the same but… I´m not sure.

I tryed the lines above:

adl_ioWrite(HANDLE_GPIO, ADL_IO_Q25X1_GPO_1, 1);

and

adl_ioWrite(HANDLE_GPIO, ADL_IO_Q25X1_GPO_1, 0);

Just switching the IO level… the PIN I was trying was PIN 44 of J100 I assumed was like J200.

Any ideas!?

Thanks!

Henrique

Hi Henrique,

I can’t help you find the Pin, but I think you need to use

adl_ioWrite(HANDLE_GPIO, ADL_IO_Q25X1_GPO_1, ADL_IO_Q25X1_GPO_1);

to set it ON… the 3rd parameter is a mask which you need to pass the bits for ports to set…

Best Regards,
Jan

So Jan, as you told me:

adl_ioWrite(HANDLE_GPIO, ADL_IO_Q25X1_GPO_1, ADL_IO_Q25X1_GPO_1);

A 2nd parameter is needed as a mask. The 3rd one is the value right?

This way I have to set the value as 0x00000004 or 0x00000000
It wouldn´t be a problem to use 0xFFFFFFFF or 0x00000000 correct? Because we´re using a mask.

Best Regards,

Henrique

Yeah, I guess you could use 0xFFFFFFFF / 0x00000000. I haven’t tried it but it may work. I don’t know if they check internally if you try to set a value for a GPIO which isn’t in the mask of GPIOs to write…

I think the safe way would be to only pass the value that the function needs… Even if it does work now, who knows if they implement more thorough checking in future versions of OpenAT…

Best Regards,
Jan