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.

TMS320F28379D: Receive Buffer is reading value sent out via SDI transmit

Part Number: TMS320F28379D


Hello,

I am having an issue with our custom made board that utilizes the TMS320F28379D MCU and the AD4681 ADC. I am attempting to read the data being sent out the ADC when I toggle the CS line, but the receive buffer is reading the SDI dummy instruction I am using to generate the clock signals necessary to push the data out. 

I have checked the connectivity between the lines and did not detect a short between the too. I am able to use a logic probe and verify that the clock signal, SDI, and SDO data look as expected. SDI matches my output command, the clock cleanly generates 16 bits, SDO returns valid data, but the receive buffer doesn't appear to be the value of SDO. My receive buffer will be whatever value I use when transmitting an instruction or dummy command.

Below are some snips of software and I would appreciate a sanity check.

//
// spia_xmit - Transmit value via SPI
//
void spia_xmit(Uint16 a)
{
SpiaRegs.SPITXBUF = a;
}


//
// InitSpiaGpio - Initialize Spia GPIOs
//
void InitSpiaGpio()
{

// Initialize SPI-A

// Set reset low before configuration changes
// Clock polarity (0 == rising, 1 == falling)
// 16-bit character
// Enable loop-back
SpiaRegs.SPICCR.bit.SPISWRESET = 0;
SpiaRegs.SPICCR.bit.CLKPOLARITY = 0;
SpiaRegs.SPICCR.bit.SPICHAR = (16-1);
SpiaRegs.SPICCR.bit.SPILBK = 1;

// Enable master (0 == slave, 1 == master)
// Enable transmission (Talk)
// Clock phase (0 == normal, 1 == delayed)
// SPI interrupts are disabled
SpiaRegs.SPICTL.bit.MASTER_SLAVE = 1;
SpiaRegs.SPICTL.bit.TALK = 1;
SpiaRegs.SPICTL.bit.CLK_PHASE = 0;
SpiaRegs.SPICTL.bit.SPIINTENA = 0;


EALLOW;

//
// Enable internal pull-up for the selected pins
//
// Pull-ups can be enabled or disabled by the user.
// This will enable the pullups for the specified pins.
// Comment out other unwanted lines.
//
GpioCtrlRegs.GPAPUD.bit.GPIO16 = 0; // Enable pull-up on GPIO16 (SPISIMOA)
GpioCtrlRegs.GPAPUD.bit.GPIO17 = 0; // Enable pull-up on GPIO17 (SPISOMIA)
GpioCtrlRegs.GPAPUD.bit.GPIO18 = 0; // Enable pull-up on GPIO18 (SPICLKA)
// GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0; // Enable pull-up on GPIO19 (SPISTEA)

//
// Set qualification for selected pins to asynch only
//
// This will select asynch (no qualification) for the selected pins.
// Comment out other unwanted lines.
//
GpioCtrlRegs.GPAQSEL2.bit.GPIO16 = 3; // Asynch input GPIO16 (SPISIMOA)
GpioCtrlRegs.GPAQSEL2.bit.GPIO17 = 3; // Asynch input GPIO17 (SPISOMIA)
GpioCtrlRegs.GPAQSEL2.bit.GPIO18 = 3; // Asynch input GPIO18 (SPICLKA)
// GpioCtrlRegs.GPAQSEL2.bit.GPIO19 = 3; // Asynch input GPIO19 (SPISTEA)

//
//Configure SPI-A pins using GPIO regs
//
// This specifies which of the possible GPIO pins will be SPI functional
// pins.
// Comment out other unwanted lines.
//
GpioCtrlRegs.GPAMUX2.bit.GPIO16 = 1; // Configure GPIO16 as SPISIMOA
GpioCtrlRegs.GPAMUX2.bit.GPIO17 = 1; // Configure GPIO17 as SPISOMIA
GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 1; // Configure GPIO18 as SPICLKA
// GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 1; // Configure GPIO19 as SPISTEA

// Configure GPIO19 as Output
GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 0x00;
GpioCtrlRegs.GPADIR.bit.GPIO19 = 0xFF;
GpioDataRegs.GPASET.bit.GPIO19 = 1;

EDIS;
}

Main code:

...

GpioDataRegs.GPACLEAR.bit.GPIO19 = 0xFF;
delay_loop();

adcCMD = 0b0000000000000001;
spia_xmit(adcCMD);
delay_loop();

while(SpiaRegs.SPIFFRX.bit.RXFFST !=1) {
rdata = SpiaRegs.SPIRXBUF;
}

GpioDataRegs.GPASET.bit.GPIO19 = 1;
delay_loop();

...

Would appreciate any feedback or questions to help get to the bottom of the problem. Thank you.