Fix CPBlue LFCLKSRC; CPB has no status neopixel

This commit is contained in:
Dan Halbert 2019-08-22 01:04:00 -04:00
parent 42143ca056
commit d94023e9b3
6 changed files with 25 additions and 7 deletions

View File

@ -34,8 +34,6 @@
#define FLASH_SIZE (0x100000) #define FLASH_SIZE (0x100000)
#define FLASH_PAGE_SIZE (4096) #define FLASH_PAGE_SIZE (4096)
#define MICROPY_HW_NEOPIXEL (&pin_P0_13)
#define MICROPY_HW_LED_STATUS (&pin_P1_14) #define MICROPY_HW_LED_STATUS (&pin_P1_14)
#if QSPI_FLASH_FILESYSTEM #if QSPI_FLASH_FILESYSTEM

View File

@ -10,6 +10,9 @@ MCU_CHIP = nrf52840
SD ?= s140 SD ?= s140
SOFTDEV_VERSION ?= 6.1.0 SOFTDEV_VERSION ?= 6.1.0
# Unusually, board does not have a 32 kHz xtal.
BOARD_HAS_32KHZ_XTAL = 0
BOOT_SETTING_ADDR = 0xFF000 BOOT_SETTING_ADDR = 0xFF000
ifeq ($(SD),) ifeq ($(SD),)

View File

@ -47,8 +47,17 @@ STATIC void softdevice_assert_handler(uint32_t id, uint32_t pc, uint32_t info) {
STATIC uint32_t ble_stack_enable(void) { STATIC uint32_t ble_stack_enable(void) {
nrf_clock_lf_cfg_t clock_config = { nrf_clock_lf_cfg_t clock_config = {
.source = NRF_CLOCK_LF_SRC_XTAL, #if BOARD_HAS_32KHZ_XTAL
.accuracy = NRF_CLOCK_LF_ACCURACY_20_PPM .source = NRF_CLOCK_LF_SRC_XTAL,
.rc_ctiv = 0,
.rc_temp_ctiv = 0,
.accuracy = NRF_CLOCK_LF_ACCURACY_20_PPM
#else
.source = NRF_CLOCK_LF_SRC_RC,
.rc_ctiv = 16,
.rc_temp_ctiv = 2,
.accuracy = NRF_CLOCK_LF_ACCURACY_250_PPM
#endif
}; };
uint32_t err_code = sd_softdevice_enable(&clock_config, softdevice_assert_handler); uint32_t err_code = sd_softdevice_enable(&clock_config, softdevice_assert_handler);

View File

@ -183,7 +183,7 @@ void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self,
(self->props & CHAR_PROP_WRITE_NO_RESPONSE)); (self->props & CHAR_PROP_WRITE_NO_RESPONSE));
} else { } else {
if (self->fixed_length && bufinfo->len != self->max_length) { if (self->fixed_length && bufinfo->len != self->max_length) {
mp_raise_ValueError(translate("Value length required fixed length")); mp_raise_ValueError(translate("Value length != required fixed length"));
} }
if (bufinfo->len > self->max_length) { if (bufinfo->len > self->max_length) {
mp_raise_ValueError(translate("Value length > max_length")); mp_raise_ValueError(translate("Value length > max_length"));

View File

@ -28,6 +28,11 @@ CIRCUITPY_RTC = 1
# frequencyio not yet implemented # frequencyio not yet implemented
CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_FREQUENCYIO = 0
ifndef BOARD_HAS_32KHZ_XTAL
# Assume crystal is present, which is the most common case.
BOARD_HAS_32KHZ_XTAL = 1
endif
# CircuitPython doesn't yet support NFC so force the NFC antenna pins to be GPIO. # CircuitPython doesn't yet support NFC so force the NFC antenna pins to be GPIO.
# See https://github.com/adafruit/circuitpython/issues/1300 # See https://github.com/adafruit/circuitpython/issues/1300
# Defined here because system_nrf52840.c doesn't #include any of our own include files. # Defined here because system_nrf52840.c doesn't #include any of our own include files.

View File

@ -28,9 +28,12 @@
#include "nrfx.h" #include "nrfx.h"
void nrf_peripherals_clocks_init(void) { void nrf_peripherals_clocks_init(void) {
// Set low-frequency clock source to be crystal. If there's a crystalless board, this will need to be
// generalized. #if BOARD_HAS_32KHZ_XTAL
NRF_CLOCK->LFCLKSRC = (uint32_t)((CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos) & CLOCK_LFCLKSRC_SRC_Msk); NRF_CLOCK->LFCLKSRC = (uint32_t)((CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos) & CLOCK_LFCLKSRC_SRC_Msk);
#else
NRF_CLOCK->LFCLKSRC = (uint32_t)((CLOCK_LFCLKSRC_SRC_RC << CLOCK_LFCLKSRC_SRC_Pos) & CLOCK_LFCLKSRC_SRC_Msk);
#endif
NRF_CLOCK->TASKS_LFCLKSTART = 1UL; NRF_CLOCK->TASKS_LFCLKSTART = 1UL;
// Wait for clocks to start. // Wait for clocks to start.