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: quad spi interfacing problem with flash(s70fl01gs)

Part Number: TM4C129ENCPDT

hi,

below i have attached my code to write data into flash through quad spi.but am not able to see any data writting to device.kindly check code and come back


 * main.c
 */


#include <stdbool.h>
    #include <stdint.h>
    #include "inc/hw_memmap.h"
    #include "driverlib/debug.h"
    #include "driverlib/gpio.h"
    #include "driverlib/rom.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/ssi.h"
    #include "driverlib/adc.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/uart.h"

    #include "inc/hw_ints.h"















int main(void) {
    
int i;
    uint32_t ui32SysClk, ui32Index,data_page[20],ID_Check;
            uint32_t rx_data[20] = 0x00;
            // define data that you want to receive
            uint32_t ui32Trash, ID_check;
            // set the system clock to be 25MHz
            ui32SysClk = SysCtlClockFreqSet(SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_25MHZ, 25000000);
              //spiinit();
             // data();




            SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);
                        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);
                        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);


                        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
                                    GPIOPinConfigure(GPIO_PP1_SSI3XDAT3);
                                    GPIOPinConfigure(GPIO_PP0_SSI3XDAT2);
                                    GPIOPinConfigure(GPIO_PF0_SSI3XDAT1);
                                    GPIOPinConfigure(GPIO_PF1_SSI3XDAT0);
                                    GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_0 | GPIO_PIN_1);
                                    GPIOPinWrite(GPIO_PORTL_BASE,
                                                             GPIO_PIN_0,0XFF);

                                              GPIOPinWrite(GPIO_PORTL_BASE,
                                                             GPIO_PIN_0,0XFF);
                                    GPIOPinConfigure(GPIO_PF3_SSI3CLK);
                                    // Enable GPIO Ports pin types as SPI
                                    GPIOPinTypeSSI(GPIO_PORTP_BASE,(GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_3));
                                    GPIOPinTypeSSI(GPIO_PORTF_BASE,GPIO_PIN_3);
                                    // Provide colck to the module.
                                    SSIConfigSetExpClk(SSI3_BASE, 120000000, SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
                                    SSIAdvModeSet(SSI3_BASE,SSI_ADV_MODE_QUAD_WRITE);
                                    //SSIAdvFrameHoldEnable(SSI3_BASE);
                                    SSIEnable(SSI3_BASE);
              GPIOPinWrite(GPIO_PORTL_BASE,
                             GPIO_PIN_0,0XFF);

              GPIOPinWrite(GPIO_PORTL_BASE,
                             GPIO_PIN_1,0XFF);


              GPIOPinWrite(GPIO_PORTL_BASE,GPIO_PIN_0,0X00);

              SSIDataPut(SSI3_BASE,0x06);

              GPIOPinWrite(GPIO_PORTL_BASE,GPIO_PIN_0,0XFF);
              uint32_t getstatus;

              GPIOPinWrite(GPIO_PORTL_BASE,GPIO_PIN_0,0X00);
                        SSIAdvModeSet(SSI3_BASE, SSI_ADV_MODE_WRITE);
                        

                        //SSIAdvModeSet(ui32Base,SSI_ADV_MODE_WRITE);
                        //SSIAdvFrameHoldEnable(SSI3_BASE);

                        SSIDataPut(SSI3_BASE,0x02);  // send the Page Program Command

                      GPIOPinWrite(GPIO_PORTL_BASE,GPIO_PIN_0,0XFF);

                      GPIOPinWrite(GPIO_PORTL_BASE,GPIO_PIN_0,0X00);
                        SSIDataPut(SSI3_BASE, (0 >> 16) & 0xff);
                        SSIDataPut(SSI3_BASE, (0 >> 8) & 0xff);
                        SSIDataPut(SSI3_BASE, 0 & 0xff);

                        //high chip select

                      GPIOPinWrite(GPIO_PORTL_BASE,GPIO_PIN_0,0XFF);


                    GPIOPinWrite(GPIO_PORTL_BASE,GPIO_PIN_0,0X00);

for(i=0;i<100;i++)
{
                   SSIDataPut(SSI3_BASE,0xFF);
                   while(SSIBusy(SSI3_BASE));


}

GPIOPinWrite(GPIO_PORTL_BASE,GPIO_PIN_0,0XFF);





















    return 0;
}

  • Rajeswaran natarajan said:
    am not able to see any data writting to device.

    What does this mean? Have you checked with an oscilloscope? If so what do you see?

    Robert

  • We checked in the Oscilloscope SSI Clk and Data out from the processor and its fine. But when I try to read from the flash memory, the Data in signal is not available, when I try to look in the oscilloscope. Also when I execute SSIDataGet API, system goes to fault ISR.
  • Hello,
    The code you posted is quite confusing, it is difficult to look at it and try to help. Please organize it in blocks, clearly showing - first to yourself - what each block does (such as SPI initialization, writing data to the external device, reading data from, etc).
    When posting code here, use the </> button in the rich formatting option, so that others can more clearly read it.
    Finally, you mention that SSIDataGet goes to fault ISR but there is no such call in your code...
    I believe that the right help for you at the moment is that you "organize your problem". Write down what you want to do, make a little check list of what you tested already... do you see SSI pulses going out? Are they on the MOSI line? Are both sides connected properly? Do you see SSI clock going out? Did you check the proper behavior of the CS line? After all that, do you see SSI coming in from the memory?
    As for the non-existing SSIDataGet, you are probably trying to write the SSI bits into a wrongly referenced memory location.
    Regards
    Bruno
  • Posters Robert & Bruno provide "sound" advice/guidance.

    Bruno's (bit long ... [look who is talking]) guidance may be summarized (thus reduced) via, 'KISS!" (that term - banned in Boston & here - in both cases - for "unexplained reason.")

    The earlier noted "SSIDataGet()" should "follow on the heels of "SSIDataPut()" - and in fact - Slave data should be output during the SPI clocks produced under "SSIDataPut()". (note those data bits - output by the Slave - during SSIDataPut() - are NOT in response to that current "Put." (i.e. provide data in response to, "one Put earlier.")

    Most always - rather than relying upon "Poster Assurances, "All is Well" - your provision of Recent Scope Captures - w/each signal line clearly marked/noted - along w/operating conditions which "yielded that capture" greatly enable your (always) humble "Outsider Support Crüe." (perhaps should be noted - past few days "outside" proves (almost exclusively) your support crüe!)