|
|
|
@ -5,12 +5,9 @@
|
|
|
|
|
#define NRFX_POWER_ENABLED 1
|
|
|
|
|
#define NRFX_POWER_CONFIG_IRQ_PRIORITY 7
|
|
|
|
|
|
|
|
|
|
// Turn on nrfx supported workarounds for errata in Rev1/Rev2 of nRF52832
|
|
|
|
|
#ifdef NRF52832_XXAA
|
|
|
|
|
#define NRFX_SPIS_NRF52_ANOMALY_109_WORKAROUND_ENABLED 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// NOTE: THIS WORKAROUND CAUSES BLE CODE TO CRASH; tested on 2019-03-11.
|
|
|
|
|
// NOTE: THIS WORKAROUND CAUSES BLE CODE TO CRASH.
|
|
|
|
|
// It doesn't work with the SoftDevice.
|
|
|
|
|
// See https://devzone.nordicsemi.com/f/nordic-q-a/33982/sdk-15-software-crash-during-spi-session
|
|
|
|
|
// Turn on nrfx supported workarounds for errata in Rev1 of nRF52840
|
|
|
|
|
#ifdef NRF52840_XXAA
|
|
|
|
|
// #define NRFX_SPIM3_NRF52840_ANOMALY_198_WORKAROUND_ENABLED 1
|
|
|
|
@ -24,11 +21,26 @@
|
|
|
|
|
// so out of the box TWIM0/SPIM0 and TWIM1/SPIM1 cannot be shared
|
|
|
|
|
// between common-hal/busio/I2C.c and SPI.c.
|
|
|
|
|
// We could write an interrupt handler that checks whether it's
|
|
|
|
|
// being used for SPI or I2C, but perhaps two I2C's and 1-2 SPI's are good enough for now.
|
|
|
|
|
// being used for SPI or I2C, but perhaps one I2C and two SPI or two I2C and one SPI
|
|
|
|
|
// are good enough for now.
|
|
|
|
|
|
|
|
|
|
// CIRCUITPY_NRF_NUM_I2C is 1 or 2 to choose how many I2C (TWIM) peripherals
|
|
|
|
|
// to provide.
|
|
|
|
|
// This can go away once we have SPIM3 working: then we can have two
|
|
|
|
|
// I2C and two SPI.
|
|
|
|
|
#ifndef CIRCUITPY_NRF_NUM_I2C
|
|
|
|
|
#define CIRCUITPY_NRF_NUM_I2C 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if CIRCUITPY_NRF_NUM_I2C != 1 && CIRCUITPY_NRF_NUM_I2C != 2
|
|
|
|
|
# error CIRCUITPY_NRF_NUM_I2C must be 1 or 2
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Enable SPIM1, SPIM2 and SPIM3 (if available)
|
|
|
|
|
// No conflict with TWIM0.
|
|
|
|
|
#if CIRCUITPY_NRF_NUM_I2C == 1
|
|
|
|
|
#define NRFX_SPIM1_ENABLED 1
|
|
|
|
|
#endif
|
|
|
|
|
#define NRFX_SPIM2_ENABLED 1
|
|
|
|
|
// DON'T ENABLE SPIM3 DUE TO ANOMALY WORKAROUND FAILURE (SEE ABOVE).
|
|
|
|
|
// #ifdef NRF52840_XXAA
|
|
|
|
@ -45,10 +57,13 @@
|
|
|
|
|
// QSPI
|
|
|
|
|
#define NRFX_QSPI_ENABLED 1
|
|
|
|
|
|
|
|
|
|
// TWI aka. I2C; enable a single bus: TWIM0 (no conflict with SPIM1 and SPIM2)
|
|
|
|
|
// TWI aka. I2C; always enable TWIM0 (no conflict with SPIM1 and SPIM2)
|
|
|
|
|
#define NRFX_TWIM_ENABLED 1
|
|
|
|
|
#define NRFX_TWIM0_ENABLED 1
|
|
|
|
|
//#define NRFX_TWIM1_ENABLED 1
|
|
|
|
|
|
|
|
|
|
#if CIRCUITPY_NRF_NUM_I2C == 2
|
|
|
|
|
#define NRFX_TWIM1_ENABLED 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY 7
|
|
|
|
|
#define NRFX_TWIM_DEFAULT_CONFIG_FREQUENCY NRF_TWIM_FREQ_400K
|
|
|
|
|