Note: When the power supply voltage of k9f2g08u0b is 3.3 V, the fclk of the system is 400 MHz, and the hclk is 400/3 = 133 MHz.
1. NAND Flash Controller Initialization
Call nand_init () in the nbl1.lsb NAND function to initialize the NAND flash controller. The following describes this function.
Void nand_init (void)
{
// Initialize NAND Flash Controller for mlc nand Flash
Rnfconf = nf_8bit_ecc | nf_tacls (default_tacls) | nf_twrph0 (default_twrph0) | nf_twrph1 (default_twrph1 );
Rnfcont = nf_main_ecc_lock | nf_spare_ecc_lock | nf_init_mecc | nf_init_secc | nf_nfce1 | nf_nfce0 | nf_nfcon_en;
Rnfstat = nf_rnb_ready; // clear rnb transition detect bit
Rnfconf = rnfconf &~ (1 <30 );
Rnfcont | = (1 <18) | (1 <13) | (1 <12) | (1 <11) | (1 <10) | (1 <9); // ECC for programming. // enable rnb interrupt
Rnfstat | = (1 <6) | (1 <5) | (1 <4 ));
Nand_reset (0 );
}
Where
# Define tacls 3
# Define twrph0 3
# Define twrph1 2
(1) Configure nfconf in the configuration register of NAND Flash
The actual meanings of tacls, twrph0, and twrph1 can be found in the following sequence diagram and nfconf register descriptions.
We can see from the two figures above:
Tacls: the setup time of CLT/ALE ).
Twrph0: the duration of CLE/ALE.
Twrph1: hold time of CLE/ALE ).
We use the relevant sequence diagram below k9f2g08u0b
Based on the above figure, we can know
Tacls is equivalent to the tcls parameter, twrph0 is equivalent to TWP, and twrph1 is equivalent to tclh
Here tacls = 7, namely 3 * 7.5ns = 22.5ns> 12ns; twrph0 = 2, and 2 * 7.5ns = 15ns> 5ns; twrph1 = 3, namely 3 * 7.5ns = 22.5ns> 12ns
From: http://blog.csdn.net/loongembedded/article/details/5939912