Merge pull request #569 from andrzej-kaczmarek/nimble-phy-fix

nimble/phy: Various fixes

X-Original-Commit: c5a8a91549186ea0f12d75647371a3944301a29b
This commit is contained in:
Andrzej Kaczmarek
2017-09-26 21:58:48 +02:00
committed by GitHub
+16 -9
View File
@@ -200,6 +200,21 @@ ble_phy_mode_pdu_start_off(int phy_mode)
void
ble_phy_mode_set(int cur_phy_mode, int txtorx_phy_mode)
{
#if MYNEWT_VAL(BSP_NRF52840)
/*
* nRF52840 Engineering A Errata v1.2
* [164] RADIO: Low sensitivity in long range mode
*/
if ((cur_phy_mode == BLE_PHY_MODE_CODED_125KBPS) ||
(cur_phy_mode == BLE_PHY_MODE_CODED_500KBPS)) {
*(volatile uint32_t *)0x4000173C |= 0x80000000;
*(volatile uint32_t *)0x4000173C = ((*(volatile uint32_t *)0x4000173C &
0xFFFFFF00) | 0x5C);
} else {
*(volatile uint32_t *)0x4000173C &= ~0x80000000;
}
#endif
if (cur_phy_mode == BLE_PHY_MODE_1M) {
NRF_RADIO->MODE = RADIO_MODE_MODE_Ble_1Mbit;
NRF_RADIO->PCNF0 = g_ble_phy_data.phy_pcnf0 |
@@ -615,7 +630,6 @@ ble_phy_tx_end_isr(void)
#endif
uint8_t was_encrypted;
uint8_t transition;
uint8_t txlen;
uint32_t wfr_time;
/* If this transmission was encrypted we need to remember it */
@@ -627,6 +641,7 @@ ble_phy_tx_end_isr(void)
/* Log the event */
ble_ll_log(BLE_LL_LOG_ID_PHY_TXEND, g_ble_phy_data.phy_tx_pyld_len,
was_encrypted, NRF_TIMER0->CC[2]);
(void)was_encrypted;
/* Clear events and clear interrupt on disabled event */
NRF_RADIO->EVENTS_DISABLED = 0;
@@ -667,14 +682,6 @@ ble_phy_tx_end_isr(void)
/* Packet pointer needs to be reset. */
ble_phy_rx_xcvr_setup();
/*
* Enable the wait for response timer. Note that cc #1 on
* timer 0 contains the transmit start time
*/
txlen = g_ble_phy_data.phy_tx_pyld_len;
if (txlen && was_encrypted) {
txlen += BLE_LL_DATA_MIC_LEN;
}
ble_phy_wfr_enable(BLE_PHY_WFR_ENABLE_TXRX, 0);
} else {
/*