From 4b4fee8b78de1dff7e37ebf1aac9d7b08146526b Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Thu, 8 Jun 2017 20:58:19 +0200 Subject: [PATCH 1/7] nrf/boards: Adding RTC and Timer module and HAL to pca10000. --- nrf/boards/pca10000/mpconfigboard.h | 4 ++++ nrf/boards/pca10000/nrf51_hal_conf.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/nrf/boards/pca10000/mpconfigboard.h b/nrf/boards/pca10000/mpconfigboard.h index a2a8a3a36d..46efdad307 100644 --- a/nrf/boards/pca10000/mpconfigboard.h +++ b/nrf/boards/pca10000/mpconfigboard.h @@ -31,6 +31,10 @@ #define MICROPY_PY_SYS_PLATFORM "nrf51-dongle" #define MICROPY_PY_MACHINE_HW_SPI (0) +#define MICROPY_PY_MACHINE_TIMER (1) +#define MICROPY_PY_MACHINE_RTC (1) +#define MICROPY_PY_MACHINE_I2C (0) +#define MICROPY_PY_MACHINE_ADC (0) #define MICROPY_PY_MACHINE_TEMP (1) #define MICROPY_HW_HAS_LED (1) diff --git a/nrf/boards/pca10000/nrf51_hal_conf.h b/nrf/boards/pca10000/nrf51_hal_conf.h index c1ac8268ea..484fb8c38f 100644 --- a/nrf/boards/pca10000/nrf51_hal_conf.h +++ b/nrf/boards/pca10000/nrf51_hal_conf.h @@ -2,6 +2,8 @@ #define NRF51_HAL_CONF_H__ #define HAL_UART_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_TIMER_MODULE_ENABLED #define HAL_TIME_MODULE_ENABLED #define HAL_TEMP_MODULE_ENABLED From 362e2946a57ce16ded2ef2b2c85e74c41fb04768 Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Thu, 8 Jun 2017 21:06:27 +0200 Subject: [PATCH 2/7] nrf/boards: Activate RTC, Timer, I2C and ADC module and HAL on pca10001. --- nrf/boards/pca10001/mpconfigboard.h | 4 ++++ nrf/boards/pca10001/nrf51_hal_conf.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/nrf/boards/pca10001/mpconfigboard.h b/nrf/boards/pca10001/mpconfigboard.h index 0ef5a2492d..bd49876862 100644 --- a/nrf/boards/pca10001/mpconfigboard.h +++ b/nrf/boards/pca10001/mpconfigboard.h @@ -31,6 +31,10 @@ #define MICROPY_PY_SYS_PLATFORM "nrf51-DK" #define MICROPY_PY_MACHINE_HW_SPI (0) +#define MICROPY_PY_MACHINE_TIMER (1) +#define MICROPY_PY_MACHINE_RTC (1) +#define MICROPY_PY_MACHINE_I2C (1) +#define MICROPY_PY_MACHINE_ADC (1) #define MICROPY_PY_MACHINE_TEMP (1) #define MICROPY_HW_HAS_LED (1) diff --git a/nrf/boards/pca10001/nrf51_hal_conf.h b/nrf/boards/pca10001/nrf51_hal_conf.h index f5a1c6adb8..e83e2d346e 100644 --- a/nrf/boards/pca10001/nrf51_hal_conf.h +++ b/nrf/boards/pca10001/nrf51_hal_conf.h @@ -2,7 +2,7 @@ #define NRF51_HAL_CONF_H__ #define HAL_UART_MODULE_ENABLED -// #define HAL_SPI_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED #define HAL_TIME_MODULE_ENABLED #define HAL_RTC_MODULE_ENABLED #define HAL_TIMER_MODULE_ENABLED From 8906084d8014c6257772999a91e6315672dddbee Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Thu, 8 Jun 2017 21:23:30 +0200 Subject: [PATCH 3/7] nrf/boards: Activate RTC, Timer, I2C, ADC and HW_SPI module and HAL on pca10031. --- nrf/boards/pca10031/mpconfigboard.h | 5 +++++ nrf/boards/pca10031/nrf51_hal_conf.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/nrf/boards/pca10031/mpconfigboard.h b/nrf/boards/pca10031/mpconfigboard.h index 06de2e6440..d8b69e2ede 100644 --- a/nrf/boards/pca10031/mpconfigboard.h +++ b/nrf/boards/pca10031/mpconfigboard.h @@ -30,6 +30,11 @@ #define MICROPY_HW_MCU_NAME "NRF51822" #define MICROPY_PY_SYS_PLATFORM "nrf51-dongle" +#define MICROPY_PY_MACHINE_HW_SPI (1) +#define MICROPY_PY_MACHINE_TIMER (1) +#define MICROPY_PY_MACHINE_RTC (1) +#define MICROPY_PY_MACHINE_I2C (1) +#define MICROPY_PY_MACHINE_ADC (1) #define MICROPY_PY_MACHINE_TEMP (1) #define MICROPY_HW_HAS_LED (1) diff --git a/nrf/boards/pca10031/nrf51_hal_conf.h b/nrf/boards/pca10031/nrf51_hal_conf.h index ecc150fe9e..e83e2d346e 100644 --- a/nrf/boards/pca10031/nrf51_hal_conf.h +++ b/nrf/boards/pca10031/nrf51_hal_conf.h @@ -4,6 +4,10 @@ #define HAL_UART_MODULE_ENABLED #define HAL_SPI_MODULE_ENABLED #define HAL_TIME_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_TIMER_MODULE_ENABLED +#define HAL_TWI_MODULE_ENABLED +#define HAL_ADC_MODULE_ENABLED #define HAL_TEMP_MODULE_ENABLED #endif // NRF51_HAL_CONF_H__ From 5d28a99114b495352655470ab022f0fe28c99cb9 Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Thu, 8 Jun 2017 21:42:13 +0200 Subject: [PATCH 4/7] nrf/boards: Activate RTC and Timer module and HAL on pca10056. Also swapping out UART with UART DMA variant on this target board. --- nrf/boards/pca10056/mpconfigboard.h | 2 ++ nrf/boards/pca10056/nrf52_hal_conf.h | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/nrf/boards/pca10056/mpconfigboard.h b/nrf/boards/pca10056/mpconfigboard.h index 05cf1a7be0..b28112a186 100644 --- a/nrf/boards/pca10056/mpconfigboard.h +++ b/nrf/boards/pca10056/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_PY_MACHINE_HW_PWM (1) #define MICROPY_PY_MACHINE_HW_SPI (1) +#define MICROPY_PY_MACHINE_TIMER (1) +#define MICROPY_PY_MACHINE_RTC (1) #define MICROPY_PY_MACHINE_I2C (1) #define MICROPY_PY_MACHINE_ADC (1) #define MICROPY_PY_MACHINE_TEMP (1) diff --git a/nrf/boards/pca10056/nrf52_hal_conf.h b/nrf/boards/pca10056/nrf52_hal_conf.h index 585506b8d6..0db35d615b 100644 --- a/nrf/boards/pca10056/nrf52_hal_conf.h +++ b/nrf/boards/pca10056/nrf52_hal_conf.h @@ -1,7 +1,7 @@ #ifndef NRF52_HAL_CONF_H__ #define NRF52_HAL_CONF_H__ -#define HAL_UART_MODULE_ENABLED +// #define HAL_UART_MODULE_ENABLED #define HAL_SPI_MODULE_ENABLED #define HAL_TIME_MODULE_ENABLED #define HAL_PWM_MODULE_ENABLED @@ -10,7 +10,7 @@ #define HAL_TWI_MODULE_ENABLED #define HAL_ADCE_MODULE_ENABLED #define HAL_TEMP_MODULE_ENABLED -// #define HAL_UARTE_MODULE_ENABLED +#define HAL_UARTE_MODULE_ENABLED // #define HAL_SPIE_MODULE_ENABLED // #define HAL_TWIE_MODULE_ENABLED From 708571834a7a0c92273e628c2854b4ebefad3f4f Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Thu, 8 Jun 2017 23:36:26 +0200 Subject: [PATCH 5/7] nrf/examples: Update ssd1306 modification example to import correct class. --- nrf/examples/ssd1306_mod.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nrf/examples/ssd1306_mod.py b/nrf/examples/ssd1306_mod.py index 5480c646c2..0cee2c2a67 100644 --- a/nrf/examples/ssd1306_mod.py +++ b/nrf/examples/ssd1306_mod.py @@ -14,7 +14,7 @@ # Example usage of SSD1306_I2C on pca10040 # # from machine import Pin, I2C -# from ssd1306 import SSD1306_I2C +# from ssd1306_mod import SSD1306_I2C_Mod # i2c = I2C(0, Pin.board.PA3, Pin.board.PA4) # disp = SSD1306_I2C_Mod(128, 64, i2c) From 30b27b1370a113241a9ee218a74ef0c322164741 Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Fri, 9 Jun 2017 00:06:26 +0200 Subject: [PATCH 6/7] nrf/boards: Correcting feather52 I2C SDA pin assigned to the board. --- nrf/boards/feather52/pins.csv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nrf/boards/feather52/pins.csv b/nrf/boards/feather52/pins.csv index 9ac45403c3..b7017602a7 100644 --- a/nrf/boards/feather52/pins.csv +++ b/nrf/boards/feather52/pins.csv @@ -16,9 +16,9 @@ PA16,PA16 LED1,PA17 LED2,PA19 PA20,PA20 -PA25,PA25 +I2C_SDA,PA25 I2C_SCL,PA26 -I2C_SDA,PA27 +PA27,PA27 PA28,PA28,ADC0_IN4 PA29,PA29,ADC0_IN5 PA30,PA30,ADC0_IN6 From 72a564b065ba26f143c82ec62b9a784088733a9c Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Fri, 9 Jun 2017 00:48:37 +0200 Subject: [PATCH 7/7] nrf/boards: Updating microbit pin mapping for SPI and I2C. --- nrf/boards/microbit/mpconfigboard.h | 6 +++--- nrf/boards/microbit/pins.csv | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/nrf/boards/microbit/mpconfigboard.h b/nrf/boards/microbit/mpconfigboard.h index 5985d04661..935a0049b7 100644 --- a/nrf/boards/microbit/mpconfigboard.h +++ b/nrf/boards/microbit/mpconfigboard.h @@ -60,9 +60,9 @@ // SPI0 config #define MICROPY_HW_SPI0_NAME "SPI0" -#define MICROPY_HW_SPI0_SCK (pin_A13) -#define MICROPY_HW_SPI0_MOSI (pin_A15) -#define MICROPY_HW_SPI0_MISO (pin_A14) +#define MICROPY_HW_SPI0_SCK (pin_A23) +#define MICROPY_HW_SPI0_MOSI (pin_A21) +#define MICROPY_HW_SPI0_MISO (pin_A22) // micro:bit music pin #define MICROPY_HW_MUSIC_PIN (pin_A3) diff --git a/nrf/boards/microbit/pins.csv b/nrf/boards/microbit/pins.csv index 2b16969869..bb118c30a8 100644 --- a/nrf/boards/microbit/pins.csv +++ b/nrf/boards/microbit/pins.csv @@ -1,4 +1,4 @@ -PA0,PA0 +I2C_SCL,PA0 PA1,PA1 PA2,PA2 PA3,PA3 @@ -19,14 +19,14 @@ PA17,PA17 PA18,PA18 PA19,PA19 PA20,PA20 -PA21,PA21 -PA22,PA22 -PA23,PA23 +SPI_MOSI,PA21 +SPI_MISO,PA22 +SPI_SCK,PA23 PA24,PA24 PA25,PA25 PA26,PA26 PA27,PA27 PA28,PA28 PA29,PA29 -PA30,PA30 -PA31,PA31 \ No newline at end of file +I2C_SDA,PA30 +PA31,PA31