I already solved one problem with tricky pin F0, getting some help here to disable NMI. Now it seems there is another problem. I am using this pin to operate a relay, and whenever my program stops, NMI is re-enabled, F0 goes high (I think - going to test with a scope tomorrow) and the relay is closed.
Here's the code I'm using:
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); // Pins: RGB LED, Relays ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); // RGB LED // Port F unlock procedure: HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY; // Unlock the port HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= GPIO_PIN_0; // Unlock the pin HWREG(GPIO_PORTF_BASE + GPIO_O_AFSEL) &= ~GPIO_PIN_0; HWREG(GPIO_PORTF_BASE + GPIO_O_DEN) |= GPIO_PIN_0; HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = 0; // Lock the port // Then turn it on: ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_0); // Rel1 (conflict with USR SW2)
Am I doing something wrong? Is there something else I should be doing to keep my relay from closing each time the program runs?