Connect with us

SPI between ADS8344 and HCS12

Discussion in 'Electronic Design' started by [email protected], Jun 12, 2006.

Scroll to continue with content
  1. Guest


    I want to readout the analog to digital converter ADS8344 with the
    microcontroller ChipS12 (9S12C32), but unfortunately I am an absolute
    Beginner in the SPI area.

    I'd expect the µC to send out a square (clock) signal at the SCK port
    after the following code. But it does not... it sticks at zero.

    What is wrong? As long as the ADC doesn't get the clock signal, it
    won't convert any voltage to bits. Is it an error instantly
    identifiable for an SPI expert?

    //Inititalize communication between ADC and æC
    DDRM |= 0x38; // set SS,SCK,MOSI lines of the æC to Output
    SPIBR = bauddiv; // set SPI Rate

    // enable SPI, Master Mode, select clock polarity/phase
    SPICR1 = BM_SPE | BM_MSTR | (cpol ? BM_CPOL : 0) | (cpha ? BM_CPHA :
    SPICR2 = 0; // as default

    // Start SPI communication by sending control byte to the ADC
    PTM = PTM & ~0x08; // Bring SS low to select slave
    SPIDR = 0x86; // start transfer with Startbit - ch0 - SGL - external
    while((SPISR & BM_SPIF) == 0) ; // wait until transfer finished
    PTM = PTM | 0x08; // Bring SS high to deselect slave

    Clearly the µC doesn't get out of the while-loop as long as no
    conversion is being done (which is the case as long as the ADC doesn't
    get the clock signal from the µC).

    I am very thankful for any idea what-so-ever!

    Thanks in advance!
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day