Module capsules_extra::mx25r6435f
source · Expand description
SyscallDriver for the MX25R6435F flash chip.
http://www.macronix.com/en-us/products/NOR-Flash/Serial-NOR-Flash/Pages/spec.aspx?p=MX25R6435F
From the datasheet:
MX25R6435F is 64Mb bits Serial NOR Flash memory, which is configured as 8,388,608 x 8 internally. When it is in four I/O mode, the structure becomes 16,777,216 bits x 4 or 33,554,432 bits x 2. MX25R6435F feature a serial peripheral interface and software protocol allowing operation on a simple 3-wire bus while it is in single I/O mode. The three bus signals are a clock input (SCLK), a serial data input (SI), and a serial data output (SO). Serial access to the device is enabled by CS# input.
§Usage
ⓘ
// Create a SPI device for this chip.
let mx25r6435f_spi = static_init!(
capsules::virtual_spi::VirtualSpiMasterDevice<'static, nrf52::spi::SPIM>,
capsules::virtual_spi::VirtualSpiMasterDevice::new(mux_spi, &nrf5x::gpio::PORT[17])
);
// Create an alarm for this chip.
let mx25r6435f_virtual_alarm = static_init!(
VirtualMuxAlarm<'static, nrf5x::rtc::Rtc>,
VirtualMuxAlarm::new(mux_alarm)
);
mx25r6435f_virtual_alarm.setup();
// Setup the actual MX25R6435F driver.
let mx25r6435f = static_init!(
capsules::mx25r6435f::MX25R6435F<
'static,
capsules::virtual_spi::VirtualSpiMasterDevice<'static, nrf52::spi::SPIM>,
nrf5x::gpio::GPIOPin,
>,
capsules::mx25r6435f::MX25R6435F::new(
mx25r6435f_spi,
&mut capsules::mx25r6435f::TXBUFFER,
&mut capsules::mx25r6435f::RXBUFFER,
Some(&nrf5x::gpio::PORT[22]),
Some(&nrf5x::gpio::PORT[23])
)
);
mx25r6435f_spi.set_client(mx25r6435f);
mx25r6435f_virtual_alarm.set_client(mx25r6435f);
Structs§
- This is a wrapper around a u8 array that is sized to a single page for the MX25R6435F. The page size is 4k because that is the smallest size that can be erased (even though 256 bytes can be written).