10 Replies Latest reply on Apr 22, 2015 8:41 AM by JoMe_264151

    SPI to 12 bit DAC using -Load signal


        I was able to get a 12 bit dac working with the PSOC.  Painful, but here is how it worked:


         I connected up to a 12 bit dac from the PSoC using the SPI Master unit.


         The 12 bit dac requires the Load signal to go low and then high when the data should be loaded.  You can only send 12 bits at a time to the DAC, 16 bits does not work.


         I was able to accomplish this by connecting tx_interrupt through a NOT gate to a pin.  I then set the "Interrupt on Byte/Word transfer Complete" checkbox.


         I then set the bits to send to 12 bits.


         With this, you do a write to the transmit registe to get things primed.


      uint16 *sp=sineBuffer;




         Then, in  a forever loop, using a sine wave buffer for a test, (the buffer is placed in pointer sp):


              /* Place your application code here. */
              if (SPI_Master_ReadTxStatus() & SPI_Master_STS_SPI_DONE) {
                  if (index >7 ) {


         Now the interesting part.  DMA does not appear to work with a 12 bit SPI, unless I'm missing something. I suppose you could write two 8 bit bytes at incrementing addresses, but the DMA unit does not appear to want to do this unless it is always incrementing, and we only want to write to the transmit register.