Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

TMS320F28377S: SPI 24-bit sending issue

$
0
0

Part Number:TMS320F28377S

Hello TI community,

I am currently trying to configure the TMS320F28377S MCU to send 24 bits data stream through the SPIB (GPIO58 to GPIO61). I am understand that the MCU can only send up to 16 bit words; however, it can be configured to send continuous data without delay by configuring the FIFO. I have come up with sending three 8-bit words to achieve my 24-bit data stream. I am working off the spi_loopback (no interrupt) example code from controlSUITE except I set the loop back to 0.

I am monitoring the TX FIFO status register can see the register being incremented up to 2 only. I also can see my values are being written correctly to the transfer buffer. I am also wondering why the receive buffer is being filled as the loop back bit is set to 0? Anyways, I am trying to communicate to a DAC8560() to disable it's internal reference. I can't see to get the internal reference to be disabled. I wrote a simple code for the SPIB. I am wondering what I am doing wrong.

 

#define DAC8560_DISABLE_INT_SEQ_P1 0b0100100000000000       // 8-bit left justified
#define DAC8560_DISABLE_INT_SEQ_P2 0b0000010000000001
#define DAC8560_NORMAL_OP          0b0000000000000000
#define DAC8560_PWR_DWN_1K         0b0000000100000000
#define DAC8560_PWR_DWN_100K       0b0000001000000000
#define DAC8560_PWR_HIGH_Z         0b0000001100000000

volatile struct SPI_REGS *SPI_PTR[SPI_CH] = {&SpiaRegs, &SpibRegs, &SpicRegs};

void disable_int_ref_DAC8560(volatile struct SPI_REGS *SPI)
{
    set_DAC8560(SPI, DAC8560_DISABLE_INT_SEQ_P1, DAC8560_DISABLE_INT_SEQ_P2);
}

void set_DAC8560(volatile struct SPI_REGS *SPI, Uint16 dac8560_op_mode, Uint16 dac_level)
{
    //Uint16 rdata;
    Uint16 sdata[] = {0, 0, 0};
    Uint16 i;
    sdata[0] = dac8560_op_mode;
    sdata[1] = dac_level & 0xFF00;
    sdata[2] = (dac_level & 0x00FF) << 8;

    for(i=0; i<3; i++)
    {
        spi_xmit(SPI, sdata[i]);
    }
}


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>