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.

MSP430G2121 to DAC5311

Other Parts Discussed in Thread: MSP430G2121, DAC5311

hello,

Connection between MSP430G2121 and DAC5311.

I encouter some incorrect reading, at per below:

1) 0 bits - reading: full voltage of 3.3v ,

2) 255bits - 0V

3) 50bits to 200bits - voltage reading are correct.

Below are my code. Can you pls help to verify?

USICTL0 |= USIPE6 + USIPE5 + USILSB + USIMST + USIOE;  //SJ4130111 - Port
USICTL1 |= USICKPH;
USICKCTL = USISSEL_2;  //SJ4130111 - /1 SMCLK USICNT = USI16B; USICTL0 &= ~USISWRST;  // USI released for operation

duty_cycle = 50;
while (1)
{
    DAC_SYNC_LOW;  //SJ4130111 - Set pin 1.4 to low

    USISRH = (duty_cycle >> 2) & 0x003F;  //High Byte Shift Register - 0000000000111111
    USISRL = (duty_cycle & 0x0003) << 6;  //Low Byte Shift Register - 0000000000000011

    USICNT |= USICNT4;

    gstate_var.sys_timer = 0;
    while (gstate_var.sys_timer <= PWR_UP_DELAY) ;  //SJ3120111 - 500 micro sec delay

    DAC_SYNC_HIGH;  //SJ4130111 - Set P1.4 high

    gstate_var.sys_timer = 0;
    while (gstate_var.sys_timer <= 50000) ;  //SJ3120111 - 1 sec delay

    if (duty_cycle >= 250)  duty_cycle = 50;
    else duty_cycle += 50;
}

 

  • It's possible that you selected the wrong clock phase or polarity. then you might have problems with teh 'last bit' and maybe unpredictable results.

    Also, you wait a fixed time before you deselect the ADC. You should rather check whether the SPI is finished sending all the bits. If you have misconfigured something, it is possible that you interrupt the SPI transfer in its middle. Which may result in an incorrect setting of the DAC or no setting at all.

    Your demo code never sends a value of 0 or 255. The minimum is 50 and the maximum is 250. So how did you encounter these 'incorrect readings')?

    I don't know the device, so I cannot tell what a correct reading would be.