I have a problem with AT91SAM9260
I'm a newbie of embedded software engineer,and know very little about hardware knowledge.
We have bought one AT91SAM9260-EK board,and buid our board the same with AT91SAM9260-EK
except that the nand flash which was replaced with our KH29LV640DT-B (4M x 16bit) NOR
FLASH.Our NorFlash is 16 bit data bus.
We use AT91SAM9260 NCS6 for the Nor Flash chip select, and the NCS6 bank address is
0x7000 0000. and NCS6 is pin A13(signal name is pc13,that is PIO Controller C 13 pin)'s
peripheral B function.
We use pin A13(signal name is pc13) for our NorFlash's CE#.
We can load and run the U-boot correctly in our board,But we always get the WRONG NorFlash's
Manufacturer ID and Device ID.This is my problem.
I have turned to our hardware engineer,and he is sure that the circuit of the board is
right.
The right Manufacturer ID and Device ID is the same 0xC2, but we always get 0xc.
Below is the main source code of the NorFlash:
#define AT91C_SM_NWE_SETUP (0 << 0)
#define AT91C_SM_NCS_WR_SETUP (0 <<
#define AT91C_SM_NRD_SETUP (0 << 16)
#define AT91C_SM_NCS_RD_SETUP (0 << 24)
#define AT91C_SM_NWE_PULSE (5 << 0) //lingyb Write
#define AT91C_SM_NCS_WR_PULSE (7 <<

//lingyb cs Write
#define AT91C_SM_NRD_PULSE (5 << 16) //lingyb Read
#define AT91C_SM_NCS_RD_PULSE (7 << 24) //lingyb cs Read
#define AT91C_SM_NWE_CYCLE (12 << 0) //lingyb Write
#define AT91C_SM_NRD_CYCLE (12 << 16) //lingyb Read
#define AT91C_SM_TDF (1 << 16)
#define FLASH_BASE 0x70000000
typedef volatile unsigned char vu_char;
unsigned long nor_init (void)
{
vu_char* addr;
/* Configure SMC CS6 */
AT91C_BASE_SMC->SMC_SETUP6 = (AT91C_SM_NWE_SETUP | AT91C_SM_NCS_WR_SETUP |
AT91C_SM_NRD_SETUP | AT91C_SM_NCS_RD_SETUP);
AT91C_BASE_SMC->SMC_PULSE6 = (AT91C_SM_NWE_PULSE | AT91C_SM_NCS_WR_PULSE |
AT91C_SM_NRD_PULSE | AT91C_SM_NCS_RD_PULSE);
AT91C_BASE_SMC->SMC_CYCLE6 = (AT91C_SM_NWE_CYCLE | AT91C_SM_NRD_CYCLE);
AT91C_BASE_SMC->SMC_CTRL6 = (AT91C_SMC_READMODE | AT91C_SMC_WRITEMODE |
AT91C_SMC_NWAITM_NWAIT_DISABLE |
AT91C_SMC_DBW_WIDTH_SIXTEEN_BITS | AT91C_SM_TDF);
/* enable the nor flash chip select */
AT91C_BASE_PIOC->PIO_PDR = AT91C_PIO_PC13;
AT91C_BASE_PIOC->PIO_BSR = AT91C_PIO_PC13;
printf("AT91C_BASE_PIOC->PIO_ABSR & AT91C_PIO_PC13=0x%x \n\r",AT91C_BASE_PIOC->PIO_ABSR &
AT91C_PIO_PC13);//lingyb
printf("AT91C_BASE_PIOC->PIO_PSR & AT91C_PIO_PC13=0x%x \n\r",AT91C_BASE_PIOC->PIO_PSR &
AT91C_PIO_PC13 );//lingyb
/* get manufacturer ID and device ID */
addr = (vu_char*)FLASH_BASE;
addr[0x555] = 0xAA;
addr[0x2aa] = 0x55;
addr[0x555] = 0x90;
ID_manuf = (ulong)addr[0];
ID_device = (ulong)addr[1];
/* restore read mode */
addr[0x0000] = 0xF0;
printf("Manuf. ID @ 0x%08lx: 0x%08lx\n", (ulong)addr, ID_manuf);
printf("Device ID @ 0x%08lx: 0x%08lx\n", (ulong)(&addr[1]), ID_device);
}
I don't known where is wrong. Is it that any step I didn't execute ? or that the timings of
SMC_PULSE6 and SMC_CYCLE6
is wrong? I have try lot's of SMC_PULSE6 and SMC_CYCLE6 timings combinations,but still get
the wrong 0xC Manufacturer ID.
Can anyone help me? I will really really very much appreciate for you!!
Thank you,Thank you very much in advance.