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.

ADS7871 I/O ports Output troubles

Other Parts Discussed in Thread: ADS7871

I am using an ADS7871.  I would like the I/O port be configured for output to control the counter that tells the ADC when to start.  I can read and write to all registers except register 5 (Digitial I/O state).  I've read the datasheet 3 times to see if I missed something.  On page 26 2nd paragraph it states that you cannot control the state of the I/O port if it is in input (default) mode.  I make sure to write to the I/O control register (6) 1st (I turn them all to output 0x0F) then I read every register I write to to confirm it was written.  

I cannot write to register 5.  I can read (all zeros) but cannot write.  I've even watched the port during this portion of code to see if the port went hi.  It did not...

  • Any ideas on this one guys?  Each chip does the same thing.

  • Hi Michael,

    Sorry for the delay. A few questions:

    - Just to be clear, do you read the correct value from reg address 6 after you've written to it?
    - What do you have connected to the ADC IO pins on your board? Could you post a schematic showing the ADC block?
    - Are you using any special operating modes; 16 bit R/W, CS always low, etc.?
    - Could you also share the part of your code where you configure the ADC registers and exercise the GPIOs?

    Any other data or scope plots that you've gathered and would like to share would be helpful.

    Best Regards,
    Harsha Munikoti

  • Welp I'm just as late responding as you.  I've blue wired a GPIO from my MSP430 to get around the problem, but few blue wires the better...

    Do I read the correct value from reg 6?  Yes.  I write 0x00 to it expecting all ports to be output.

    What is connected to ADC IO?  A counter.  It resets the counter when the conversion is complete.

    CS is always low (GND).  I'm using biniary mode 14-bit ADC.

    Code to initADC()

    void initADC(void) {

    unsigned char read=0;

    //write Serial Control register
    write8ADC (0x18, 0x00);

    //write ADC Control Register
    write8ADC (0x03, 0x20);

    //write gain/MUX register
    write8ADC(0x04, 0x0D);

    //write DIO CTRL register
    write8ADC(0x06, 0x00);
    read = read8ADC(0x06);
    while (read!=0x00);

    //write REF/OSC register
    write8ADC(0x07, 0x0C);

    //write DIO register
    // write8ADC(0x05, 0x0F);
    }

    void write8ADC (unsigned char addr, unsigned char write) {
    unsigned char value;
    do {
    syncADC();

    while (!(UCA0IFG&UCTXIFG)); //wait for TX buffer to be ready
    UCA0TXBUF = addr; //address
    while (!(UCA0IFG&UCTXIFG)); //wait for TX buffer to be ready
    UCA0TXBUF = write; //binary output


    //confirm write happened
    value = read8ADC(addr);
    } while (value != write); //trap if value didn't write

    }

    void syncADC(void) {
    unsigned char i;

    //sync ADC
    for(i=0; i<6; i++) {
    while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
    UCA0TXBUF = 0x00;
    }
    while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
    UCA0TXBUF = 0x01;
    }

    7382.DTRA ADC.pdf

  • Hi Michael,

    I've ordered an EVM for this product to replicate the issue you're having. In the meantime, for debugging purposes, can you try connecting /CS to a digital output on your MSP430 instead of GND? Most SPI interfaces need /CS to be able to toggle in order to reliably start and end SPI transactions.

    I also noticed that you're programming reg 0x6 to 0 which would configure all GPIOs as inputs. Reg 0x6 should be set to 0xF to program GPIOs as outputs.

    Please make sure that VOH and VOL are set correctly on the uC and that there isn't excessive ringing on the part's SPI inputs (esp SCLK) which can cause the part to reset. It would be a good idea to add 50 to 100 ohm series resistors to the SPI lines to limit the slew rate of the input signals and alleviate any ringing problems. You can also try decreasing SCLK frequency for limiting its slew rate.

    Once you've written the correct value to reg 0x06, I'd recommend reading back the contents multiple times to ensure data integrity before writing to reg 0x05 to toggle the outputs. Please let me know if you observe a change in your results.

    Best Regards,
    Harsha

  • Thank you Harsha,

    I thought you'd comment on the value of reg 6 right after I sent it.  You see I blue wired I_O0 to an MSP430 I/0 and therefor wanted to see high impedance from the ADC which is why it was set to input.  I have tried setting reg6 to 0x0F and 0xFF with no success.  I will take a board and connect /CS to an GIO and see what happens, but on page 18 Reset section last paragraph states:

    For applications where CS cannot be cycled and system synchronization is lost, the ADS7871 must be reset
    by writing 39 zeros and a one. The serial interface is then ready to accept the next command byte. This string
    length is based on the worst case conditions to ensure that the device is synchronized.

    Hence my syncADC() function.  I read reg6 twice before attempting to write to it, and according to the note on the same page that ringing would be masked by scope probes meaning it should work when I'm probing on the signals to watch its communication.

    But let's debug...

    1.  Change reg6 to 0xF and try again.

    2.  Connect /CS to GIO and try again.

    3.  Probe SCLK, MOSI, MISO, and /CS to confirm proper interaction.

    4.  Read reg6 many times before writing to reg5.

    and...hike!

    BTW...I'm using CC4305137 and CCS6.0.0.00190, not that this is a 430 problem.