shields: add st x-nucleo-eeprma2 eeprom shiled for m24xx, m95xx devices

This commit adds st microelectronics x-nucleo-eeprma2 shield,
which has populated 6 different i2c and spi eeproms.
They are all compatible with the existing at24 and at25 drivers.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
This commit is contained in:
Thomas Stranger 2021-05-01 00:24:13 +02:00 committed by Carles Cufí
parent 0c506e5fca
commit 002ea39561
5 changed files with 250 additions and 0 deletions

View file

@ -0,0 +1,22 @@
# Copyright (c) 2021 Thomas Stranger
# SPDX-License-Identifier: Apache-2.0
if SHIELD_X_NUCLEO_EEPRMA2
if EEPROM
config SPI
default y
config EEPROM_AT25
default y
config I2C
default y
config EEPROM_AT24
default y
endif # EEPROM
endif # SHIELD_X_NUCLEO_EEPRMA2

View file

@ -0,0 +1,5 @@
# Copyright (c) 2021 Thomas Stranger
# SPDX-License-Identifier: Apache-2.0
config SHIELD_X_NUCLEO_EEPRMA2
def_bool $(shields_list_contains,x_nucleo_eeprma2)

View file

@ -0,0 +1,92 @@
.. _x_nucleo_eeprma2_shield:
X-NUCLEO-EEPRMA2 EEPROM memory expansion board
##############################################
Overview
********
The ST X-NUCLEO-EEPRMA2 expansion board can be used to evaluate M24xx series I2C
and M95xx series SPI EEPROM devices.
The X-NUCLEO-EEPRMA2 expansion board is compatible with the Arduino UNO R3
connector pin assignment. Additionally the pins are routed to dedicated headers
and ST morpho connectors can be mounted if required.
The I2C EEPROMs are compatible with the ``atmel,at24`` driver and
the SPI EEPROMs are compatible with the ``atmel,at25`` driver.
.. figure:: ./x_nucleo_eeprma2.jpg
:width: 371px
:align: center
:alt: X-NUCLEO-EEPRMA2
More information about the board can be found at the
`X-NUCLEO-EEPRMA2 website`_.
Requirements
************
This shield can only be used with a development board that provides a
configuration for Arduino connectors and defines a node alias for the
SPI or I2C interface (see :ref:`shields` for more details).
The SPI EEPROM devices can write protect complete memory blocks by setting
the corresponding block protect bits in the status register.
As the driver does not change this status register, make sure this protections
are disabled in case writes to the EEPROM should be supported.
For more information about interfacing the M24xx and M95xx series EEPROM devices
and the X-NUCLEO-EEPRMA2 in particular, see these ST Microelectronics documents:
- `X-NUCLEO-EEPRMA2 EEPROM memory expansion board User Manual`_
- `M24C02-F Serial I2C bus EEPROM Datasheet`_
- `M24256-DF Serial I2C bus EEPROM Datasheet`_
- `M24M01-DF Serial I2C bus EEPROM Datasheet`_
- `M95040-R Serial SPI bus EEPROM Datasheet`_
- `M95256-DF Serial SPI bus EEPROM Datasheet`_
- `M95M04-DR Serial SPI bus EEPROM Datasheet`_
Samples
*******
The :ref:`samples_eeprom` can be used to demonstrate the expansion boards
functionality.
Per default the shield sets an ``eeprom-0`` alias for the M24C02-FMC6TG EEPROM,
which can be overwritten to use the other EEPROM deivces instead.
Programming
***********
Set ``-DSHIELD=x_nucleo_eeprma2`` when you invoke ``west build``. For example:
.. zephyr-app-commands::
:zephyr-app: samples/drivers/eeprom/
:board: nucleo_g0b1re
:shield: x_nucleo_eeprma2
:goals: build
.. _X-NUCLEO-EEPRMA2 website:
https://www.st.com/en/evaluation-tools/x-nucleo-eeprma2.html
.. _X-NUCLEO-EEPRMA2 EEPROM memory expansion board User Manual:
https://www.st.com/resource/en/user_manual/dm00671710-getting-started-with-the-xnucleoeeprma2-standard-ic-and-spi-eeprom-memory-expansion-board-based-on-m24xx-and-m95xx-series-for-stm32-nucleo-stmicroelectronics.pdf
.. _M24C02-F Serial I2C bus EEPROM Datasheet:
https://www.st.com/resource/en/datasheet/m24c02-f.pdf
.. _M24256-DF Serial I2C bus EEPROM Datasheet:
https://www.st.com/resource/en/datasheet/m24256-df.pdf
.. _M24M01-DF Serial I2C bus EEPROM Datasheet:
https://www.st.com/resource/en/datasheet/m24m01-df.pdf
.. _M95040-R Serial SPI bus EEPROM Datasheet:
https://www.st.com/resource/en/datasheet/m95040-r.pdf
.. _M95256-DF Serial SPI bus EEPROM Datasheet:
https://www.st.com/resource/en/datasheet/m95256-df.pdf
.. _M95M04-DR Serial SPI bus EEPROM Datasheet:
https://www.st.com/resource/en/datasheet/m95m04-dr.pdf

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

View file

@ -0,0 +1,131 @@
/*
* Copyright (c) 2021 Thomas Stranger
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <freq.h>
/ {
aliases {
eeprom-0 = &eeprom0;
eeprom-1 = &eeprom4;
};
};
&arduino_i2c {
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
eeprom0: eeprom@54 {
/* M24C02-FMC6TG aka U1 (2 kbit eeprom in DFN8 package) */
compatible = "st,m24xxx", "atmel,at24";
reg = <0x54>;
label = "EEPROM_M24C02";
size = <256>;
pagesize = <16>;
address-width = <8>;
timeout = <5>;
/* if solder-bridge closed: arduino A1 pin on CN8 can wp */
/* wp-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>; */
};
eeprom1: eeprom@55 {
/* M24256-DFDW6TP aka U2 (256 kbit eeprom in TSSOP package) */
compatible = "st,m24xxx", "atmel,at24";
reg = <0x55>;
label = "EEPROM_M24256";
size = <DT_SIZE_K(32)>;
pagesize = <64>;
address-width = <16>;
timeout = <5>;
/* if solder-bridge closed: arduino A1 pin on CN8 can wp */
/* wp-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>; */
};
eeprom2: eeprom@56 {
/* M24M01-DFMN6TP aka U3 (1 Mbit eeprom in SO8N package) */
compatible = "st,m24xxx", "atmel,at24";
reg = <0x56>;
label = "EEPROM_M24M01";
size = <DT_SIZE_K(128)>;
pagesize = <256>;
address-width = <16>;
timeout = <5>;
/* if solder-bridge closed: arduino A1 pin on CN8 can wp */
/* wp-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>; */
};
/* U4: unpopulated SO8N footprint for any I2C M24 EEPROM */
};
&arduino_spi {
cs-gpios = <&arduino_header 8 GPIO_ACTIVE_LOW>, /* U5: eeprom4 */
<&arduino_header 15 GPIO_ACTIVE_LOW>, /* U6: eeprom5 */
<&arduino_header 16 GPIO_ACTIVE_LOW>; /* U7: eeprom6 */
/*
* All chip select pins have an on board 10k pull-up resistor to VCC,
* and are connected to their respective arduino pins via a normally
* closed solder brige.
*
* All hold pins are connected to VCC with a 10k pull-up, and
* have a connection to arduino pin A3 on CN8 via an open solder bridge.
*
* All write-protect pins are connected to J11 with a 10k pull-up
* resistor. Where they can either be torn to VCC or GND.
* Additionally they are connected to arduino pin A0 on CN8
* via an open solder bridge.
*/
eeprom4: eeprom_m95040@0 {
/* M95040-RMC6TG aka U5 (4 kbit eeprom in DFN8 package) */
compatible = "st,m95xxx", "atmel,at25";
reg = <0x00>;
label = "EEPROM_M95040";
size = <512>;
pagesize = <16>;
address-width = <8>;
spi-max-frequency = <DT_FREQ_M(20)>;
timeout = <5>;
/* if solder-bridge closed: arduino A0 pin on CN8 can wp */
/* wp-gpios = <&arduino_header 0 GPIO_ACTIVE_LOW>; */
};
eeprom5: eeprom_m95256@1 {
/* M95256-DFDW6TP aka U6 (256 kbit eeprom in TSSOP package) */
compatible = "st,m95xxx", "atmel,at25";
reg = <0x01>;
label = "EEPROM_M95256";
size = <DT_SIZE_K(32)>;
pagesize = <64>;
address-width = <16>;
spi-max-frequency = <DT_FREQ_M(20)>;
timeout = <5>;
/* if solder-bridge closed: arduino A0 pin on CN8 can wp */
/* wp-gpios = <&arduino_header 0 GPIO_ACTIVE_LOW>; */
};
eeprom6: eeprom_m95m04@2 {
/* M95M04-DRMN6TP aka U7 (4 Mbit eeprom in SON8 package) */
compatible = "st,m95xxx", "atmel,at25";
reg = <0x02>;
label = "EEPROM_M95M04";
size = <DT_SIZE_K(512)>;
pagesize = <512>;
address-width = <24>;
/* max-frequency 10MHz for vcc>=2.5V and 5MHz for vcc>=1.8V */
spi-max-frequency = <DT_FREQ_M(10)>;
timeout = <5>;
/* if solder-bridge closed: arduino A0 pin on CN8 can wp */
/* wp-gpios = <&arduino_header 0 GPIO_ACTIVE_LOW>; */
};
/* U8: unpopulated SO8N footprint for any M95 SPI EEPROM */
};