diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-05-27 00:42:46 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-05-27 00:42:46 +0200 |
| commit | da38de309beba6c0b9080289feda71745dc3ee6e (patch) | |
| tree | 3dc9a763ada5e66fda8de47aaf1ada7836bf206f /embassy-nrf-examples/src | |
| parent | 3bd36dce763dac8777cf89f17c8b24659a7e2f6d (diff) | |
nrf/qspi: set correct config for flash chip in the nrf52840dk
Diffstat (limited to 'embassy-nrf-examples/src')
| -rw-r--r-- | embassy-nrf-examples/src/bin/qspi.rs | 19 | ||||
| -rw-r--r-- | embassy-nrf-examples/src/bin/qspi_lowpower.rs | 4 |
2 files changed, 14 insertions, 9 deletions
diff --git a/embassy-nrf-examples/src/bin/qspi.rs b/embassy-nrf-examples/src/bin/qspi.rs index 1f33192e9..6e49887a4 100644 --- a/embassy-nrf-examples/src/bin/qspi.rs +++ b/embassy-nrf-examples/src/bin/qspi.rs | |||
| @@ -24,16 +24,17 @@ struct AlignedBuf([u8; 4096]); | |||
| 24 | 24 | ||
| 25 | #[embassy::main] | 25 | #[embassy::main] |
| 26 | async fn main(_spawner: Spawner, p: Peripherals) { | 26 | async fn main(_spawner: Spawner, p: Peripherals) { |
| 27 | let csn = p.P0_17; | 27 | // Config for the MX25R64 present in the nRF52840 DK |
| 28 | let sck = p.P0_19; | 28 | let mut config = qspi::Config::default(); |
| 29 | let io0 = p.P0_20; | 29 | config.read_opcode = qspi::ReadOpcode::READ4IO; |
| 30 | let io1 = p.P0_21; | 30 | config.write_opcode = qspi::WriteOpcode::PP4IO; |
| 31 | let io2 = p.P0_22; | 31 | config.write_page_size = qspi::WritePageSize::_256BYTES; |
| 32 | let io3 = p.P0_23; | 32 | |
| 33 | |||
| 34 | let config = qspi::Config::default(); | ||
| 35 | let irq = interrupt::take!(QSPI); | 33 | let irq = interrupt::take!(QSPI); |
| 36 | let mut q = qspi::Qspi::new(p.QSPI, irq, sck, csn, io0, io1, io2, io3, config).await; | 34 | let mut q = qspi::Qspi::new( |
| 35 | p.QSPI, irq, p.P0_19, p.P0_17, p.P0_20, p.P0_21, p.P0_22, p.P0_23, config, | ||
| 36 | ) | ||
| 37 | .await; | ||
| 37 | 38 | ||
| 38 | let mut id = [1; 3]; | 39 | let mut id = [1; 3]; |
| 39 | q.custom_instruction(0x9F, &[], &mut id).await.unwrap(); | 40 | q.custom_instruction(0x9F, &[], &mut id).await.unwrap(); |
diff --git a/embassy-nrf-examples/src/bin/qspi_lowpower.rs b/embassy-nrf-examples/src/bin/qspi_lowpower.rs index 9bbc87caa..ece3243b6 100644 --- a/embassy-nrf-examples/src/bin/qspi_lowpower.rs +++ b/embassy-nrf-examples/src/bin/qspi_lowpower.rs | |||
| @@ -27,7 +27,11 @@ async fn main(_spawner: Spawner, mut p: Peripherals) { | |||
| 27 | let mut irq = interrupt::take!(QSPI); | 27 | let mut irq = interrupt::take!(QSPI); |
| 28 | 28 | ||
| 29 | loop { | 29 | loop { |
| 30 | // Config for the MX25R64 present in the nRF52840 DK | ||
| 30 | let mut config = qspi::Config::default(); | 31 | let mut config = qspi::Config::default(); |
| 32 | config.read_opcode = qspi::ReadOpcode::READ4IO; | ||
| 33 | config.write_opcode = qspi::WriteOpcode::PP4IO; | ||
| 34 | config.write_page_size = qspi::WritePageSize::_256BYTES; | ||
| 31 | config.deep_power_down = Some(qspi::DeepPowerDownConfig { | 35 | config.deep_power_down = Some(qspi::DeepPowerDownConfig { |
| 32 | enter_time: 3, // tDP = 30uS | 36 | enter_time: 3, // tDP = 30uS |
| 33 | exit_time: 3, // tRDP = 35uS | 37 | exit_time: 3, // tRDP = 35uS |
