updating pycubed firmware for mainboardv05 :)

This commit is contained in:
Max Holliday 2021-09-04 18:39:24 -06:00 committed by GitHub
parent 7ce3f25650
commit 674a3027fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 64 additions and 67 deletions

View File

@ -24,25 +24,12 @@
* THE SOFTWARE.
*/
#include <string.h>
#include "supervisor/board.h"
#include "py/mpconfig.h"
#include "shared-bindings/nvm/ByteArray.h"
#include "mpconfigboard.h"
#include "common-hal/microcontroller/Pin.h"
#include "hal/include/hal_gpio.h"
#include "shared-bindings/pwmio/PWMOut.h"
nvm_bytearray_obj_t bootcnt = {
.base = {
.type = &nvm_bytearray_type
},
.len = (uint32_t)8192,
.start_address = (uint8_t *)(0x00080000 - 8192)
};
void board_init(void) {
pwmio_pwmout_obj_t pwm;
common_hal_pwmio_pwmout_construct(&pwm, &pin_PA23, 4096, 2, false);
@ -54,8 +41,4 @@ bool board_requests_safe_mode(void) {
}
void reset_board(void) {
uint8_t value_out = 0;
common_hal_nvm_bytearray_get_bytes(&bootcnt,0,1,&value_out);
++value_out;
common_hal_nvm_bytearray_set_bytes(&bootcnt,0,&value_out,1);
}

View File

@ -1,9 +1,8 @@
#define MICROPY_HW_BOARD_NAME "PyCubedv04"
#define MICROPY_HW_BOARD_NAME "PyCubedv05"
#define MICROPY_HW_MCU_NAME "samd51j19"
#define CIRCUITPY_MCU_FAMILY samd51
#define MICROPY_HW_LED_STATUS (&pin_PA16)
#define MICROPY_HW_NEOPIXEL (&pin_PA21)
#define AUTORESET_DELAY_MS 500
@ -15,6 +14,8 @@
// External flash W25Q80DV
#define EXTERNAL_FLASH_QSPI_DUAL
#define CIRCUITPY_DRIVE_LABEL "PYCUBED"
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_PB13)

View File

@ -7,20 +7,29 @@ CHIP_VARIANT = SAMD51J19A
CHIP_FAMILY = samd51
QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = W25Q80DV
LONGINT_IMPL = MPZ
CIRCUITPY_DRIVE_LABEL = "PYCUBED"
CIRCUITPY_ULAB = 1
CIRCUITPY_BINASCII = 1
CIRCUITPY_SDCARDIO = 1
CIRCUITPY_JSON = 1
CIRCUITPY_MSGPACK = 1
# Not needed.
# no SAMD51 support... yet ;)
# CIRCUITPY_ALARM = 1
# CIRCUITPY_DUALBANK=1
# Not needed
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_BITMAPTOOLS = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_FRAMEBUFFERIO = 0
CIRCUITPY_KEYPAD = 0
CIRCUITPY_RGBMATRIX = 0
CIRCUITPY_PS2IO = 0
CIRCUITPY_BLEIO_HCI=0
CIRCUITPY_BLEIO=0
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD

View File

@ -1,5 +1,4 @@
#include "shared-bindings/board/__init__.h"
#include "supervisor/board.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
@ -7,20 +6,22 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA12) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_xSDCS), MP_ROM_PTR(&pin_PA27) },
{ MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_PA27) },
{ MP_ROM_QSTR(MP_QSTR_RELAY_A), MP_ROM_PTR(&pin_PB15) },
{ MP_ROM_QSTR(MP_QSTR_BURN1), MP_ROM_PTR(&pin_PB31) },
{ MP_ROM_QSTR(MP_QSTR_BURN2), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_EN_RF), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_AIN5), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_L1PROG), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_AIN4), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_AIN5), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_CHRG), MP_ROM_PTR(&pin_PB08) },
{ MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_PA16), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_PA17), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_PA18), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_VBUS_RST), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_PA19), MP_ROM_PTR(&pin_PA19) },
{ MP_ROM_QSTR(MP_QSTR_PA20), MP_ROM_PTR(&pin_PA20) },
{ MP_ROM_QSTR(MP_QSTR_PA22), MP_ROM_PTR(&pin_PA22) },
@ -31,20 +32,24 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_RF1_RST), MP_ROM_PTR(&pin_PB00) },
{ MP_ROM_QSTR(MP_QSTR_RF1_CS), MP_ROM_PTR(&pin_PB30) },
{ MP_ROM_QSTR(MP_QSTR_RF1_IO0), MP_ROM_PTR(&pin_PB05) },
{ MP_ROM_QSTR(MP_QSTR_RF1_IO4), MP_ROM_PTR(&pin_PB04) },
{ MP_ROM_QSTR(MP_QSTR_RF1_IO0), MP_ROM_PTR(&pin_PB05) },
{ MP_ROM_QSTR(MP_QSTR_RF2_RST), MP_ROM_PTR(&pin_PB14) },
{ MP_ROM_QSTR(MP_QSTR_RF2_IO0), MP_ROM_PTR(&pin_PB06) },
{ MP_ROM_QSTR(MP_QSTR_RF2_IO4), MP_ROM_PTR(&pin_PB07) },
{ MP_ROM_QSTR(MP_QSTR_RF2_CS), MP_ROM_PTR(&pin_PB09) },
{ MP_ROM_QSTR(MP_QSTR_RF2_IO1), MP_ROM_PTR(&pin_PB06) },
{ MP_ROM_QSTR(MP_QSTR_RF2_BSY), MP_ROM_PTR(&pin_PB07) },
{ MP_ROM_QSTR(MP_QSTR_RF2_RST), MP_ROM_PTR(&pin_PB14) },
{ MP_ROM_QSTR(MP_QSTR_EN_GPS), MP_ROM_PTR(&pin_PB01) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB02) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB03) },
{ MP_ROM_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB12) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB13) },
{ MP_ROM_QSTR(MP_QSTR_SCL2), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_SDA2), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_WDT_WDI), MP_ROM_PTR(&pin_PA23) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA21) },

View File

@ -24,25 +24,12 @@
* THE SOFTWARE.
*/
#include <string.h>
#include "supervisor/board.h"
#include "py/mpconfig.h"
#include "shared-bindings/nvm/ByteArray.h"
#include "mpconfigboard.h"
#include "common-hal/microcontroller/Pin.h"
#include "hal/include/hal_gpio.h"
#include "shared-bindings/pwmio/PWMOut.h"
nvm_bytearray_obj_t bootcnt = {
.base = {
.type = &nvm_bytearray_type
},
.len = (uint32_t)8192,
.start_address = (uint8_t *)(0x00080000 - 8192)
};
void board_init(void) {
pwmio_pwmout_obj_t pwm;
common_hal_pwmio_pwmout_construct(&pwm, &pin_PA23, 4096, 2, false);
@ -54,8 +41,4 @@ bool board_requests_safe_mode(void) {
}
void reset_board(void) {
uint8_t value_out = 0;
common_hal_nvm_bytearray_get_bytes(&bootcnt,0,1,&value_out);
++value_out;
common_hal_nvm_bytearray_set_bytes(&bootcnt,0,&value_out,1);
}

View File

@ -1,8 +1,8 @@
#define MICROPY_HW_BOARD_NAME "PyCubedv04-MRAM"
#define MICROPY_HW_BOARD_NAME "PyCubedv05-MRAM"
#define MICROPY_HW_MCU_NAME "samd51j19"
#define CIRCUITPY_MCU_FAMILY samd51
#define MICROPY_HW_LED_STATUS (&pin_PA16)
#define MICROPY_HW_NEOPIXEL (&pin_PA21)
// External flash MR2xH40 MRAM
@ -15,6 +15,8 @@
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define CIRCUITPY_DRIVE_LABEL "PYCUBED"
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_PB13)

View File

@ -10,17 +10,25 @@ QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = MR2xH40
LONGINT_IMPL = MPZ
CIRCUITPY_DRIVE_LABEL = "PYCUBED"
CIRCUITPY_ULAB = 1
CIRCUITPY_BINASCII = 1
CIRCUITPY_SDCARDIO = 1
CIRCUITPY_JSON = 1
CIRCUITPY_MSGPACK = 1
# Not needed.
# no SAMD51 support... yet ;)
# CIRCUITPY_ALARM = 1
# CIRCUITPY_DUALBANK=1
# Not needed
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_BITMAPTOOLS = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_FRAMEBUFFERIO = 0
CIRCUITPY_KEYPAD = 0
CIRCUITPY_RGBMATRIX = 0
CIRCUITPY_PS2IO = 0
CIRCUITPY_BLEIO_HCI=0
CIRCUITPY_BLEIO=0
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD

View File

@ -7,20 +7,22 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA12) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_xSDCS), MP_ROM_PTR(&pin_PA27) },
{ MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_PA27) },
{ MP_ROM_QSTR(MP_QSTR_RELAY_A), MP_ROM_PTR(&pin_PB15) },
{ MP_ROM_QSTR(MP_QSTR_BURN1), MP_ROM_PTR(&pin_PB31) },
{ MP_ROM_QSTR(MP_QSTR_BURN2), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_EN_RF), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_AIN5), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_L1PROG), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_AIN4), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_AIN5), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_CHRG), MP_ROM_PTR(&pin_PB08) },
{ MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_PA16), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_PA17), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_PA18), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_VBUS_RST), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_PA19), MP_ROM_PTR(&pin_PA19) },
{ MP_ROM_QSTR(MP_QSTR_PA20), MP_ROM_PTR(&pin_PA20) },
{ MP_ROM_QSTR(MP_QSTR_PA22), MP_ROM_PTR(&pin_PA22) },
@ -31,20 +33,24 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_RF1_RST), MP_ROM_PTR(&pin_PB00) },
{ MP_ROM_QSTR(MP_QSTR_RF1_CS), MP_ROM_PTR(&pin_PB30) },
{ MP_ROM_QSTR(MP_QSTR_RF1_IO0), MP_ROM_PTR(&pin_PB05) },
{ MP_ROM_QSTR(MP_QSTR_RF1_IO4), MP_ROM_PTR(&pin_PB04) },
{ MP_ROM_QSTR(MP_QSTR_RF1_IO0), MP_ROM_PTR(&pin_PB05) },
{ MP_ROM_QSTR(MP_QSTR_RF2_RST), MP_ROM_PTR(&pin_PB14) },
{ MP_ROM_QSTR(MP_QSTR_RF2_IO0), MP_ROM_PTR(&pin_PB06) },
{ MP_ROM_QSTR(MP_QSTR_RF2_IO4), MP_ROM_PTR(&pin_PB07) },
{ MP_ROM_QSTR(MP_QSTR_RF2_CS), MP_ROM_PTR(&pin_PB09) },
{ MP_ROM_QSTR(MP_QSTR_RF2_IO1), MP_ROM_PTR(&pin_PB06) },
{ MP_ROM_QSTR(MP_QSTR_RF2_BSY), MP_ROM_PTR(&pin_PB07) },
{ MP_ROM_QSTR(MP_QSTR_RF2_RST), MP_ROM_PTR(&pin_PB14) },
{ MP_ROM_QSTR(MP_QSTR_EN_GPS), MP_ROM_PTR(&pin_PB01) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB02) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB03) },
{ MP_ROM_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB12) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB13) },
{ MP_ROM_QSTR(MP_QSTR_SCL2), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_SDA2), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_WDT_WDI), MP_ROM_PTR(&pin_PA23) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA21) },