I'm trying to set up some GPIO pins as outputs and am having issues when I write to the CLR_DATA register.
Desired pins:
GP6[0-4], GP6[6], GP6[12-13] - all configured as output pins.
Pinmux:
reg: 13, mask: 0x0000FF00, val: 0x00008800
reg: 14, mask: 0x000000F0, val: 0x00000080
reg: 19, mask: 0x0FFFFF00, val: 0x08888800
From the GPIO User's guide (http://focus.ti.com/lit/ug/sprufl8b/sprufl8b.pdf), it says for a GPIO output signal that one should "write a logic 1 to the bit in SET_DATA... to be driven high" and "write a logic 1 to the bit in CLR_DATA... to be driven low." It also states that the OUT_DATA register "contains the current state of the output signals" and that reading IN_DATA "returns the output value being driven by the device."
When I configure the pins above as outputs pins and drive them all to high (by setting the appropriate bit in SET_DATA), I see the following values:
OUT_DATA: 0x0000305F
SET_DATA: 0x0000305F
CLR_DATA: 0x0000305F
IN_DATA: some value, such as 0x0000FFDF, where 0x0000305F is a subset.
However, when I change pin 12 to drive low (by writing 1 to the appropriate bit in CLR_DATA), I see the following values:
OUT_DATA: 0x00000000
SET_DATA: 0x00000000
CLR_DATA: 0x00000000
IN_DATA: 0xFFFFC780
Note that 0xC780 is not a super set of 0x205F. In fact, instead of just pin 12 being driven low, all of my configured pins are now being driven low. Subsequent reads of IN_DATA shows that these pins are constantly changing, i.e. neither driven high or low.
When I use the same logic, except that I am writing or clearing the bit in OUT_DATA only, then the above steps work appropriately.
The second "feature" in the GPIO User's Guide states "Output set/clear functionality through separate data set and clear registers allows multiple software processes to control GPIO signals without critical section protection." I would prefer to use this feature. Is there a problem with writing to CLR_DATA or am I doing something wrong?
Thanks,
Wes