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.

TLV5638: Use SPI which simulated by the McBSP module of f28335 to communicate with TLV5638.

Part Number: TLV5638

Dear team:

One of my customer use SPI which simulated by the McBSP module of f28335 to communicate with TLV5638.

Now TLV5638 chip can output DA signal normally, but there is a problem: outa and outb, only one output can be selected, but not two ports at the same time. Configure according to the example of output at the same time in the chip manual, but only the data of outa can be detected. What may be the problem?

Below is the code:

void InitMcbspa16bit(void)
{
    McbspaRegs.RCR1.bit.RWDLEN1=2;      // 16-bit word
    McbspaRegs.XCR1.bit.XWDLEN1=2;      // 16-bit word
}

Uint16 mcbsp_xmit(Uint16 McbspTXD)
{
	Uint16 McbspRXD;
    McbspaRegs.DXR1.all=McbspTXD;//  McbspTXD=v->xxxx,待发送数据
//	McbspaRegs.DXR2.all=McbspTXD;
    
	while(McbspaRegs.SPCR2.bit.XRDY==0){}   //等待变1,表示发送器准备好
	while(McbspaRegs.SPCR2.bit.XEMPTY==1){} //等待变0,表示XSR为空
//	while(McbspaRegs.MFFTX.bit.TXFFST!=0){}

	while(McbspaRegs.SPCR1.bit.RRDY == 0){} //等待变1,表示接收器准备好
//	while(McbspaRegs.SPCR1.bit.RFULL != 1){} //等待RBR退满
//	while(McbspaRegs.MFFRX.bit.RXFFST != 1) {}  //wait for McBSP_SPI receive
	McbspRXD=McbspaRegs.DRR1.all; // 接收到的数据
	return(McbspRXD);
}

Best Regards

void InitMcbspa16bit(void)
{
    McbspaRegs.RCR1.bit.RWDLEN1=2;      // 16-bit word
    McbspaRegs.XCR1.bit.XWDLEN1=2;      // 16-bit word
}
 
Uint16 mcbsp_xmit(Uint16 McbspTXD)
{
       Uint16 McbspRXD;
    McbspaRegs.DXR1.all=McbspTXD;//  McbspTXD=v->xxxx,待发送数据
//     McbspaRegs.DXR2.all=McbspTXD;
   
       while(McbspaRegs.SPCR2.bit.XRDY==0){}   //等待变1,表示发送器准备好
       while(McbspaRegs.SPCR2.bit.XEMPTY==1){} //等待变0,表示XSR为空
//     while(McbspaRegs.MFFTX.bit.TXFFST!=0){}
 
       while(McbspaRegs.SPCR1.bit.RRDY == 0){} //等待变1,表示接收器准备好
//     while(McbspaRegs.SPCR1.bit.RFULL != 1){} //等待RBR退满
//     while(McbspaRegs.MFFRX.bit.RXFFST != 1) {}  //wait for McBSP_SPI receive
       McbspRXD=McbspaRegs.DRR1.all; // 接收到的数据
       return(McbspRXD);
}

  • Hi,

    I am not qualified to review the code you have posted. But to update both DAC, please follow the below procedure. You can write the code accordingly.

    lets assume you want to use internal reference of 1.024V and want to update both DAC A and DAC B.

    1. Set reference voltage to 1.024 V (CONTROL register)

    2. Write data for DAC B to BUFFER

    3. Write new DAC A value and update DAC A and B simultaneously

    Both outputs are updated on the rising clock edge after D0 from the DAC A data word is sampled.

    Regards,

    AK