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.

TM4C129X SSIDataPut error

Hi All,

now, I use the TM4C129X platform, and I found some problems.

    //
    // Run from the PLL at 120 MHz.
    //
    g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                             SYSCTL_OSC_MAIN |
                                             SYSCTL_USE_PLL |
                                             SYSCTL_CFG_VCO_480),120000000);

#define SPI_RATE 1000000

#define MRFI_SPI_INIT()                                                       \
st (                                                                          \
  MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);                             \
  MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);                            \
  MAP_GPIOPinConfigure(GPIO_PA2_SSI0CLK);                                     \
  MAP_GPIOPinConfigure(GPIO_PA3_SSI0FSS);                                     \
  MAP_GPIOPinConfigure(GPIO_PA4_SSI0XDAT0);                                   \
  MAP_GPIOPinConfigure(GPIO_PA5_SSI0XDAT1);                                   \
  MAP_GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 |GPIO_PIN_3| GPIO_PIN_2);  \
  MAP_SSIConfigSetExpClk(SSI0_BASE, MAP_SysCtlClockGet(),                     \
                         SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, SPI_RATE, 8);  \
  MAP_SSIEnable(SSI0_BASE);                                                   \
  {                                                                           \
      unsigned long ulTemp;                                                   \
      while(MAP_SSIDataGetNonBlocking(SSI0_BASE, &ulTemp))                    \
      {                                                                       \
      }                                                                       \
  }                                                                           \
                                                                              \
  MAP_IntMasterEnable();                                 \
)

this is my SPI_INIT part, than

MAP_SSIDataPut(SSI0_BASE, 0x32);

MAP_SSIDataGet(SSI0_BASE, &ulTemp);

the questions is when I do SSIDataPut, the SSI0DR remain 0x00000000, this means write operation are not work normally, but the Oscilloscope can watch the SCLK and MOSI wave do well.  and I don't know why...

  • Hello Wenrui,

    The function MAP_SysCtlClockGet() does not work for TM4C129. Instead use the variable g_ui32SysClock.

    As for the Data register, it is a entry register, i.e. a write will write the data to the TXFIFO and a read will move the data from RXFIFO. Hence what you receive on MISO is what will come in the SSI0DR.

    Regards
    Amit
  • Hello Amit
    I use the g_ui32SysClock instead of the MAP_SysCtlClockGet() , when do SSIDataPut(SSI0_BASE,0x32),it return TRUE, but next do the MAP_SSIDataGet(SSI0_BASE, &ulTemp); the program is hang, becauseThis function gets received data from the receive FIFO of the specified SSI module and places
    that data into the location specified by the pui32Data parameter. If there is no data available,
    this function waits until data is received before returning.so I think write is not successful,write operation have no influence with some flag bit, so the SSIDataGet function think it's a empty FIFO, so will wait.......
    how can I confirm write operation is successful?
  • Hello Wenrui,

    Does the debugger have any window open which maps the peripheral register. If yes, then please close all such windows.

    Regards
    Amit
  • Hi Amit
    it works, when I close all windows, the SSIDataGet() function can go through, but I use the oscilloscope to see the MISO wave .just nothing, this means no data are received into RXFIFO, I don't know why, Does the SPI_INIT() function somewhere wrong?
    Thank you for your time and effort!!!
  • Hello Wenrui,

    Just as I suspected. When the memory/peripheral browsers are open, the data is read by the debugger instead of the CPU causing a stall. The MISO is a function of the slave. Make sure that the CS is correctly held low by the Master as expected by the Slave.

    Regards
    Amit