diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-05-12 14:47:39 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-05-12 14:47:39 -0700 |
| commit | e1a6f6d5841b0da2bd9289b41816fc620a91b3b7 (patch) | |
| tree | c3b014d2a6669b6b09feee1f6e4866e3c424b25d /atmel-samd/boards | |
| parent | 7ea76e0889d3f11960056cfca3bde77a3b70c33e (diff) | |
atmel-samd: Rework SPI flash defines for clarity.
Also add sector protection support for the SAMD Xplained board.
Diffstat (limited to 'atmel-samd/boards')
| -rw-r--r-- | atmel-samd/boards/circuitplayground_express/mpconfigboard.h | 2 | ||||
| -rw-r--r-- | atmel-samd/boards/feather_m0_express/mpconfigboard.h | 2 | ||||
| -rw-r--r-- | atmel-samd/boards/flash_AT25DF081A.h | 52 | ||||
| -rw-r--r-- | atmel-samd/boards/flash_S25FL216K.h | 48 | ||||
| -rw-r--r-- | atmel-samd/boards/metro_m0_express/mpconfigboard.h | 2 |
5 files changed, 106 insertions, 0 deletions
diff --git a/atmel-samd/boards/circuitplayground_express/mpconfigboard.h b/atmel-samd/boards/circuitplayground_express/mpconfigboard.h index c31e7f8eb..4eb124adf 100644 --- a/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +++ b/atmel-samd/boards/circuitplayground_express/mpconfigboard.h @@ -38,4 +38,6 @@ #define BOARD_FLASH_SIZE (0x00040000 - 0x2000) +#include "flash_S25FL216K.h" + #define CALIBRATE_CRYSTALLESS 1 diff --git a/atmel-samd/boards/feather_m0_express/mpconfigboard.h b/atmel-samd/boards/feather_m0_express/mpconfigboard.h index 93ec565bd..4f787aef6 100644 --- a/atmel-samd/boards/feather_m0_express/mpconfigboard.h +++ b/atmel-samd/boards/feather_m0_express/mpconfigboard.h @@ -26,3 +26,5 @@ #include "spi_flash.h" #define BOARD_FLASH_SIZE (0x00040000 - 0x2000) + +#include "flash_S25FL216K.h" diff --git a/atmel-samd/boards/flash_AT25DF081A.h b/atmel-samd/boards/flash_AT25DF081A.h new file mode 100644 index 000000000..436f7e36c --- /dev/null +++ b/atmel-samd/boards/flash_AT25DF081A.h @@ -0,0 +1,52 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef __MICROPY_INCLUDED_ATMEL_SAMD_BOARD_FLASH_AT25DF081A_H__ +#define __MICROPY_INCLUDED_ATMEL_SAMD_BOARD_FLASH_AT25DF081A_H__ + +// Settings for the Adesto Tech AT25DF081A 1MiB SPI flash. Its on the SAMD21 +// Xplained board. +// Datasheet: https://www.adestotech.com/wp-content/uploads/doc8715.pdf + +// The total flash size in bytes. +#define SPI_FLASH_TOTAL_SIZE (1 << 20) // 2 MiB + +// The size of the smallest erase unit thats erased with command 0x20. +#define SPI_FLASH_ERASE_SIZE (1 << 12) // 4 KiB + +// The size of a page that is programmed with page program command 0x02. +#define SPI_FLASH_PAGE_SIZE (256) // 256 bytes + +// These are the first three response bytes to the JEDEC ID command 0x9f that is +// used to confirm we're talking to the flash we expect. The data sheet calls +// them something else so we just match it byte for byte. +#define SPI_FLASH_JEDEC_MANUFACTURER 0x1F +#define SPI_FLASH_JEDEC_MEMORY_TYPE 0x45 +#define SPI_FLASH_JEDEC_CAPACITY 0x01 + +#define SPI_FLASH_SECTOR_PROTECTION + +#endif // __MICROPY_INCLUDED_ATMEL_SAMD_BOARD_FLASH_AT25DF081A_H__ diff --git a/atmel-samd/boards/flash_S25FL216K.h b/atmel-samd/boards/flash_S25FL216K.h new file mode 100644 index 000000000..ed4fe8433 --- /dev/null +++ b/atmel-samd/boards/flash_S25FL216K.h @@ -0,0 +1,48 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef __MICROPY_INCLUDED_ATMEL_SAMD_BOARD_FLASH_S25FL216K_H__ +#define __MICROPY_INCLUDED_ATMEL_SAMD_BOARD_FLASH_S25FL216K_H__ + +// Settings for the Cypress (was Spansion) S25FL216K 2MiB SPI flash. +// Datasheet: http://www.cypress.com/file/197346/download + +// The total flash size in bytes. +#define SPI_FLASH_TOTAL_SIZE (1 << 21) // 2 MiB + +// The size of the smallest erase unit thats erased with command 0x20. +#define SPI_FLASH_ERASE_SIZE (1 << 12) // 4 KiB + +// The size of a page that is programmed with page program command 0x02. +#define SPI_FLASH_PAGE_SIZE (256) // 256 bytes + +// These are the first three response bytes to the JEDEC ID command 0x9f that is +// used to confirm we're talking to the flash we expect. +#define SPI_FLASH_JEDEC_MANUFACTURER 0x01 +#define SPI_FLASH_JEDEC_MEMORY_TYPE 0x40 +#define SPI_FLASH_JEDEC_CAPACITY 0x15 + +#endif // __MICROPY_INCLUDED_ATMEL_SAMD_BOARD_FLASH_S25FL216K_H__ diff --git a/atmel-samd/boards/metro_m0_express/mpconfigboard.h b/atmel-samd/boards/metro_m0_express/mpconfigboard.h index 728169957..49da728dc 100644 --- a/atmel-samd/boards/metro_m0_express/mpconfigboard.h +++ b/atmel-samd/boards/metro_m0_express/mpconfigboard.h @@ -28,3 +28,5 @@ #include "spi_flash.h" #define BOARD_FLASH_SIZE (0x00040000 - 0x2000) + +#include "flash_S25FL216K.h" |
