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.

Write/Read some data to external NAND flash , cmdWrite is failed

If write/read some data to external NAND flash as below , write to LCD will be failed.

Could you give me any suggestion?

Error message:

C55xx: Can't Single Step Target Program: (Error -2130 @ 0x400) Unable to access device memory. Verify that the memory address is in valid memory. If error persists, confirm configuration, power-cycle board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 5.1.232.0)
C55xx: Trouble Reading Register PC: (Error -1143 @ 0x0) Device core was hung. The debugger has forced the device to a ready state and recovered debug control, but your application's state is now corrupt. You should have limited access to memory and registers, but you may need to reset the device to debug further. (Emulation package 5.1.232.0)

--------------------------------------------------------------

WriteToNAND()

{

/* The following setup is required for QT when accessing EMIF */
/* Setup pin-mapping (Serial Port 0 pins configured as GPIO) */
PeripheralPinMapping(PERIPH_BUS_S0_MMCSD0, PERIPH_BUS_S1_MMCSD1, PERIPH_BUS_PP_GPIO_SPI_I2S2_3);
//PeripheralPinMapping(PERIPH_BUS_S0_MMCSD0, PERIPH_BUS_S1_MMCSD1, PERIPH_BUS_PP_GPIO_SPI_UART_I2S2);
/* Enable SPI Clock */
PeripheralClkEnableOnly(PERIPH_CLK_MASTER_CLK | PERIPH_CLK_SPI);

vSPI_INIT(25);

spi_read_id(flash_id);

spi_eeprom_read_n_words(0x800169A2,g_u16_buffer,12);

// Write to LCD is failed

cmdWrite(0x15, 0);

}

void cmdWrite(Uint16 cmd, Uint16 cs_flag)
{

if (!cs_flag)
{
//temp = LIDD_CS0_ADDR;
LIDD_CS0_ADDR = cmd;
}
else
{
//temp = LIDD_CS0_ADDR;
LIDD_CS1_ADDR = cmd;
}
}