GPIO on Q2686


#1

Hello, I try this to build this code :

#include "adl_global.h"

const u16 wm_apmCustomStackSize = 1024;
const adl_ioConfig_t MyGpioConfig1[1]={{ADL_IO_Q2686_GPIO_19,0,ADL_IO_OUTPUT,ADL_IO_LOW}};
const adl_ioConfig_t MyGpioConfig2[1]={{ADL_IO_Q2686_GPIO_21,0,ADL_IO_INPUT}};
const adl_ioConfig_t MyGpioConfig3[1]={{ADL_IO_Q2686_GPIO_24,0,ADL_IO_INPUT}};
s32 MyGpioHandle1;
s32 MyGpioHandle2;
s32 MyGpioHandle3;


void HelloWorld_TimerHandler ( u8 ID )
{
    s32 ReadValue;
    s32 ReadValue2;
   /* Hello World */
    TRACE (( 1, "Embedded : Hello World " ));

   ReadValue=adl_ioReadSingle (MyGpioHandle2,ADL_IO_Q2686_GPIO_21);
   ReadValue2=adl_ioReadSingle (MyGpioHandle3,ADL_IO_Q2686_GPIO_24);

   if(ReadValue==1)
   {
   adl_ioWriteSingle (MyGpioHandle1,ADL_IO_Q2686_GPIO_19,ADL_IO_HIGH);
   adl_atSendResponse ( ADL_AT_UNS, "\r\nGPIO19 H\r\n" );
   adl_atSendResponse ( ADL_AT_UNS, "\r\nGPIO19 H\r\n" );
   }
   else if (ReadValue==0)
   {
   adl_ioWriteSingle (MyGpioHandle1,ADL_IO_Q2686_GPIO_19,ADL_IO_LOW);
   adl_atSendResponse ( ADL_AT_UNS, "\r\nGPIO19 L\r\n" );
   }

   if(ReadValue2==1){
	   adl_ioUnsubscribe (MyGpioHandle1);
	   adl_ioUnsubscribe (MyGpioHandle2);
	   adl_ioUnsubscribe (MyGpioHandle3);
	   adl_atSendResponse ( ADL_AT_UNS, "\r\nGPIO relachement\r\n" );
   }
}
void adl_main ( adl_InitType_e  InitType )
{

   TRACE (( 1, "Embedded : Appli Init" ));
   adl_atSendResponse ( ADL_AT_UNS, "\r\nInit GPIO\r\n" );
   MyGpioHandle1=adl_ioSubscribe (1, MyGpioConfig1,0,0,0);
   MyGpioHandle2=adl_ioSubscribe (1, MyGpioConfig2,0,0,0);
   MyGpioHandle3=adl_ioSubscribe (1, MyGpioConfig3,0,0,0);
    /* Set 1s cyclic timer */
    adl_tmrSubscribe ( TRUE, 10, ADL_TMR_TYPE_100MS, HelloWorld_TimerHandler );

}

On an Q2686 with Frimware Package 7.3.0.00 and OpenAT OS Package 6.20.0.04
and got this errors:

'ADL_IO_HIGH' undeclared (first use in this function)	main_gpio.c	test_gpio/src	25	C/C++ Problem
'ADL_IO_INPUT' undeclared here (not in a function)	main_gpio.c	test_gpio/src	5	C/C++ Problem
'ADL_IO_LOW' undeclared here (not in a function)	main_gpio.c	test_gpio/src	4	C/C++ Problem
'ADL_IO_OUTPUT' undeclared here (not in a function)	main_gpio.c	test_gpio/src	4	C/C++ Problem
'ADL_IO_Q2686_GPIO_19' undeclared here (not in a function)	main_gpio.c	test_gpio/src	4	C/C++ Problem
'ADL_IO_Q2686_GPIO_21' undeclared here (not in a function)	main_gpio.c	test_gpio/src	5	C/C++ Problem
'ADL_IO_Q2686_GPIO_24' undeclared here (not in a function)	main_gpio.c	test_gpio/src	6	C/C++ Problem
syntax error before 'MyGpioConfig1'	main_gpio.c	test_gpio/src	4	C/C++ Problem
syntax error before 'MyGpioConfig2'	main_gpio.c	test_gpio/src	5	C/C++ Problem
syntax error before 'MyGpioConfig3'	main_gpio.c	test_gpio/src	6	C/C++ Problem

Before I update the firmware and the SDK that works fine!
Where is the probeleme as I found the good references in the includes folder of the project!

thks seb.


#2

which application are you building from?
M2M studio or the original SDK?


#3

From M2M Studio why?? :frowning:


#4

is this a first-time install of the latest version of M2M studio?
or did you have had the previous version installed a well?

did you have a previous version of the frimware imported on M2M studio?

i’ve had similar problems and my solution was:

  • to throw away all settings from your workspace, (or just use a new workspace location, i didn’t test that though)
  • reinport the firmware and modules you need
  • set up a new project (with selecting the modules you need) and give it the name of the project you want to use.
    don’t use a sample or empty project.
  • copy your old project files into the new directory (only the src, inc and itf folders)

then you can compile your project with the new firmware without any problems.


#5

Already try Madouc, I have remove M2M workspace, M2M installation folder, uninstall SDK, reinstall all that stuff… and it’s the same :cry:

I also try something else:

#include "adl_global.h"

const u16 wm_apmCustomStackSize = 1024*3;

void HelloWorld_TimerHandler ( u8 ID, void * Context )
{
    /* Hello World */
    TRACE (( 1, "Embedded : Hello World" ));
    adl_atSendResponse ( ADL_AT_UNS, "\r\nHello World from Open-AT\r\n" );
}


s32 sms_automaton_Handle_txt;

void SMS_AUTO_Handler(u8 ID, void * Context){}
void SMS_AUTO_ctrl_Handler(u8 ID, void * Context){}

void adl_main ( adl_InitType_e  InitType )
{
    TRACE (( 1, "Embedded : Appli Init" ));

    /* Set 1s cyclic timer */
    adl_tmrSubscribe ( TRUE, 10, ADL_TMR_TYPE_100MS, HelloWorld_TimerHandler );

    sms_automaton_Handle_txt = adl_smsSubscribe(SMS_AUTO_Handler, SMS_AUTO_ctrl_Handler, ADL_SMS_MODE_TEXT);
    adl_smsSend(sms_automaton_Handle_txt, "0686160083", "Hello_World", ADL_SMS_MODE_TEXT);
    adl_atSendResponse ( ADL_AT_UNS, "\r\nSMS Send\r\n" );
}

And I read this in the Shell:

at+wopen=1
OK
SMS Send
Hello World from Open-AT
Hello World from Open-AT
Hello World from Open-AT
Hello World from Open-AT
at+wopen=0
OK
+WIND: 13
+WIND: 1
+WIND: 16
+WIND: 7
+WIND: 4
+WIND: 10,"SM",0,"FD",0,"ON",0,"SN",0,"EN",0
+WIND: 11,,,,,"95631A0AF3F51BCA7B111DC379D9AC2C","3632E3C40F08E6AB628749A1CAFF06E2"

NB I close application by myself, but I never receive SMS on my phone, why? any idea?


#6

Finaly this code build and run:

#include "adl_global.h"

const u16 wm_apmCustomStackSize = 1024*3;

s32 MyGpioHandle1;
s32 MyGpioHandle2;
adl_ioDefs_t MyGpioConfig2 [ 1 ] = { ADL_IO_GPIO | 21 | ADL_IO_DIR_IN };
adl_ioDefs_t MyGpioConfig1 [ 1 ] = { ADL_IO_GPIO | 19 | ADL_IO_DIR_OUT };

void GPIOHandlePerso ( u8 ID, void * Context ){
	adl_atSendResponse ( ADL_AT_UNS, "\r\nEtat GPIO21\r\n" );
	s32 ReadValue;
	adl_ioDefs_t Gpio_to_read2 = ADL_IO_GPIO | 21 ;
	ReadValue = adl_ioReadSingle (MyGpioHandle2, &Gpio_to_read2 );
	if(ReadValue==1){
		adl_atSendResponse ( ADL_AT_UNS, "\r\nGPIO21 = H\r\n" );
	}else{
		adl_atSendResponse ( ADL_AT_UNS, "\r\nGPIO21 = L\r\n" );
	}
}

void GPIOHandlePerso2( u8 ID, void * Context ){
	static int toggle = 0;
	adl_ioDefs_t Gpio_to_write1 = ADL_IO_GPIO | 19 ;
	adl_ioWriteSingle ( MyGpioHandle1, &Gpio_to_write1, toggle);
	toggle = !toggle;
}

void GPIO_INIT(void){
	adl_atSendResponse ( ADL_AT_UNS, "\r\nConfig GPIO\r\n" );
	MyGpioHandle2 = adl_ioSubscribe ( 1, MyGpioConfig2, 0, 0, 0 );
	MyGpioHandle1 = adl_ioSubscribe ( 1, MyGpioConfig1, 0, 0, 0 );
	adl_tmrSubscribe ( TRUE, 10, ADL_TMR_TYPE_100MS, GPIOHandlePerso );
	adl_tmrSubscribe ( TRUE, 10, ADL_TMR_TYPE_100MS, GPIOHandlePerso2 );
}

void adl_main ( adl_InitType_e  InitType ){
    adl_atSendResponse ( ADL_AT_UNS, "\r\nApp Begin\r\n" );
    GPIO_INIT();
}

#7

you code are work?? my code is do error =-11 (((


#8

did u try to lookup what error -11 means in the documentation?


#9

hi,

it has a change in GPIO service between Frimware Package 7.3.0.00 and OpenAT OS Package 6.20.0.04. the GPIO service of Firmware R7.3 subscribe and define prarameter different from Firmware R6.2. You should read ADL_User_Guide of OpenAT OS and change your code suitable for Firmware R7.3.
Good luck.


#10

Hi I am facing the similar problem. Can u help how can i rectify these errors…please help me…


#11

Hi,
can anyone give a sample of how to configure the GPIO pins 1 and 2 as output mode and GPIO pin 33 as input using the adl commands. And, more importantly how to use the adl_iowrite() and adl_ioread()? im confused about the parameters used in these functions. Sample code is a welcome.
Expecting a reply at the earliest.
thanks and regards
kiranreddy


#12

Have you looked at the samples included with the SDK :question:


#13

Hi,
i am facing same error

but i noticed one thing,

signal pin# i/o type message
GPIO3 50 1V8 when i subscribe this pin as gpio it gives me error -11
GPIO28 23 2V8 when i subscribe this pin as gpio it doesn’t gives me error & subscribe successfully
GPIO30 24 2V8 when i subscribe this pin as gpio it doesn’t gives me error & subscribe successfully

how to solve this problem.


#14

Hiya,

GPIO3 is multiplexed with INT0. Are you using any of the external interrupt services?

ciao, Dave


#15

no i am using it as GPIO,my microcontroller pin is connected to it.


#16

Hiya,

You’ll have to look thorough your code.

I’d start by searching for functions such as adl_irqSubscribe() and adl_tcuSubscribe() and similar.

Have a good read of the ADL user guide with respect to GPIO, IRQ and TCU services. Also have a look in the AT Command Guide in the section on GPIO management.

ciao, Dave