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.

TM4C129ENCPDT: SPI Transmitting with 2msec unknown delay

Part Number: TM4C129ENCPDT

Hi,

I have configured SPI0 and I am able to send data. I have looped back the MOSI and MISO pins and hence reading back the same data on MISO alternatively known as SSI0XDARX.

However When I scope the MOSI Pin, I see there is always consistent delay of 2msec approx between the two transmits. This delay is very huge as I need to collect data from ADC chip AD7609 at 50kHz minimum from all its 8 inputs.

My code is working fine without any errors or warnings and I have attached the code as well as the scope snapshot. The actual problem is shown in the last snapshot.

The SPI0 initialization is as follows;

        // The SSI0 peripheral must be enabled for use.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

        //
        // Configure the pin muxing for SSI0 functions on port A2, A3, A4, and A5.
        // This step is not necessary if your part does not support pin muxing.
        // TODO: change this to select the port/pin you are using.
        //
        GPIOPinConfigure(GPIO_PA2_SSI0CLK);
        GPIOPinConfigure(GPIO_PA3_SSI0FSS);
        GPIOPinConfigure(GPIO_PA4_SSI0RX);
        GPIOPinConfigure(GPIO_PA5_SSI0TX);

        //
        // Configure the GPIO settings for the SSI pins.  This function also gives
        // control of these pins to the SSI hardware.  Consult the data sheet to
        // see which functions are allocated per pin.
        // The pins are assigned as follows:
        //      PA5 - SSI0Tx
        //      PA4 - SSI0Rx
        //      PA3 - SSI0Fss
        //      PA2 - SSI0CLK
        // TODO: change this to select the port/pin you are using.
        //
        GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 |
                       GPIO_PIN_2);

#if defined(TARGET_IS_TM4C129_RA0) ||                                         \
    defined(TARGET_IS_TM4C129_RA1) ||                                         \
    defined(TARGET_IS_TM4C129_RA2)
    SSIConfigSetExpClk(SSI0_BASE, ui32SysClock, SSI_FRF_MOTO_MODE_2,
                       SSI_MODE_MASTER, 1000000, 9);
#else
    SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0,
                       SSI_MODE_MASTER, 1000000, 8);
#endif
    // Enable the SSI0 module.
    //
    SSIEnable(SSI0_BASE);

The routine that is sending the data is bellow;

        for (i = 0;i<8;i++)
        {
            SSIDataPut(SSI0_BASE, i);
            while(SSIBusy(SSI0_BASE)){}
            SSIDataGetNonBlocking(SSI0_BASE, &data); 
            data &=  0x1FF;
            UARTprintf("\r\nch%d = 0x%X", i, data);
        }

As I said I am receiving correctly and is evident in the following Putty snapshot and scope waveform No1.

The above snapshot shows a 9bit transimission of 0b0 0000 0000

The following snapshots shows the real problem where we can see the 2msec of delay between two transmissions.

I would expect the delays should not be more then few micro seconds when the spi clock is running at 1MHz.

Please advise.

Thanks,

Regards,

Sahil