I am using TMS320F28335 DSP for motor control.
In this DSP, 4 kHz control rate is implemented by the CPU timer interrupt. And then, SCI (PC to DSP), SPI (for TLV5638), 2 QEP (to obtain motor position) are also implemented in the 4 kHz control rate of the DSP.
The problem is a DAC function (TLV 5638), sometimes output of the TLV5638 goes to 0 V when two outputs are used.
It seems to be random when i observed this problem.
To solve it, I changed a lot of things such as using external ref. voltage, using external 5V VDD, decrease SPI speed, increase delay time, etc.
Due to these efforts, time interval of 0V problem is reduced, but it is not perfectly solved.
The remain problem is that 0V response still occurred randomly and is about 250 us when the control rate is 4 kHz.
It looks like that sometimes a command (Write data DAC A and update DAC B with BUFFER content) is not working because about 250 us is a period of the 4 kHz control rate.
When i write a command (Write data DAC A and update DAC B with BUFFER content) twice with fast mode/normal operation value, 0V time interval is reduced about 40 us.
About 40 us is my best results. but, still, i did not solve it.
I wonder whether the TLV5638 chip has a flaw or not.
Anyone have an experience of it?
please let me know what do i do to operate TLV5638 perfectly!
Please give me answer (how to design TLV5638 circuit and related codes).
I did my best, and about 40 us of 0 V is still remained problem.
p.s> Why internal ref. voltage occur the problem (similar to shut down of the TLV5638 chip)
Followings are parts of my code.
====================================================================
TLV5638 part
====================================================================
//////// Initialization (using Ext. rev. because internal ref. more aggravate 0V problem.)
// Data is output on falling edge and input on rising edge
SpiaRegs.SPICCR.bit.CLKPOLARITY = 1;
// 16-bit character, Loopback mode Disable (초기값)
SpiaRegs.SPICCR.bit.SPICHAR = 15;
// phase delay
SpiaRegs.SPICTL.bit.CLK_PHASE = 1;
// Master
SpiaRegs.SPICTL.bit.MASTER_SLAVE = 1;
// Enable Transmission
SpiaRegs.SPICTL.bit.TALK = 1;
SpiaRegs.SPIBRR = 23; // Baud rate, 150M/24 = 6.25 Mbps
//////////////////////// Update code
// DAC B: Write data to BUFFER
v->ContRegister = 0x5000; // 0101(2) = Write Data to Buffer
v->DataRegisterB &= 0x0FFF;
v->Output = v->ContRegister | v->DataRegisterB;
while (SpiaRegs.SPISTS.bit.BUFFULL_FLAG);
DELAY_US(DELAY_LENGTH);
// Transmit data to DAC-Buffer
SpiaRegs.SPITXBUF = v->Output;
// Write data to DAC A and update DAC B with BUFFER content
v->ContRegister = 0x8000; // 1000(2) = Write Data to DAC A and Update DAC B with Buffer Content
// 상위 4bit 는 0으로 처리
v->DataRegisterA &= 0x0FFF;
v->Output = v->ContRegister | v->DataRegisterA;
while (SpiaRegs.SPISTS.bit.BUFFULL_FLAG);
// Wait for DAC to finish off
DELAY_US(DELAY_LENGTH);
// Transmit data to DAC-A and update DAC-B with Buffer
SpiaRegs.SPITXBUF = v->Output;
while (SpiaRegs.SPISTS.bit.BUFFULL_FLAG);
// Wait for DAC to finish off
DELAY_US(DELAY_LENGTH);
// Transmit data to DAC-A and update DAC-B with Buffer
SpiaRegs.SPITXBUF = v->Output;
=================================== main.c ===============================================
========= Only show DAC codes =============================
interrupt void cpu_timer0_isr(void)
{
////////////////////////////////////////////////////////////////////
DAC.DataRegisterA = TestDataA;
DAC.DataRegisterB = TestDataB--;
DAC.update(&DAC);
//////////////////////
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE
}
//============================================================================================
