Hello,
Im new with MQX, so I'm trying to learn about the system an test the available examples.
After some trainig I've followed AN3905 in order to learn how to create my first MQX application.
I could compile and program the code but when I run the application nothing happens with leds and the debug message is telling
Could not create LED1_TASK
Could not create LED2_TASK
Could not create LED3_TASK
Could not create LED4_TASK
Could someone help me to debug the problem?
Regards,
Gabriel
Could you post your code so we can try to help?
Could be on this lines. on the tasks.c file
_task_id task_id;printf("\n Initialize IO \n");InitializeIO();task_id = _task_create(0, LED1_TASK, 0);if (task_id == MQX_NULL_TASK_ID){printf("\n Could not create LED1_TASK\n");}else{printf("\n LED1_TASK created \n");}
Check the ioDriver.c if you inserted the GPIO adresses for your board.
These are for the TWRMCF51CN
#define LED_1 (GPIO_PORT_TE | GPIO_PIN3)
#define LED_2 (GPIO_PORT_TG | GPIO_PIN5)
#define LED_3 (GPIO_PORT_TE | GPIO_PIN5)
#define LED_4 (GPIO_PORT_TH | GPIO_PIN3)
Hello,
I've posted a service request to Freescale to and received an answer telling me that CW6.3 has a issue to work with V1 and MQX.
They suggest me to roll back to CW6.2.
I'll do it and let you know.
Best regards,
Gabriel
Hello gentlemen.
I'm having doubts as to create a routine for reading Inputs
[code]
// -- Função Inicializa IO
boolean InitializeIO(void)
{
const uint_32 output_set[] =
{
LED_1 | GPIO_PIN_STATUS_0,// Pino Inicializa em "0" após reset
LED_2 | GPIO_PIN_STATUS_0,// Pino Inicializa em "0" após reset
LED_3 | GPIO_PIN_STATUS_0,// Pino Inicializa em "0" após reset
LED_4 | GPIO_PIN_STATUS_0,// Pino Inicializa em "0" após reset
GPIO_LIST_END
};
/* Open and set port TC as output to drive LEDs */
output_port = fopen("gpio:write", (char_ptr) &output_set);
if (output_port)
{
ResetOutputs();
}
return (output_port!=NULL);
}
[\code]
Based on code AN3905 "Writing Your First Application MQX" I would like to know:
From what I understand it creates a vector of constant 32-bit to control only 4 bits? is it?
In the first line we have the code "output_set. To set these same IO's entry as I use "input_set?
It is possible to set this dynamically? So I could multiplex IOs.
What is the procedure for writing a routine Input?
Regards
Ricardo Franco - From Brazil
From what I understand it creates a vector of constant 32-bit to control only 4 bits? is it?
Yes, 4x 32 bits to control 4 bits.
In the first line we have the code "output_set. To set these same IO's entry as I use "input_set?
No. In the application, you can open the same set of pins for reading. You must first close already opened output-pins file and then open the next file with the same pins.
What is the procedure for writing a routine Input?
It is easy, you ask GPIO driver to sample the data on pins to your structure (which must be in the RAM). Then, you will check scan your structure of pins and apply testing mask GPIO_PIN_STATUS to each pin as you can see in examples/gpio.