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.

SSI Tx not Working?

Hi All,

I am currently trying to transmit a 32-bit value to a component that has a SPI port on it. I am using SSI2 on the Tiva C and I set up my write function as below:

void
vco_writeRegister(uint32_t data)
{
	uint8_t* dataPtr = (uint8_t*)&data;
	uint8_t ctr;
	MAP_SSIConfigSetExpClk(VCOSSI_BASE, g_sysClkFreq, SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, VCOSPIFREQ, 8);
	MAP_GPIOPinWrite(MCU_VCO_SPI2_SS4_CS_GPIO_PORT_BASE, MCU_VCO_SPI2_SS4_CS_GPIO_PIN, 0x00);
	for (ctr = 0; ctr < 4; ctr++)
	{
		MAP_SSIDataPut(VCOSSI_BASE, (uint32_t)*dataPtr++);
		while(MAP_SSIBusy(VCOSSI_BASE)){}
	}
	MAP_GPIOPinWrite(MCU_VCO_SPI2_SS4_CS_GPIO_PORT_BASE, MCU_VCO_SPI2_SS4_CS_GPIO_PIN, 0xFF);
}

Do you see anything wrong with it? It hangs in the while SSIBusy loop, and the register values indicate that SSI2 is busy and that the Tx FIFO is not full.

Thanks,

Bryan

  • Hell0 Bryan,

    You have not enabled the SSI. (SSIEnable API call)

    Also if you want to read and make sure data integrity is maintained, then for every SSIDataPut you need to have a SSIDataGet to flush the RX FIFO.

    Regards
    Amit
  • Hello Amit,

    I feel very silly now! I had made a call to SSIEnable in my function where I enabled the SSI2 peripheral. I noticed in the documentation that the SSI port should be configured before it is enabled. I forgot to make another call to SSIEnable after the reconfiguration!

    It is just slightly complicated because I have multiple components on SSI2 that have different clock rates, so I have to constantly configure the clock rate before making writes with it.

    Cheers,
    Bryan
  • Hello Bryan,

    All in a day's work

    Regards
    Amit
  • Bryan Womack said:
    I have to constantly configure the (SPI) clock rate

    Unknown is the "relative/comparative" usage of each of your SPI devices.   When our firm has faced such - we dialed down the MCU - matching the slowest speed w/in our SPI "forest."  This solves your "Reconfiguration Central" demand - but at the cost/burden of "overall reduced SPI speed."   Every case is different - trade-offs are "de rigueur" in this game.

    We note that multiple SPI modules lurk - perhaps the slowest device can "SPI attach" uniquely?   (freeing your other SPI traffic to "blaze away!")

  • Hello Bryan

    Indeed it is more efficient to have the lowest Serial clock rate configured for all devices. Reduces the amount of code calls.

    Regards
    Amit