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.

TMS320C6748: Erasing SPI flash failed

Part Number: TMS320C6748
Other Parts Discussed in Thread: OMAP-L138, AM1810

We have used the processor P/N : TMS320C6748EZWTA3 and tried write to the SPI Flash (SPI NOR Flash device P/N: MT25QL128ABA1EW9-0SIT) by connecting emulator with the SPI Writer, we are getting the following error:

Starting OMAP-L138 SPIWriter.
Will you be writing a UBL image? (Y or y)
n
Enter the application file name (enter 'none' to skip):
C:\SecureOut.bin
    INFO: File read complete.
    ERROR: Erasing SPI failed.
SPI Flashing Failed!   

We updated the "device_spi.c" (in path OMAP-L138_FlashAndBootUtils_2_36\OMAP-L138\Common\src) as per the flash device as mentioned below

const Uint32 DEVICE_SPI_baseAddr[SPI_PERIPHERAL_CNT] =
{
(Uint32) SPI0,
(Uint32) SPI1
};

const SPI_ConfigObj DEVICE_SPI_config =
{
1, // polarity
0, // phase
10, // prescalar
8 // charLen
};

// Set SPI config to NULL to use SPI driver defaults
//SPI_ConfigHandle const hDEVICE_SPI_config = NULL;
SPI_ConfigHandle const hDEVICE_SPI_config = (SPI_ConfigHandle) &DEVICE_SPI_config;

const SPI_MEM_ParamsObj DEVICE_SPI_MEM_params =
{
SPI_MEM_TYPE_FLASH,
24, // addrWidth
256, // pageSize
#ifdef AM1810
4096, // sectorSize
#else
0, // sectorSize
#endif
64*1024, // blockSize
16*1024*1024 // memorySize
};

// Set mem params to NULL to enforce autodetect
//SPI_MEM_ParamsHandle const hDEVICE_SPI_MEM_params = NULL;
SPI_MEM_ParamsHandle const hDEVICE_SPI_MEM_params = (SPI_MEM_ParamsHandle) &DEVICE_SPI_MEM_params;

While debugging we found following issue

The hSPIMEMInfo Variable shows in the debugger, that CCS cannot read at the specific adresses. So the problem is, that it does not goes into the erasing and programming section as it always drop out at:

else if (hSPIMemInfo->hMemParams->memType == SPI_MEM_TYPE_FLASH)

In the SPIWriter_DSP.cmd, following is mentioned

-stack 0x00000800 /* Stack Size */
-heap 0x00000800 /* Heap Size */

MEMORY
{
L2RAM org=0x11800000 len=0x00040000 /* DSP L2 RAM */
DRAM org=0xC0000000 len=0x04000000 /* SDRAM */
SHARED_RAM org=0x80000000 len=0x00020000 /* DDR for program */
AEMIF org=0x60000000 len=0x02000000 /* AEMIF CS2 region */
AEMIF_CS3 org=0x62000000 len=0x02000000 /* AEMIF CS3 region */
}

SECTIONS
{
.text :
{
} > SHARED_RAM
.const :
{
} > SHARED_RAM
.bss :
{
} > SHARED_RAM
.far :
{
} > SHARED_RAM
.stack :
{
} > SHARED_RAM
.data :
{
} > SHARED_RAM
.cinit :
{
} > SHARED_RAM
.sysmem :
{
} > SHARED_RAM
.cio :
{
} > SHARED_RAM
.switch :
{
} > SHARED_RAM

.aemif_mem
{
. += 0x1000;
} load = AEMIF, FILL=0x00000000, type=DSECT, START(_NORStart)

.extram
{
. += 0x04000000;
} load = DRAM, FILL=0x00000000, type=DSECT, START(_EXTERNAL_RAM_START), END(_EXTERNAL_RAM_END), SIZE(_EXTERNAL_RAM_SIZE)
}

Please suggest how to fix this issue

Regards,

Prathap V C