Skip to content

Commit ce21a30

Browse files
authored
NRF5: Add nrf52805 support (#1461)
* Exclude cache for NRF52805 * Check and handle unsupported modulation rates * Make PPI channel selection dynamic, based chip specific channel count
1 parent 8903b93 commit ce21a30

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

MyConfig.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,11 @@
543543
* - NRF5_BLE_1MBPS for 1Mbps BLE modulation
544544
*/
545545
#ifndef MY_NRF5_ESB_MODE
546+
#ifdef NRF5_250KBPS
546547
#define MY_NRF5_ESB_MODE (NRF5_250KBPS)
548+
#else
549+
#define MY_NRF5_ESB_MODE (NRF5_1MBPS)
550+
#endif
547551
#endif
548552

549553
/**

hal/architecture/NRF5/MyHwNRF5.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ bool hwInit(void)
9999
NRF_POWER->TASKS_CONSTLAT = 1;
100100

101101
// Enable cache on >= NRF52
102-
#ifndef NRF51
102+
#if !defined(NRF51) && !defined(NRF52805_XXAA)
103103
NRF_NVMC->ICACHECNF = NVMC_ICACHECNF_CACHEEN_Msk;
104104
#endif
105105

hal/transport/NRF5_ESB/driver/Radio.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ typedef enum {
6565
typedef enum {
6666
NRF5_1MBPS = RADIO_MODE_MODE_Nrf_1Mbit,
6767
NRF5_2MBPS = RADIO_MODE_MODE_Nrf_2Mbit,
68+
#ifdef RADIO_MODE_MODE_Nrf_250Kbit
6869
NRF5_250KBPS = RADIO_MODE_MODE_Nrf_250Kbit, // Deprecated!!!
70+
#endif
6971
NRF5_BLE_1MBPS = RADIO_MODE_MODE_Ble_1Mbit,
7072
} nrf5_mode_e;
7173

hal/transport/NRF5_ESB/driver/Radio_ESB.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,12 @@ static inline uint8_t NRF5_ESB_byte_time()
551551
return (3);
552552
} else if (MY_NRF5_ESB_MODE == NRF5_2MBPS) {
553553
return (2);
554-
} else if (MY_NRF5_ESB_MODE == NRF5_250KBPS) {
554+
}
555+
#ifdef NRF5_250KBPS
556+
else if (MY_NRF5_ESB_MODE == NRF5_250KBPS) {
555557
return (5);
556558
}
559+
#endif
557560
}
558561

559562
extern "C" {

hal/transport/NRF5_ESB/driver/Radio_ESB.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,19 @@
103103
RADIO_SHORTS_READY_START_Msk | \
104104
RADIO_SHORTS_ADDRESS_RSSISTART_Msk | RADIO_SHORTS_DISABLED_RSSISTOP_Msk)
105105

106-
// PPI Channels for TX
106+
/** PPI Channels for TX
107+
* Not all NRF5 modules have the same number of PPI channels
108+
* For regular PPI, select the highest possible channels
109+
*/
110+
#define NRF5_ESB_PPI_LAST_CHANNEL (PPI_CH_NUM - 1)
107111
#if (NRF5_RADIO_TIMER_IRQN != TIMER0_IRQn)
108112
// Use two regular PPI channels
109-
#define NRF5_ESB_PPI_TIMER_START 14
110-
#define NRF5_ESB_PPI_TIMER_RADIO_DISABLE 15
113+
#define NRF5_ESB_PPI_TIMER_START (NRF5_ESB_PPI_LAST_CHANNEL - 1)
114+
#define NRF5_ESB_PPI_TIMER_RADIO_DISABLE (NRF5_ESB_PPI_LAST_CHANNEL)
111115
#else
112116
// Use one regular PPI channel and one predefined PPI channel
113117
#define NRF5_ESB_USE_PREDEFINED_PPI
114-
#define NRF5_ESB_PPI_TIMER_START 15
118+
#define NRF5_ESB_PPI_TIMER_START (NRF5_ESB_PPI_LAST_CHANNEL)
115119
#define NRF5_ESB_PPI_TIMER_RADIO_DISABLE 22
116120
#endif
117121
#define NRF5_ESB_PPI_BITS \

0 commit comments

Comments
 (0)