This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

GPIO pin value setting is not effected



Hi Folks,

I am using the F28027 LaunchPad XL at the moment. I have a program up and running no problem, GPIO initialised, PWM, ADCs etc running. But now I come to add a small function that is called near the start of the program, that simply changes GPIO6 from its initial setting as an input, to an output, and sets the output value HIGH.

Simple code, I though... yet although the code looks to be executed and the assembly looks fine, the pin value does not change! :(

What am I doing wrong?? Thanks

Start of my program:

void main (void) {
	DeviceInit();/* Device life support & GPIO */
	#ifdef FLASH
		MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
		InitFlash();
	#endif

	detectSlaveMode();	

	// ... Rest of program follows here...
}

My detectSlaveMode() function definition:

slaveMode slaveModeStatus = undetected;

slaveMode detectSlaveMode (void) {
	slaveMode state = (slaveMode) GpioDataRegs.GPADAT.bit.GPIO7;
	if (state == masterUnit) {
		if (GpioDataRegs.GPADAT.bit.GPIO6 == 0)
			slaveModeStatus = singleUnit;
		else
			slaveModeStatus = state;
	} else if (state == slaveUnit) {
		slaveModeStatus = state;
		GpioCtrlRegs.GPADIR.bit.GPIO6 = 1; /* Change GPIO6 to an output */
		GpioCtrlRegs.GPAPUD.bit.GPIO6 = 0; /* Enable internal pull up. */
		GpioDataRegs.GPASET.bit.GPIO6 = 1; /* Set output HIGH */
	}
	return slaveModeStatus;
}

Lines 11 through 14 execute but the pin state stays at 0...