locked
GPIO Access on iMX53 QSB Board Which is having WinCE7 RRS feed

  • Question

  • Hi,

    I want to toggle GPIO pins on my iMX53 board which is having windows CE7 image,

    Please suggest me the steps to access the GPIO on iMX53.

    Thanks & Regards,

    Shiak.


    Mujeeb Shaik

    Tuesday, December 17, 2013 7:58 AM

Answers

All replies

  • Are you a application developer or device developer?

    if you are an app developer and you have purchased a device from a vendor,

    This is not a part of a common APIs of WEC7. This is your device vendor specific. Normally there could be a custom stream driver and a custom API set released by your device vendor. you can ask them.

    if you are a device developer and if you have the BSP, then check the BSP for the GPIO driver and the API dll in the BSP. if not, you have to develop a custom GPIO driver and API set.


    Please mark as answer, if it is correct.
    Please vote,if it is helpful post.
    All the Best
    Vinoth.R
    www.e-consystems.com
    http://vinoth-vinothblog.blogspot.com

    Tuesday, December 17, 2013 9:35 AM
  • I am Device Driver Developer, if i have my own GPIO BSP how to add the same to OS Please tell me steps,i dont have idea about this


    Mujeeb Shaik

    Tuesday, December 17, 2013 10:25 AM
  • Hi Vinoth,

    Thanks for your reply,

    i am working on i.MX53 QSB board,OS is WinCE7,

    i dont have direct access to GPIO driver, we have one NLED (notification LED ) Driver through that we can access GPIOs,so what i am doing is i am accessing the NLED driver using the IOCTLs from application,IOCTL_NLED_SETDEVICE is one IOCTLS to set perticular LED,My plan is i will fill the NLED_SETIINGS_INFO structure with required  data,i will pass that to driver, i will refer LED number in Driver level i will compare in driver that if LED Number is equals to 1 i will access one GPIO as per my requirement,if led number is equal to some X i will access some X GPIO,that is my plan but here problem is when i am passing the structure from application the address of the structure is corrupting some where so the values which i am passing from application same is not getting at Driver level,where i am doing the mistake i am unable to trace is there any other way to access GPIO,i have created an IOCTL to pass one single argument then i can process GPIO but the IOCTL which i created also getting fail.

    please refer the application code which i am using.

    BOOL NLED_Init(void)
    {
    NLED_SETTINGS_INFO    LED_Config;
    	NLED_COUNT_INFO        Leds_info;                 //Number of NLEDs on Board
    	int           GPIO_Test_Variable;
    	int			  Number_of_Bytes_Rtnd;
    Leds_info.cLeds = 0;
    	
    	LED_Config.LedNum			= 0;				//   LED number, 0 is first LED
    	LED_Config.OffOnBlink		= 2;				//   0 == off, 1 == on, 2 == blink
    	LED_Config.TotalCycleTime	= 10;			    //   total cycle time of a blink in microseconds
    	LED_Config.OnTime			= 5;				//   on time of a cycle in microseconds
    	LED_Config.OffTime			= 5;				//   off time of a cycle in microseconds
    	LED_Config.MetaCycleOn		= 3;               //   number of on blink cycles
    	LED_Config.MetaCycleOff     = 3;               //   number of off blink cycles 
    printf("********************************************* \n");
    	printf("********************************************* \n");
    	printf("APP:NLED Launched... \n");
    	RETAILMSG(1,(TEXT("APP:NLED Launched... \r\n")));
    	NLED_Handle = CreateFile(L"NLD1:",							// name of device      L"I2C1:",
    							 GENERIC_READ|GENERIC_WRITE,         // desired access
    							 FILE_SHARE_READ|FILE_SHARE_WRITE,   // sharing mode
    							 NULL,                               // security attributes (ignored)
    							 OPEN_EXISTING,                      // creation disposition
    							 NULL,//FILE_FLAG_RANDOM_ACCESS,            // flags/attributes
    							 NULL);                              // template file (ignored)
    	if (NLED_Handle == (HANDLE)-1)
    	{
    		printf("APP:Unable to open handle to NLED\r\n");
    		RETAILMSG(1,(TEXT("APP:Unable to open handle to NLED Error:%d \r\n"),GetLastError()));
    		return FALSE;
    	}
    	else
    	{
    		printf("APP:NLED Init Success...\r\n");
    		RETAILMSG(1,(TEXT("APP:NLED Init Success... \r\n")));
    		printf("\r\nAPP:NLED_Handle = %d\r\n",NLED_Handle);
    		RETAILMSG(1,(TEXT("\r\n APP:NLED_Handle = %d\r\n"),NLED_Handle));
    	}
    if (!DeviceIoControl(NLED_Handle,                // file handle to the driver
                             IOCTL_NLED_SETDEVICE,       // I/O control code
    						 &LED_Config,                // in buffer
    						 sizeof(LED_Config),         // in buffer size
    						 NULL,                       // out buffer
    						 0,                          // out buffer size
    						 NULL,                       // pointer to number of bytes returned
    						 NULL))                      // ignored (=NULL)
        {
    		RETAILMSG(1,(TEXT("\r\n APP:IOCTL_NLED_SETDEVICE Fail...\r\n")));
    		return FALSE;
        }
    	else
    	{
    		RETAILMSG(1,(TEXT("\r\n APP:IOCTL_NLED_SETDEVICE Success...\r\n")));
    	}

    please help me regarding this issue,

    Thanks & Regards,

    Mujeeb Shaik.


    Mujeeb Shaik


    • Edited by Mujeeb_Win Friday, December 20, 2013 1:37 PM
    Friday, December 20, 2013 12:48 PM