![]() |
|
|
Thread Tools |
|
#1
|
|||
|
|||
|
Hi,
EDIT: I just tried changing the pin to PIO3.0 and PIO1.11 and those are not working either, so my theory below on MAT3 being the cause is wrong. I am unable to control the PIO0.7 pin on my LPC1114 when MAT3 is enabled (PIO0.11) PIO0.7 is supposed to toggle low in response to a button press. The other program functions in the button press subroutine respond to the button press, so I know the code to toggle PIO0.7 low is being executed. The button press subroutine is: Code:
else if (bit_is_clear(debouncedState, SWITCH_STOP_PIN))
{
while(debounceButtonIsPressed());
// send the stop signal for 0.5s, then return the stop signal to the default level
timer32B0SendStop();
LED_FREQ_DATA = ~LED_FREQ_ALL; // flash leds
STOP_OUTPUT_DATA &= ~(1<<STOP_OUTPUT_PIN); // bring trig line low
systickDelay(50); // delay 0.5s
// revert to normal state
timer32B0SendGo();
STOP_OUTPUT_DATA |= (1<<STOP_OUTPUT_PIN); // return trig line high
gpioChangeFreqLed(clockIndex); // restore previous led indication
}
Code:
// STOP line is PIO0.7 #define STOP_OUTPUT_DATA GPIO_GPIO0DATA #define STOP_OUTPUT_DIR GPIO_GPIO0DIR #define STOP_OUTPUT_PIN 7 My program sets up a 100Hz - 500Hz pulse train on MAT3 (PIO0.11). During debugging, when I watch GPIO0DATA, the only activity I see is on bit 11 (MAT3) and bit 10 (SWCLK). PIO0.7 remains constant, at the initial state I set it to in gpioInit(), the first function I call from main(). gpioInit() does the following: Code:
void gpioInit(void)
{
SCB_SYSAHBCLKCTRL |= SCB_SYSAHBCLKCTRL_GPIO; // enable clock to the GPIO block
// set all GPIO to input by default
GPIO_GPIO0DIR &= ~GPIO_IO_ALL;
GPIO_GPIO1DIR &= ~GPIO_IO_ALL;
GPIO_GPIO2DIR &= ~GPIO_IO_ALL;
GPIO_GPIO3DIR &= ~GPIO_IO_ALL;
LED_FREQ_DIR |= LED_FREQ_ALL; // set all frequency leds to outputs
STOP_OUTPUT_DIR |= (1 << STOP_OUTPUT_PIN); // set stop output pin to output
STOP_OUTPUT_DATA |= (1 << STOP_OUTPUT_PIN); // output low on STOP
}
Last edited by gastro54; 05-04-2012 at 09:44 PM. |
|
#2
|
|||
|
|||
|
Your debugger (Peripheral View) is able to:
#1 Show your actual GPIO setting ![]() #2 Show your actual IOCON setting ![]() #3 Switch GPIO bits ![]() Did you try this already? |
|
#3
|
|||
|
|||
|
Quote:
GPIO0DIR = 0x80 (only bit 7 set) IOCON_PIO0_7 = 0xc0 (only bits 6,7, which are reserved are set) When I toggle bit 7 in GPIO0DATA in the debugger, I see it toggle on the scope. Something is wrong with the code execution I think... |
|
#4
|
|||
|
|||
|
Next tip:
#1 Debug you code ![]() or #2 Post a complete project and hope someone debugs it
|
|
#5
|
|||
|
|||
|
omg. I haven't been editing the main.c that I though I was. I discovered this after I coded some erroneous shit and the build didn't throw any errors. WOW.
|
![]() |
| Thread Tools | |
|
|