diff options
Diffstat (limited to 'examples/mimxrt1062-evk/src/lib.rs')
| -rw-r--r-- | examples/mimxrt1062-evk/src/lib.rs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/examples/mimxrt1062-evk/src/lib.rs b/examples/mimxrt1062-evk/src/lib.rs new file mode 100644 index 000000000..3f99f9db3 --- /dev/null +++ b/examples/mimxrt1062-evk/src/lib.rs | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | //! FlexSPI configuration block (FCB) for the iMXRT1060-EVK | ||
| 2 | //! | ||
| 3 | //! This uses IS25WP QuadSPI flash. | ||
| 4 | |||
| 5 | #![no_std] | ||
| 6 | |||
| 7 | use imxrt_boot_gen::flexspi::opcodes::sdr::*; | ||
| 8 | use imxrt_boot_gen::flexspi::{self, FlashPadType, ReadSampleClockSource, SerialClockFrequency, SerialFlashRegion, *}; | ||
| 9 | use imxrt_boot_gen::serial_flash::*; | ||
| 10 | pub use nor::ConfigurationBlock; | ||
| 11 | |||
| 12 | const SEQ_READ: Sequence = SequenceBuilder::new() | ||
| 13 | .instr(Instr::new(CMD, Pads::One, 0xEB)) | ||
| 14 | .instr(Instr::new(RADDR, Pads::Four, 0x18)) | ||
| 15 | .instr(Instr::new(DUMMY, Pads::Four, 0x06)) | ||
| 16 | .instr(Instr::new(READ, Pads::Four, 0x04)) | ||
| 17 | .build(); | ||
| 18 | const SEQ_READ_STATUS: Sequence = SequenceBuilder::new() | ||
| 19 | .instr(Instr::new(CMD, Pads::One, 0x05)) | ||
| 20 | .instr(Instr::new(READ, Pads::One, 0x04)) | ||
| 21 | .build(); | ||
| 22 | const SEQ_WRITE_ENABLE: Sequence = SequenceBuilder::new().instr(Instr::new(CMD, Pads::One, 0x06)).build(); | ||
| 23 | const SEQ_ERASE_SECTOR: Sequence = SequenceBuilder::new() | ||
| 24 | .instr(Instr::new(CMD, Pads::One, 0x20)) | ||
| 25 | .instr(Instr::new(RADDR, Pads::One, 0x18)) | ||
| 26 | .build(); | ||
| 27 | const SEQ_PAGE_PROGRAM: Sequence = SequenceBuilder::new() | ||
| 28 | .instr(Instr::new(CMD, Pads::One, 0x02)) | ||
| 29 | .instr(Instr::new(RADDR, Pads::One, 0x18)) | ||
| 30 | .instr(Instr::new(WRITE, Pads::One, 0x04)) | ||
| 31 | .build(); | ||
| 32 | const SEQ_CHIP_ERASE: Sequence = SequenceBuilder::new().instr(Instr::new(CMD, Pads::One, 0x60)).build(); | ||
| 33 | |||
| 34 | const LUT: LookupTable = LookupTable::new() | ||
| 35 | .command(Command::Read, SEQ_READ) | ||
| 36 | .command(Command::ReadStatus, SEQ_READ_STATUS) | ||
| 37 | .command(Command::WriteEnable, SEQ_WRITE_ENABLE) | ||
| 38 | .command(Command::EraseSector, SEQ_ERASE_SECTOR) | ||
| 39 | .command(Command::PageProgram, SEQ_PAGE_PROGRAM) | ||
| 40 | .command(Command::ChipErase, SEQ_CHIP_ERASE); | ||
| 41 | |||
| 42 | const COMMON_CONFIGURATION_BLOCK: flexspi::ConfigurationBlock = flexspi::ConfigurationBlock::new(LUT) | ||
| 43 | .version(Version::new(1, 4, 0)) | ||
| 44 | .read_sample_clk_src(ReadSampleClockSource::LoopbackFromDQSPad) | ||
| 45 | .cs_hold_time(3) | ||
| 46 | .cs_setup_time(3) | ||
| 47 | .controller_misc_options(0x10) | ||
| 48 | .serial_flash_pad_type(FlashPadType::Quad) | ||
| 49 | .serial_clk_freq(SerialClockFrequency::MHz133) | ||
| 50 | .flash_size(SerialFlashRegion::A1, 8 * 1024 * 1024); | ||
| 51 | |||
| 52 | pub const SERIAL_NOR_CONFIGURATION_BLOCK: nor::ConfigurationBlock = | ||
| 53 | nor::ConfigurationBlock::new(COMMON_CONFIGURATION_BLOCK) | ||
| 54 | .page_size(256) | ||
| 55 | .sector_size(4096) | ||
| 56 | .ip_cmd_serial_clk_freq(nor::SerialClockFrequency::MHz30); | ||
| 57 | |||
| 58 | #[no_mangle] | ||
| 59 | #[cfg_attr(all(target_arch = "arm", target_os = "none"), link_section = ".fcb")] | ||
| 60 | pub static FLEXSPI_CONFIGURATION_BLOCK: nor::ConfigurationBlock = SERIAL_NOR_CONFIGURATION_BLOCK; | ||
