AnsweredAssumed Answered

GPIO simple output with kinetis kwikstik

Question asked by Alessandro Tordini on Dec 6, 2011
Latest reply on Dec 17, 2011 by Alessandro Tordini

Hi, I'm trying to write a simple program for make blinking a led linked on GPIO pin 6 of my Kwikstik (with the TWR-ELEV).

 

I'm working with Codewarrior 10.1 (with the lastest update patch) and MQX 3.7 + KwikStik Patch.

 

This the code I have wrote. The codewarrior compile without errors but it not work..

 

#include "main.h"

#include <io_gpio.h>
#include <io_gpio_kgpio.h>




#if !BSPCFG_ENABLE_IO_SUBSYSTEM
#error This application requires BSPCFG_ENABLE_IO_SUBSYSTEM defined non-zero in user_config.h. Please recompile BSP with this option.
#endif


#ifndef BSP_DEFAULT_IO_CHANNEL_DEFINED
#error This application requires BSP_DEFAULT_IO_CHANNEL to be not NULL. Please set corresponding BSPCFG_ENABLE_TTYx to non-zero in user_config.h and recompile BSP with this option.
#endif


TASK_TEMPLATE_STRUCT MQX_template_list[] =
{
/*  Task number, Entry point, Stack, Pri, String, Auto? */
   {MAIN_TASK,   Main_task,   1500,  9,   "main", MQX_AUTO_START_TASK},
   {0,           0,           0,     0,   0,      0,                 }
};

GPIO_PIN_STRUCT pins1[] = {
        
    GPIO_PORT_A | GPIO_PIN6,
    GPIO_LIST_END
};
/*TASK*-----------------------------------------------------
*
* Task Name    : Main_task
* Comments     :
*    This task prints " Hello World "
*
*END*-----------------------------------------------------*/

void Main_task(uint_32 initial_data)
{
    MQX_FILE_PTR file1;

    
   _io_gpio_install("gpio:");
   
   file1 = fopen("gpio:write", (char_ptr) &pins1);
   
   


while (1) {

     
       _io_ioctl(file1, GPIO_IOCTL_WRITE_LOG1, NULL);
       
       _time_delay(1000);
       
       _io_ioctl(file1, GPIO_IOCTL_WRITE_LOG0 NULL);
       
       _time_delay(1000);
}   
   //_mqx_exit(0);


/* EOF */

-------------------------------------------------------------------------------------------------------------------------------------------

 

I have already set to one GPIO in userconfig.h

 

Someone find errors in this code?

 

Thanks

 

Outcomes