Other Parts Discussed in Thread: OPA333, MSP-TS430DL48
I am well versed in setting up the SD16 on the F2013 uC. The same strategy does not seem to work on the F4270, therefore I need some clarification on the proper method to set up the ports.
What is known:
a) There are a total of 4 differential inputs on P1.x identified as A2-A4 which are selected by the SD16INChx bits. Therefore to select the A4 channel the following setting is made:
SD16INCTL0 |= SD16INCH_4
/* SD16 Input Channel select A4 */(Note in this case input pair on P1.2 and P1.3)
b) The SD16 inputs are distributed between ports P1.x and P6.x.
For P1.2-P1.7 are listed on datasheet pages 40-44 and are activated by SD16AEx.
For P6.0-P6.3 are listed on datasheet pages 50-51 and are activated by P6SELx.
Comment 1) what is gleaned from above is that just P1.x ports are the only ports that can access an internal ground to Vss--I assume this unless otherwise instructed.
b) Thus, to set up a P1.x port for a read, one must use SD16AEx.
The header file lists the following:
/* SD16AE */
#define SD16AE0 (0x0001) /* SD16 External Input Enable 0 */
#define SD16AE1 (0x0002) /* SD16 External Input Enable 1 */
#define SD16AE2 (0x0004) /* SD16 External Input Enable 2 */
#define SD16AE3 (0x0008) /* SD16 External Input Enable 3 */
#define SD16AE4 (0x0010) /* SD16 External Input Enable 4 */
#define SD16AE5 (0x0020) /* SD16 External Input Enable 5 */
#define SD16AE6 (0x0040) /* SD16 External Input Enable 6 */
#define SD16AE7 (0x0080) /* SD16 External Input Enable 7 */
Question 1) It is not clear how SD16AEx relates to the exact port to select. For example, to select the P1.3 as A4+ input, with P1.2 free to be a GPIO, therefore A4- is internally grounded to Vss. It seems logical that one would select SD16AE6, or is it SD16AE1 ?, there are too many variables here to experiment with, can someone that actually has set up the F4270 device share their knowledge?
Comment 2)
a) I have set SD16AE to both 0x00 (should not read at all!), and 0xFF, and most permutations in between, and the reading is always the same in the SD16MEM register (about 4.7mV low at input of 0.2965VDC). This is confusing and indicates that something is wrong, I have attempted a different uC.
b) If I alter the input the error is proportional to the change of voltage on the input (thus, SD16 is reading, but not correct).
c) By checking the offset (offset binary mode), it is very small thus error is not here. By reading Vref, SD16MEM=0xFFFF, appears not to be gain error.
d) By reading the ground of the input voltage, there is some error, but not enough to account for the error of the incorrect reading.
d) I have attempted to do both single and continuous reads with similar results.
Here is my initiation:
SD16CTL = SD16REFON + SD16SSEL_2;
SD16CCTL0 = SD16UNI + SD16SC;
SD16INCTL0 = SD16INCH_4;
SD16AE = SD16AE6;
SD16CCTL0 |= SD16SC + SD16IE;// the interrupt is activated for a read by the WDT in interval mode at one second interval mode (thus for a single read, lots of time for the cap to charge in the SD16) and interrupt disabled after read of SD16MEM in the SD16 ISR.
Hope to get some good help here :)