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.

TMS320F280025: SPI Communication configuration problems

Part Number: TMS320F280025
Other Parts Discussed in Thread: BOOSTXL-DRV8323RS, LAUNCHXL-F280025C, DRV8323

Dear Expert:

I am using 280025,I have referred to E2E FAQ on SPI Configuration on Use: https://e2e.ti.com/support/motor-drivers-group/motor-drivers/f/motor-drivers-forum/937258/faq-spi-configuration-and-use?tisearch=e2e-sitesearch&keymatch=faq%3atrue,I configurate the SPI as this articale said.

I have tried to apply the configuration to DRV8323RS and another driver IC(A4911).I connect six signal pins between two boards( eg:“LAUNCHXL-F280025C” boad and “BOOSTXL-DRV8323RS”) borad:Enable(GPIO29),SCLK(GPIO9),SDI/SIMO(GPIO8),SDO/SOMI(GPIO10),CS/STE(GPIO11),GND.The bus voltageVM is powered by a steady 24V voltage.However,I meet writing problems on both two driver ICs.I meet writing problems on both these two driver ICs.

Please don't repeat some useless information such as disconnecting IDRIVE and VDS pins and just floating these two pins,becuase I didn't connect these pins.

The A4911's register strcture:

The SPI configuration code:

GPIO_setPinConfig(GPIO_8_SPIA_SIMO);
GPIO_setPadConfig(8, GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(8, GPIO_QUAL_ASYNC);


GPIO_setPinConfig(GPIO_10_SPIA_SOMI);
GPIO_setPadConfig(10, GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(10, GPIO_QUAL_ASYNC);


GPIO_setPinConfig(GPIO_9_SPIA_CLK);
GPIO_setPadConfig(9, GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(9, GPIO_QUAL_ASYNC);


GPIO_setPinConfig(GPIO_11_SPIA_STE);
GPIO_setPadConfig(11, GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(11, GPIO_QUAL_ASYNC);

HWREGH(base + SPI_O_FFTX) = 0xE040;
HWREGH(base + SPI_O_FFRX) = 0x2044;
HWREGH((base)+SPI_O_FFCT) = 0x0;

//SPI Settings
HWREGH(base + SPI_O_CCR) &= ~(SPI_CCR_SPISWRESET); //SPI Reset On
SPI_setConfig(SPIA_BASE, DEVICE_LSPCLK_FREQ, SPI_PROT_POL0PHA0,SPI_MODE_MASTER, 1000000, 16);
SPI_disableLoopback(base);

HWREGH(base + SPI_O_CTL) &= ~(SPI_CTL_OVERRUNINTENA);
HWREGH(base + SPI_O_CTL) |= SPI_CTL_TALK; //nSCS enabled
HWREGH(base + SPI_O_CTL) &= ~(SPI_CTL_SPIINTENA);

SPI_setEmulationMode(base, SPI_EMULATION_FREE_RUN);
HWREGH(base + SPI_O_CCR) |= SPI_CCR_SPISWRESET;

The read and write function:

uint16_t spi_xmit(uint32_t base,uint16_t spiFrame)

{

SPI_writeDataNonBlocking(base, spiFrame);

//Wait for RX flag to indicate SPI frame completion

while(SPI_getRxFIFOStatus(base)!=1)

{

}

return SPI_readDataNonBlocking(base);

}

uint16_t A4911_spi_read(uint32_t base,uint16_t addr)

{
uint16_t toSend = 0;
toSend = (uint16_t)(((uint32_t)A4911AddrMask & addr) << 11U);
toSend |= (uint16_t)(A4911Read);
luhang1 = toSend;

return spi_xmit(base,toSend);

}

uint16_t A4911_spi_write(uint32_t base,uint16_t addr, uint16_t data)

{
uint16_t toSend = 0;
toSend = (uint16_t)(((uint32_t)A4911AddrMask & addr) << 11U);
toSend |= (uint16_t)(A4911Write);
toSend |= (uint16_t)(((uint32_t)A4911ValueMask & data) << 1U);
luhang2 = toSend;
return spi_xmit(base,toSend);

}

call the function in initialization in main()

InitA1911();
A4911_spi_write(SPIA_BASE,0,12);
A4911_reg = A4911_spi_read(SPIA_BASE,0);

Whatever the data I write in register 0:A4911_spi_write(SPIA_BASE,0,12) orA4911_spi_write(SPIA_BASE,0,8) and so on.I read the same reasult in  SPIRXBUF: 

There is no problem with my board.Did I make mistakes or ignore some detail in my code?Could you give me some advice?I would appreciate that if you could go through my description and give me useful and clear information.

  • Hang,

    A4911_spi_write(SPIA_BASE,0,12) should transmit decimal value of 24. In DRV8323, this means you are writing 24 to address 0x0. Address 0x0 is Fault Status register 1, you cannot write to this register. Did you check whether SPIMOSI to check whether you are indeed transmitting 24? What did you receive back on SPISOMI pin?

    I would encourage you into check the SPI bus (SPICLK, SPIMOSI, SPISOMI, SPISTE pin) using logic analyzer to make sure SPI is indeed doing what you are expecting it to do.

    Regards,

    Manoj

  • Thank you,Mohan.I have found where I ignored.I have solved my problem.