Skip to content

Commit 544b9e4

Browse files
authored
Merge pull request #541 from ladyada/itsybitsy_m0_fixes
Itsybitsy m0 fixes
2 parents 3b946f6 + 6b66c3b commit 544b9e4

9 files changed

+99
-18
lines changed

atmel-samd/boards/flash_GD25Q16C.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@
4444
// used to confirm we're talking to the flash we expect.
4545
#define SPI_FLASH_JEDEC_MANUFACTURER 0xc8
4646
#define SPI_FLASH_SECTOR_PROTECTION true
47+
#define SPI_FLASH_JEDEC_MEMORY_TYPE 0x40
4748
#else
4849
#define SPI_FLASH_JEDEC_MANUFACTURER_2 0xc8
4950
#define SPI_FLASH_SECTOR_PROTECTION_2 true
51+
#define SPI_FLASH_JEDEC_MEMORY_TYPE_2 0x40
5052
#endif
51-
#define SPI_FLASH_JEDEC_MEMORY_TYPE 0x40
5253
#define SPI_FLASH_JEDEC_CAPACITY 0x15
5354

5455

atmel-samd/boards/flash_S25FL064L.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@
4545
#ifndef SPI_FLASH_JEDEC_MANUFACTURER
4646
#define SPI_FLASH_JEDEC_MANUFACTURER 0x01
4747
#define SPI_FLASH_SECTOR_PROTECTION false
48+
#define SPI_FLASH_JEDEC_MEMORY_TYPE 0x60
4849
#else
4950
#define SPI_FLASH_JEDEC_MANUFACTURER_2 0x013
5051
#define SPI_FLASH_SECTOR_PROTECTION_2 false
52+
#define SPI_FLASH_JEDEC_MEMORY_TYPE_2 0x60
5153
#endif
52-
#define SPI_FLASH_JEDEC_MEMORY_TYPE 0x60
5354
#define SPI_FLASH_JEDEC_CAPACITY 0x17
5455

5556
#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARD_FLASH_S25FL216K_H

atmel-samd/boards/flash_S25FL216K.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@
4444
#ifndef SPI_FLASH_JEDEC_MANUFACTURER
4545
#define SPI_FLASH_JEDEC_MANUFACTURER 0x01
4646
#define SPI_FLASH_SECTOR_PROTECTION false
47+
#define SPI_FLASH_JEDEC_MEMORY_TYPE 0x40
4748
#else
4849
#define SPI_FLASH_JEDEC_MANUFACTURER_2 0x01
4950
#define SPI_FLASH_SECTOR_PROTECTION_2 false
51+
#define SPI_FLASH_JEDEC_MEMORY_TYPE_2 0x40
5052
#endif
51-
#define SPI_FLASH_JEDEC_MEMORY_TYPE 0x40
5253
#define SPI_FLASH_JEDEC_CAPACITY 0x15
5354

5455
#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARD_FLASH_S25FL216K_H

atmel-samd/boards/flash_W25Q16FW.h

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_BOARD_FLASH_W25Q16FW_H
28+
#define MICROPY_INCLUDED_ATMEL_SAMD_BOARD_FLASH_W25Q16FW_H
29+
30+
// The total flash size in bytes.
31+
#define SPI_FLASH_TOTAL_SIZE (1 << 21) // 2 MiB
32+
33+
// The size of the smallest erase unit thats erased with command 0x20.
34+
#define SPI_FLASH_ERASE_SIZE (1 << 12) // 4 KiB
35+
36+
// The size of a page that is programmed with page program command 0x02.
37+
#define SPI_FLASH_PAGE_SIZE (256) // 256 bytes
38+
39+
// These are the first three response bytes to the JEDEC ID command 0x9f that is
40+
// used to confirm we're talking to the flash we expect.
41+
#ifndef SPI_FLASH_JEDEC_MANUFACTURER
42+
#define SPI_FLASH_JEDEC_MANUFACTURER 0xef
43+
#define SPI_FLASH_SECTOR_PROTECTION false
44+
#define SPI_FLASH_JEDEC_MEMORY_TYPE 0x60
45+
#else
46+
#define SPI_FLASH_JEDEC_MANUFACTURER_2 0xef
47+
#define SPI_FLASH_SECTOR_PROTECTION_2 false
48+
#define SPI_FLASH_JEDEC_MEMORY_TYPE_2 0x60
49+
#endif
50+
51+
#define SPI_FLASH_JEDEC_CAPACITY 0x15
52+
53+
#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARD_FLASH_W25Q16BV_H

atmel-samd/boards/flash_W25Q32BV.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@
4141
#ifndef SPI_FLASH_JEDEC_MANUFACTURER
4242
#define SPI_FLASH_JEDEC_MANUFACTURER 0xef
4343
#define SPI_FLASH_SECTOR_PROTECTION false
44+
#define SPI_FLASH_JEDEC_MEMORY_TYPE 0x40
4445
#else
4546
#define SPI_FLASH_JEDEC_MANUFACTURER_2 0xef
4647
#define SPI_FLASH_SECTOR_PROTECTION_2 false
48+
#define SPI_FLASH_JEDEC_MEMORY_TYPE_2 0x40
4749
#endif
48-
#define SPI_FLASH_JEDEC_MEMORY_TYPE 0x40
4950
#define SPI_FLASH_JEDEC_CAPACITY 0x16
5051

5152
#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARD_FLASH_W25Q32BV_H

atmel-samd/boards/flash_W25Q80DV.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@
4141
#ifndef SPI_FLASH_JEDEC_MANUFACTURER
4242
#define SPI_FLASH_JEDEC_MANUFACTURER 0xef
4343
#define SPI_FLASH_SECTOR_PROTECTION false
44+
#define SPI_FLASH_JEDEC_MEMORY_TYPE_2 0x40
4445
#else
4546
#define SPI_FLASH_JEDEC_MANUFACTURER_2 0xef
4647
#define SPI_FLASH_SECTOR_PROTECTION_2 false
48+
#define SPI_FLASH_JEDEC_MEMORY_TYPE_2 0x40
4749
#endif
48-
#define SPI_FLASH_JEDEC_MEMORY_TYPE 0x40
4950
#define SPI_FLASH_JEDEC_CAPACITY 0x14
5051

5152
#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARD_FLASH_W25Q80DV_H

atmel-samd/boards/itsybitsy_m0/conf_usb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#endif
2222

2323
#ifndef USB_DEVICE_PRODUCT_NAME
24-
# define USB_DEVICE_PRODUCT_NAME "ItsyBitsy M0"
24+
# define USB_DEVICE_PRODUCT_NAME "ItsyBitsy M0 Express"
2525
#endif
2626
// #define USB_DEVICE_SERIAL_NAME "12...EF"
2727
#define USB_DEVICE_GET_SERIAL_NAME_POINTER serial_number
Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,55 @@
11
#define USB_REPL
22

3-
#define MICROPY_HW_BOARD_NAME "Adafruit ItsyBitsy M0"
3+
#define MICROPY_HW_BOARD_NAME "Adafruit Itsy Bitsy M0 Express"
44
#define MICROPY_HW_MCU_NAME "samd21g18"
55

66
#define CIRCUITPY_BITBANG_APA102
77
#define MICROPY_HW_APA102_MOSI (&pin_PA01)
88
#define MICROPY_HW_APA102_SCK (&pin_PA00)
99

10-
#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA27 | PORT_PA24 | PORT_PA25)
11-
#define MICROPY_PORT_B (PORT_PB22 | PORT_PB23 | PORT_PB03 )
12-
1310
// Salae reads 12mhz which is the limit even though we set it to the safer 8mhz.
1411
#define SPI_FLASH_BAUDRATE (8000000)
1512

16-
#define SPI_FLASH_MUX_SETTING SPI_SIGNAL_MUX_SETTING_F
17-
#define SPI_FLASH_PAD2_PINMUX PINMUX_PB22D_SERCOM5_PAD2 // MOSI
13+
#define SPI_FLASH_PAD0_PINMUX PINMUX_UNUSED // CS
1814
// Use default pinmux for the chip select since we manage it ourselves.
19-
#define SPI_FLASH_PAD3_PINMUX PINMUX_PB23D_SERCOM5_PAD3 // SCK
2015
#define SPI_FLASH_PAD1_PINMUX PINMUX_PB03D_SERCOM5_PAD1 // MISO
21-
#define SPI_FLASH_PAD0_PINMUX PINMUX_UNUSED //
22-
#define SPI_FLASH_SERCOM SERCOM5
16+
#define SPI_FLASH_MISO_PAD 1
17+
#define SPI_FLASH_PAD2_PINMUX PINMUX_PB22D_SERCOM5_PAD2 // MOSI
18+
#define SPI_FLASH_MOSI_PAD 2
19+
#define SPI_FLASH_PAD3_PINMUX PINMUX_PB23D_SERCOM5_PAD3 // SCK
20+
#define SPI_FLASH_SCK_PAD 3
2321

2422
#define SPI_FLASH_CS PIN_PA27
23+
#define SPI_FLASH_SERCOM SERCOM5
24+
25+
#define SPI_FLASH_MOSI PIN_PB22
26+
#define SPI_FLASH_MISO PIN_PB03
27+
#define SPI_FLASH_SCK PIN_PB23
28+
#define SPI_FLASH_SERCOM_INDEX 5
29+
// <o> Transmit Data Pinout
30+
// <0x0=>PAD[0,1]_DO_SCK
31+
// <0x1=>PAD[2,3]_DO_SCK
32+
// <0x2=>PAD[3,1]_DO_SCK
33+
// <0x3=>PAD[0,3]_DO_SCK
34+
#define SPI_FLASH_DOPO 1
35+
#define SPI_FLASH_DIPO 1 // same as MISO pad
36+
#define SPI_FLASH_MUX_SETTING SPI_SIGNAL_MUX_SETTING_F
37+
2538

39+
// These are pins not to reset.
40+
#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA27 | PORT_PA24 | PORT_PA25)
41+
#define MICROPY_PORT_B (PORT_PB22 | PORT_PB23 | PORT_PB03 )
42+
#define MICROPY_PORT_C (0)
2643

2744
#include "spi_flash.h"
2845

2946
// If you change this, then make sure to update the linker scripts as well to
3047
// make sure you don't overwrite code.
3148
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
49+
3250
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE)
3351

34-
//#include "flash_S25FL216K.h"
35-
#include "flash_W25Q80DV.h"
36-
//#include "flash_GD25Q16C.h"
52+
#include "flash_GD25Q16C.h"
53+
#include "flash_W25Q16FW.h"
54+
55+
#define CALIBRATE_CRYSTALLESS 1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
LD_FILE = boards/samd21x18-bootloader-external-flash-crystalless.ld
22
USB_VID = 0x239A
33
USB_PID = 0x8012
4+
USB_PRODUCT = "Itsy Bitsy M0 Express"
5+
USB_MANUFACTURER = "Adafruit Industries LLC"
46

57
SPI_FLASH_FILESYSTEM = 1
68

79
CHIP_VARIANT = SAMD21G18A
10+
CHIP_FAMILY = samd21
11+

0 commit comments

Comments
 (0)