Skip to content

Commit 15f626b

Browse files
committed
m4 qspi works. m0 compiles
1 parent f20d572 commit 15f626b

12 files changed

Lines changed: 121 additions & 62 deletions

File tree

ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
#define SPEAKER_ENABLE_PIN (&pin_PA30)
4040

41-
#include "external_flash.h"
41+
#include "external_flash/external_flash.h"
4242

4343
// If you change this, then make sure to update the linker scripts as well to
4444
// make sure you don't overwrite code.
@@ -47,8 +47,8 @@
4747

4848
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
4949

50-
#include "flash_S25FL216K.h"
51-
#include "flash_GD25Q16C.h"
50+
#include "external_flash/devices/S25FL216K.h"
51+
#include "external_flash/devices/GD25Q16C.h"
5252

5353
#define CALIBRATE_CRYSTALLESS 1
5454

ports/atmel-samd/boards/feather_m0_express/mpconfigboard.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#define MICROPY_PORT_B ( 0 )
3232
#define MICROPY_PORT_C ( 0 )
3333

34-
#include "external_flash.h"
34+
#include "external_flash/external_flash.h"
3535

3636
// If you change this, then make sure to update the linker scripts as well to
3737
// make sure you don't overwrite code.
@@ -40,5 +40,5 @@
4040

4141
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
4242

43-
#include "flash_S25FL216K.h"
44-
#include "flash_GD25Q16C.h"
43+
#include "external_flash/devices/S25FL216K.h"
44+
#include "external_flash/devices/GD25Q16C.h"

ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#define MICROPY_PORT_B ( 0 )
3434
#define MICROPY_PORT_C ( 0 )
3535

36-
#include "external_flash.h"
36+
#include "external_flash/external_flash.h"
3737

3838
// If you change this, then make sure to update the linker scripts as well to
3939
// make sure you don't overwrite code.
@@ -42,4 +42,4 @@
4242

4343
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
4444

45-
#include "flash_S25FL064L.h"
45+
#include "external_flash/devices/S25FL064L.h"

ports/atmel-samd/boards/itsybitsy_m0/mpconfigboard.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
#define MICROPY_PORT_B (PORT_PB22 | PORT_PB23 | PORT_PB03 )
3434
#define MICROPY_PORT_C (0)
3535

36-
#include "external_flash.h"
36+
#include "external_flash/external_flash.h"
3737

3838
// If you change this, then make sure to update the linker scripts as well to
3939
// make sure you don't overwrite code.
4040
// #define CIRCUITPY_INTERNAL_NVM_SIZE 256
4141
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
4242
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
4343

44-
//#include "flash_S25FL216K.h"
45-
#include "flash_W25Q80DV.h"
46-
//#include "flash_GD25Q16C.h"
44+
//#include "external_flash/devices/S25FL216K.h"
45+
#include "external_flash/devices/W25Q80DV.h"
46+
//#include "external_flash/devices/GD25Q16C.h"

ports/atmel-samd/boards/metro_m0_express/mpconfigboard.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#define MICROPY_PORT_B (PORT_PB03 | PORT_PB22 | PORT_PB23)
3535
#define MICROPY_PORT_C (0)
3636

37-
#include "external_flash.h"
37+
#include "external_flash/external_flash.h"
3838

3939
// If you change this, then make sure to update the linker scripts as well to
4040
// make sure you don't overwrite code.
@@ -43,5 +43,5 @@
4343

4444
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
4545

46-
#include "flash_S25FL216K.h"
47-
#include "flash_GD25Q16C.h"
46+
#include "external_flash/devices/S25FL216K.h"
47+
#include "external_flash/devices/GD25Q16C.h"

ports/atmel-samd/boards/metro_m4_express/mpconfigboard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
#define SPI_FLASH_DIPO 3 // same as MISO pad
3434

3535
// These are pins not to reset.
36-
#define MICROPY_PORT_A (PORT_PA27)
37-
#define MICROPY_PORT_B (PORT_PB06 | PORT_PB08 | PORT_PB09 | PORT_PB10 | PORT_PB11 | PORT_PB17)
36+
#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11 | PORT_PA27)
37+
#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11 | PORT_PB17)
3838
#define MICROPY_PORT_C (0)
3939
#define MICROPY_PORT_D (0)
4040

ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040

4141
#define CALIBRATE_CRYSTALLESS 1
4242

43-
#include "external_flash.h"
43+
#include "external_flash/external_flash.h"
4444

4545
// If you change this, then make sure to update the linker scripts as well to
4646
// make sure you don't overwrite code.
4747
//#define CIRCUITPY_INTERNAL_NVM_SIZE 256
4848
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
4949
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
5050

51-
#include "flash_W25Q32BV.h"
51+
#include "external_flash/devices/W25Q32BV.h"

ports/atmel-samd/boards/ugame10/mpconfigboard.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333

3434
#define CALIBRATE_CRYSTALLESS 1
3535

36-
#include "external_flash.h"
36+
#include "external_flash/external_flash.h"
3737

3838
// If you change this, then make sure to update the linker scripts as well to
3939
// make sure you don't overwrite code.
4040
//#define CIRCUITPY_INTERNAL_NVM_SIZE 256
4141
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
4242
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
4343

44-
//#include "flash_W25Q32BV.h"
45-
#include "flash_S25FL216K.h"
44+
//#include "external_flash/devices/W25Q32BV.h"
45+
#include "external_flash/devices/S25FL216K.h"

ports/atmel-samd/external_flash/common_commands.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@
3636
// #define CMD_PAGE_PROGRAM CMD_READ_JEDEC_ID
3737
#define CMD_READ_STATUS 0x05
3838
#define CMD_WRITE_STATUS_BYTE1 0x01
39+
#define CMD_QUAD_READ 0x6b
3940

4041
#endif // MICROPY_INCLUDED_ATMEL_SAMD_EXTERNAL_FLASH_COMMON_COMMANDS_H

ports/atmel-samd/external_flash/external_flash.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,19 +195,20 @@ void external_flash_init(void) {
195195
gpio_set_pin_level(MICROPY_HW_LED_MSC, false);
196196
#endif
197197

198-
uint8_t jedec_id_response[4] = {0x00, 0x00, 0x00, 0x00};
199-
spi_flash_read_command(CMD_READ_JEDEC_ID, jedec_id_response, 4);
198+
uint8_t jedec_id_response[3] = {0x00, 0x00, 0x00};
199+
spi_flash_read_command(CMD_READ_JEDEC_ID, jedec_id_response, 3);
200200

201-
uint8_t manufacturer = jedec_id_response[1];
202-
if ((jedec_id_response[1] == SPI_FLASH_JEDEC_MANUFACTURER
201+
uint8_t manufacturer = jedec_id_response[0];
202+
if ((jedec_id_response[0] == SPI_FLASH_JEDEC_MANUFACTURER
203203
#ifdef SPI_FLASH_JEDEC_MANUFACTURER_2
204-
|| jedec_id_response[1] == SPI_FLASH_JEDEC_MANUFACTURER_2
204+
|| jedec_id_response[0] == SPI_FLASH_JEDEC_MANUFACTURER_2
205205
#endif
206206
) &&
207-
jedec_id_response[2] == SPI_FLASH_JEDEC_MEMORY_TYPE &&
208-
jedec_id_response[3] == SPI_FLASH_JEDEC_CAPACITY) {
207+
jedec_id_response[1] == SPI_FLASH_JEDEC_MEMORY_TYPE &&
208+
jedec_id_response[2] == SPI_FLASH_JEDEC_CAPACITY) {
209209
spi_flash_is_initialised = true;
210210
} else {
211+
asm("bkpt");
211212
// Unknown flash chip!
212213
spi_flash_is_initialised = false;
213214
return;

0 commit comments

Comments
 (0)