Skip to content

Commit 7be66a5

Browse files
authored
Merge pull request #6265 from KurtE/teensyMM
Add Teensy MicroMod board
2 parents df74c68 + f95a68a commit 7be66a5

File tree

7 files changed

+475
-0
lines changed

7 files changed

+475
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
7+
* Copyright (c) 2019 Artur Pacholec
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
* THE SOFTWARE.
26+
*/
27+
28+
#include "supervisor/board.h"
29+
#include "boards/flash_config.h"
30+
#include "mpconfigboard.h"
31+
#include "shared-bindings/microcontroller/Pin.h"
32+
33+
void board_init(void) {
34+
// FLEX flash
35+
common_hal_never_reset_pin(&pin_GPIO_SD_B1_06);
36+
common_hal_never_reset_pin(&pin_GPIO_SD_B1_07);
37+
common_hal_never_reset_pin(&pin_GPIO_SD_B1_08);
38+
common_hal_never_reset_pin(&pin_GPIO_SD_B1_09);
39+
common_hal_never_reset_pin(&pin_GPIO_SD_B1_10);
40+
common_hal_never_reset_pin(&pin_GPIO_SD_B1_11);
41+
42+
// FLEX flash 2
43+
common_hal_never_reset_pin(&pin_GPIO_AD_B0_04);
44+
common_hal_never_reset_pin(&pin_GPIO_AD_B0_06);
45+
common_hal_never_reset_pin(&pin_GPIO_AD_B0_07);
46+
common_hal_never_reset_pin(&pin_GPIO_AD_B0_08);
47+
common_hal_never_reset_pin(&pin_GPIO_AD_B0_09);
48+
common_hal_never_reset_pin(&pin_GPIO_AD_B0_10);
49+
common_hal_never_reset_pin(&pin_GPIO_EMC_01);
50+
common_hal_never_reset_pin(&pin_GPIO_B0_13);
51+
common_hal_never_reset_pin(&pin_GPIO_AD_B0_11);
52+
// Data strobe needs protection despite being grounded
53+
common_hal_never_reset_pin(&pin_GPIO_SD_B1_05);
54+
}
55+
56+
bool board_requests_safe_mode(void) {
57+
return false;
58+
}
59+
60+
void reset_board(void) {
61+
}
62+
63+
void board_deinit(void) {
64+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_ld_reserved_flash_size = 4K;
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
/*
2+
* Copyright 2017 NXP
3+
* All rights reserved.
4+
*
5+
* SPDX-License-Identifier: BSD-3-Clause
6+
*/
7+
8+
#include "boards/flash_config.h"
9+
10+
#include "fsl_flexspi_nor_boot.h"
11+
12+
13+
__attribute__((section(".boot_hdr.ivt")))
14+
/*************************************
15+
* IVT Data
16+
*************************************/
17+
const ivt image_vector_table = {
18+
IVT_HEADER, /* IVT Header */
19+
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
20+
IVT_RSVD, /* Reserved = 0 */
21+
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
22+
(uint32_t)BOOT_DATA_ADDRESS, /* Address where BOOT Data Structure is stored */
23+
(uint32_t)&image_vector_table, /* Pointer to IVT Self (absolute address */
24+
(uint32_t)CSF_ADDRESS, /* Address where CSF file is stored */
25+
IVT_RSVD /* Reserved = 0 */
26+
};
27+
28+
__attribute__((section(".boot_hdr.boot_data")))
29+
/*************************************
30+
* Boot Data
31+
*************************************/
32+
const BOOT_DATA_T boot_data = {
33+
FLASH_BASE, /* boot start location */
34+
FLASH_SIZE, /* size */
35+
PLUGIN_FLAG, /* Plugin flag*/
36+
0xFFFFFFFF /* empty - extra data word */
37+
};
38+
39+
// Config for W25Q64JV with QSPI routed.
40+
__attribute__((section(".boot_hdr.conf")))
41+
const flexspi_nor_config_t qspiflash_config = {
42+
.pageSize = 256u,
43+
.sectorSize = 4u * 1024u,
44+
.ipcmdSerialClkFreq = kFlexSpiSerialClk_30MHz,
45+
.blockSize = 0x00010000,
46+
.isUniformBlockSize = false,
47+
.memConfig =
48+
{
49+
.tag = FLEXSPI_CFG_BLK_TAG,
50+
.version = FLEXSPI_CFG_BLK_VERSION,
51+
.readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad,
52+
.csHoldTime = 3u,
53+
.csSetupTime = 3u,
54+
55+
.busyOffset = 0u, // Status bit 0 indicates busy.
56+
.busyBitPolarity = 0u, // Busy when the bit is 1.
57+
58+
.deviceModeCfgEnable = 1u,
59+
.deviceModeType = kDeviceConfigCmdType_QuadEnable,
60+
.deviceModeSeq = {
61+
.seqId = 4u,
62+
.seqNum = 1u,
63+
},
64+
.deviceModeArg = 0x02,
65+
.deviceType = kFlexSpiDeviceType_SerialNOR,
66+
.sflashPadType = kSerialFlash_4Pads,
67+
.serialClkFreq = kFlexSpiSerialClk_60MHz,
68+
.sflashA1Size = FLASH_SIZE,
69+
.lookupTable =
70+
{
71+
// FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)
72+
// The high 16 bits is command 1 and the low are command 0.
73+
// Within a command, the top 6 bits are the opcode, the next two are the number
74+
// of pads and then last byte is the operand. The operand's meaning changes
75+
// per opcode.
76+
77+
// Indices with ROM should always have the same function because the ROM
78+
// bootloader uses it.
79+
80+
// 0: ROM: Read LUTs
81+
// Quad version
82+
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */,
83+
RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */),
84+
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */,
85+
READ_SDR, FLEXSPI_4PAD, 0x04),
86+
// Single fast read version, good for debugging.
87+
// FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */,
88+
// RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
89+
// FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */,
90+
// READ_SDR, FLEXSPI_1PAD, 0x04),
91+
TWO_EMPTY_STEPS,
92+
TWO_EMPTY_STEPS),
93+
94+
// 1: ROM: Read status
95+
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */,
96+
READ_SDR, FLEXSPI_1PAD, 0x01),
97+
TWO_EMPTY_STEPS,
98+
TWO_EMPTY_STEPS,
99+
TWO_EMPTY_STEPS),
100+
101+
// 2: Empty
102+
EMPTY_SEQUENCE,
103+
104+
// 3: ROM: Write Enable
105+
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */,
106+
STOP, FLEXSPI_1PAD, 0x00),
107+
TWO_EMPTY_STEPS,
108+
TWO_EMPTY_STEPS,
109+
TWO_EMPTY_STEPS),
110+
111+
// 4: Config: Write Status
112+
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */,
113+
WRITE_SDR, FLEXSPI_1PAD, 0x01),
114+
TWO_EMPTY_STEPS,
115+
TWO_EMPTY_STEPS,
116+
TWO_EMPTY_STEPS),
117+
118+
// 5: ROM: Erase Sector
119+
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */,
120+
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
121+
TWO_EMPTY_STEPS,
122+
TWO_EMPTY_STEPS,
123+
TWO_EMPTY_STEPS),
124+
125+
// 6: Empty
126+
EMPTY_SEQUENCE,
127+
128+
// 7: Empty
129+
EMPTY_SEQUENCE,
130+
131+
// 8: Block Erase
132+
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */,
133+
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
134+
TWO_EMPTY_STEPS,
135+
TWO_EMPTY_STEPS,
136+
TWO_EMPTY_STEPS),
137+
138+
// 9: ROM: Page program
139+
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */,
140+
RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */),
141+
142+
FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */,
143+
STOP, FLEXSPI_1PAD, 0),
144+
TWO_EMPTY_STEPS,
145+
TWO_EMPTY_STEPS),
146+
147+
// 10: Empty
148+
EMPTY_SEQUENCE,
149+
150+
// 11: ROM: Chip erase
151+
SEQUENCE(FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */,
152+
STOP, FLEXSPI_1PAD, 0),
153+
TWO_EMPTY_STEPS,
154+
TWO_EMPTY_STEPS,
155+
TWO_EMPTY_STEPS),
156+
157+
// 12: Empty
158+
EMPTY_SEQUENCE,
159+
160+
// 13: ROM: Read SFDP
161+
EMPTY_SEQUENCE,
162+
163+
// 14: ROM: Restore no cmd
164+
EMPTY_SEQUENCE,
165+
166+
// 15: ROM: Dummy
167+
EMPTY_SEQUENCE
168+
},
169+
},
170+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#define MICROPY_HW_BOARD_NAME "SparkFun Teensy MicroMod Processor"
2+
#define MICROPY_HW_MCU_NAME "IMXRT1062DVL6A"
3+
4+
// If you change this, then make sure to update the linker scripts as well to
5+
// make sure you don't overwrite code
6+
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
7+
8+
#define BOARD_FLASH_SIZE (16 * 1024 * 1024)
9+
10+
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO_AD_B1_00)
11+
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO_AD_B1_01)
12+
13+
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO_B0_03)
14+
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO_B0_02)
15+
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO_B0_01)
16+
17+
#define DEFAULT_UART_BUS_RX (&pin_GPIO_AD_B0_03)
18+
#define DEFAULT_UART_BUS_TX (&pin_GPIO_AD_B0_02)
19+
20+
#define CIRCUITPY_USB_DEVICE_INSTANCE 0
21+
#define CIRCUITPY_USB_HOST_INSTANCE 1
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
USB_VID = 0x1B4F
2+
USB_PID = 0x002E
3+
USB_PRODUCT = "Teensy MicroMod"
4+
USB_MANUFACTURER = "PJRC/Sparkfun"
5+
6+
CHIP_VARIANT = MIMXRT1062DVJ6A
7+
CHIP_FAMILY = MIMXRT1062
8+
FLASH = W25Q128JV
9+
CIRCUITPY__EVE = 1
10+
CIRCUITPY_USB_HOST = 1

0 commit comments

Comments
 (0)