Forums » Software Development »
How to implement the SetOuput function in the tcDspOutputLatch class for DAC application?
Added by Xiao WANG over 11 years ago
Hello,
I am using the MDK on MityDSP-Pro, the documentation of the on board TLV5610 DAC module says:
The tcDspDacTlv5610 class is used to set up and send data to a TI TLV5610 8-channel D-to-A converter. The converter is accessed via a McBSP interface.
and some lines of exemple code are given, but not completed:
{ // This class controls the MityDSP FPGA, and provides // register interfaces for CS control lines, etc. This // class is generally specific to a MityDSP application. class tcLatch : public tcDspOutputLatch { ... public: typedef enum { ... eeDAC_CS, ... } teOutputs; // This method manages the CS output latch for various devices int SetOuput(unsigned int ID, unsigned int Value); ... } int main (int argc, char *argv[]) { tcLatch Latch; tcDspMcbsp MCBSP(0x018C0000, DATA_DELAY1, // rx_data_delay WORD_LENGTH_16, // rx_word_len RXJUST_RJZF, // rx_justify DATA_DELAY1, // tx_data_delay WORD_LENGTH_16, // tx_word_len FSYNC_MODE_EXT, // rx_fsync FSYNC_MODE_INT, // tx_fsync CLK_MODE_INT, // rx_clock CLK_MODE_INT, // tx_clock FSYNC_POL_HIGH, // rx_fsync_polarity FSYNC_POL_LOW, // tx_fsync_polarity CLKR_POL_FALLING, // rx_clock_polarity CLKX_POL_FALLING, // tx_clock_polarity CSTOP_NODELAY); // clock_stop tcDspDacTlv5610 DAC(&MCBSP, &Latch, tcLatch::eeDAC_CS); ... // Set DAC A output to mid range... DAC.update(tcDspDacTlv5610::eeDAC_A, 2048); } }
I have no idea about how to implement the SetOuput function of the tcLatch class, and I cant find any documentation on it.
Would someone help me? Thanks!
Replies (2)
RE: How to implement the SetOuput function in the tcDspOutputLatch class for DAC application? - Added by Michael Williamson over 11 years ago
The tcDspOutputLatch class is simply an interface class. The tcdspDacTlv5610 class needs to be able to drive the Chip Select pin for the part prior to issuing the SPI clock and data lines via the McBSP. The Chip Select can be any GPIO type implementation and varies from board to board. Most times it is implemented as a GPIO pin using the tcDspGpio class. Other FPGA designs may simply have a register to control the state of the pin. It depends on the IO board you are using. That is why the code is not completed, it depends on your IO board and IO setup.
Normally, you create a simple class that derives from the tcDspOutputLatch interface class and implement a SetOutput method, usually using a single call to tcDspGpio::writePins() to enable or disable the pin.
Are you using a custom board with this class?
RE: How to implement the SetOuput function in the tcDspOutputLatch class for DAC application? - Added by Xiao WANG over 11 years ago
Hi Michael, thanks for your reply.
I am using the MityDSP-PRO Development Kit with the Critical Link provided extention board.
For this board, I dont know which pin to write to select the TLV5610 DAC module.