Hi Freescale Community,
I'm using the TWR-MCF51CN-KIT to develop a project and I'm having trouble with the GPIO.
I'm working of the built in GPIO example to get started (***\Freescale\Freescale MQX 3.5\mqx\examples\gpio). I'm able to load this project and toggel the LED with the SW2 fine. Now I'm trying to toggle a GPIO on the side expansion port of the Functional Elevator (http://cache.freescale.com/files/microcontrollers/hardware_tools/schematics/TWR-ELEV-FUNC-SCH.pdf?fp...).
In my main task of this example, I have:
*****
void main_task ( uint_32 initial_data)
{
FILE_PTR port_file_ID7;
GPIO_PIN_STRUCT pin_ID7[] =
{
ID7,
GPIO_LIST_END
};
port_file_ID7 = fopen("gpio:write", (char_ptr) &pin_ID7 );
while (TRUE)
{
ioctl(port_file_ID7, GPIO_IOCTL_WRITE_LOG0, NULL);
_time_delay(1000);
ioctl(port_file_ID7, GPIO_IOCTL_WRITE_LOG1, NULL);
}
_mqx_exit(-1);
}
*****
where I declare ID7 as:
#define ID7 (GPIO_PORT_TD | GPIO_PIN3)
in a header file (ports defined in the MCF51CN datasheet, page 5, http://cache.freescale.com/files/32bit/doc/data_sheet/MCF51CN128.pdf?fpsp=1)
However, when I probe this port (J9, pin/port 23 on the Functional Elevator schematic), I read no change in voltage. I tried doing this with a few other GPIOs (GPIO9, 8, 7, among others) with similar results.
Does anyone see anyhting overtly wrong with the code? Perhaps it's a hardware connection somewhere?
Any help would be appreciated.
Thanks,
-Greg
Upon further review of the schematics, it appears that I'm probing the wrong ports; confusing GPIO pin labels with RGPIO. I'll investigate this further and get back with those interested.
-Greg