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.

Starterware/TM4C1294NCPDT: EEPROM

Part Number: TM4C1294NCPDT


Tool/software: Starterware

HI,

One of our project we are using TI TM4C1294NCPDT interfacing with EEPROM (LE25U40CQH).

Current issue:

  1. Download code from TI we are writing some data but reading back. Where read data is always 0.

Please find the below code i had used.


#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "driverlib/ssi.h"
#include "utils/uartstdio.h"

//*****************************************************************************
//
//! \addtogroup example_list
//! <h1>UART Echo (uart_echo)</h1>
//!
//! This example application utilizes the UART to echo text. The first UART
//! (connected to the USB debug virtual serial port on the evaluation board)
//! will be configured in 115,200 baud, 8-n-1 mode. All characters received on
//! the UART are transmitted back to the UART.
//*****************************************************************************
#define NUM_SSI_DATA 8 // Number of bytes to send and receive.

//****************************************************************************
//
// System clock rate in Hz.
//
//****************************************************************************
uint32_t g_ui32SysClock;

//*****************************************************************************
//
// The error routine that is called if the driver library encounters an error.
//
//*****************************************************************************
#ifdef DEBUG
void
__error__(char *pcFilename, uint32_t ui32Line)
{
}
#endif

//*****************************************************************************
//
// The UART interrupt handler.
//
//*****************************************************************************
void
UARTIntHandler(void)
{
uint32_t ui32Status;

//
// Get the interrrupt status.
//
ui32Status = ROM_UARTIntStatus(UART3_BASE, true);

//
// Clear the asserted interrupts.
//
ROM_UARTIntClear(UART3_BASE, ui32Status);

//
// Loop while there are characters in the receive FIFO.
//
while(ROM_UARTCharsAvail(UART3_BASE))
{
//
// Read the next character from the UART and write it back to the UART.
//
ROM_UARTCharPutNonBlocking(UART3_BASE,
ROM_UARTCharGetNonBlocking(UART3_BASE));

//
// Blink the LED to show a character transfer is occuring.
//
GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_0, GPIO_PIN_0);

//
// Delay for 1 millisecond. Each SysCtlDelay is about 3 clocks.
//
SysCtlDelay(g_ui32SysClock / (1000 * 3));

//
// Turn off the LED
//
GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_0, 0);
}
}

//*****************************************************************************
//
// Send a string to the UART.
//
//*****************************************************************************
void
UARTSend(const uint8_t *pui8Buffer, uint32_t ui32Count)
{
//
// Loop while there are more characters to send.
//
while(ui32Count--)
{
//
// Write the next character to the UART.
//
ROM_UARTCharPutNonBlocking(UART3_BASE, *pui8Buffer++);
}
}

//*****************************************************************************
//
// This example demonstrates how to send a string of data to the UART.
//
//*****************************************************************************
int
main(void)
{

uint32_t pui32Data[NUM_SSI_DATA];
uint32_t pui32DataTx[NUM_SSI_DATA];
uint32_t pui32DataRx[NUM_SSI_DATA];
//uint32_t* pui32DataRx;
uint32_t ui32Index;
//uint32_t pui32Data[NUM_SSI_DATA];

//
// Set the clocking to run directly from the crystal at 120MHz.
//
g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);

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

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); // GPIO port A needs to be enabled so SSI pins can be used.

GPIOPinConfigure(GPIO_PF3_SSI3CLK); // Configure the SSI SCLK on PA2

GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); // ~CS - configure it as GPIO output

GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); // ~CS - set it to logic HIGH

GPIOPinConfigure(GPIO_PF1_SSI3XDAT0); // Configure the MOSI on PA4

GPIOPinConfigure(GPIO_PF0_SSI3XDAT1); // Configure the MISO on PA5


GPIOPinTypeSSI(GPIO_PORTF_BASE, GPIO_PIN_0| GPIO_PIN_1 | GPIO_PIN_2| GPIO_PIN_3); // Configure the GPIO settings for the SSI pins.


SSIConfigSetExpClk(SSI3_BASE, g_ui32SysClock, SSI_FRF_MOTO_MODE_0, // Configure and enable the SSI port for SPI master mode. Use SSI3,
SSI_MODE_MASTER, 1000000, 8); // system clock supply, idle clock level low and active low clock in
// Freescale SPI mode, master mode, 1 MHz SSI frequency, and 8-bit data.
// For SPI mode, you can set the polarity of the SSI clock when the SSI
// unit is idle. You can also configure what clock edge you want to
// capture data on. Please reference the datasheet for more information on
// the different SPI modes


SSIEnable(SSI3_BASE); // Enable the SSI0 module.

//
// Initialize the data to send.
//


// pui32DataTx[0] = 0x06; // Write data to 0x000000
pui32DataTx[0] = 0x02; //
pui32DataTx[1] = 0x00;
pui32DataTx[2] = 0x00;
pui32DataTx[3] = 0x00;
pui32DataTx[4] = 0x56;
pui32DataTx[5] = 0x57;
pui32DataTx[6] = 0x58;

// dummy byte to generate SCLK for reading 1 byte from MISO


//
// Send 3 bytes of data.
//


// Enable the GPIO port that is used for the on-board LED.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);

//
// Enable the GPIO pins for the LED (PN0).
//
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTQ_BASE, GPIO_PIN_0|GPIO_PIN_1);

//
// Enable the peripherals used by this example.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART3);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);

//
// Enable processor interrupts.
//
//ROM_IntMasterEnable();

//
// Set GPIO A0 and A1 as UART pins.
//
GPIOPinConfigure(GPIO_PJ0_U3RX);
GPIOPinConfigure(GPIO_PJ1_U3TX);
ROM_GPIOPinTypeUART(GPIO_PORTJ_BASE, GPIO_PIN_0 | GPIO_PIN_1);

//
// Configure the UART for 115,200, 8-N-1 operation.
//
ROM_UARTConfigSetExpClk(UART3_BASE, g_ui32SysClock, 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));

//
// Enable the UART interrupt.
//
//ROM_IntEnable(INT_UART3);
//ROM_UARTIntEnable(UART3_BASE, UART_INT_RX | UART_INT_RT);

//
// Prompt for text to be entered.
//
UARTSend((uint8_t *)"\033[2JEnter text: ", 16);

SysCtlDelay(10000000); //delay


//
// Loop forever echoing data through the UART.
//
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0); // ~CS - set it to logic LOW - start of transmission
SysCtlDelay(100);
SSIDataPut(SSI3_BASE, 0x05);

SSIDataGet(SSI3_BASE, &pui32DataRx[0]);

pui32DataRx[0]&=0x00FF;

UARTCharPut(UART3_BASE,pui32DataRx[0]);

SysCtlDelay(100);

GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2,GPIO_PIN_2); // CS High


GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0); // ~CS - set it to logic LOW - start of transmission
SysCtlDelay(1);

for(ui32Index = 0; ui32Index < NUM_SSI_DATA; ui32Index++)
{

SSIDataPut(SSI3_BASE, pui32DataTx[ui32Index]);
// UARTCharPut(UART3_BASE,'A');
SysCtlDelay(10);

//SSIDataGet(SSI3_BASE, &pui32DataRx[ui32Index]);

//pui32DataRx[ui32Index]&=0xFF00;
//UARTCharPut(UART3_BASE,pui32DataRx[ui32Index]);

}

SysCtlDelay(1);

GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2,GPIO_PIN_2); // ~CS - set it to logic HIGH - end of transmission

SysCtlDelay(10000000);

pui32Data[0]=0x03;
pui32Data[1]=0x00;
pui32Data[2]=0x00;
pui32Data[3]=0x00;
pui32Data[4]=0xff;
pui32Data[5]=0xff;
pui32Data[6]=0xff;

GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0); // ~CS - set it to logic LOW - start of transmission
SysCtlDelay(1);

for(ui32Index = 0; ui32Index < NUM_SSI_DATA; ui32Index++)
{

SSIDataPut(SSI3_BASE, pui32Data[ui32Index]);
//UARTCharPut(UART3_BASE,'A');

SSIDataGet(SSI3_BASE, &pui32DataRx[ui32Index]);

pui32DataRx[ui32Index] &=0x00FF;
UARTCharPut(UART3_BASE,pui32DataRx[ui32Index]);
SysCtlDelay(10000000);
}

SysCtlDelay(1);

GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2,GPIO_PIN_2); // ~CS - set it to logic HIGH - end of transmission

GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_0, GPIO_PIN_0);

while(1)
{
UARTCharPut(UART3_BASE,'H');
UARTCharPut(UART3_BASE,'i');
SysCtlDelay(10000000);
GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_1, GPIO_PIN_1);
SysCtlDelay(10000000);
GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_1, 0x0);
}
}

Please suggest

       2. Please check whether is the below schematic interface to EEPROM is fine .

Please seen the schematic in attached file.

 Schematic.docx

Schematic.docx

regards,

Sateesh.