This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Dynamic multiprotocol, implement radio driver to Ble uart example.

Hello,

My previous question is this.

I try to implement sample application with Radio Driver 1.1.0 to SDK15.0.0 ble peripheral uart example.

Symptom

For few micro seconds, nrf_802154_transmit works.

But after this, nrf_802154_transmit always returns failure.

Enviroments

Keil / Windows10 / SDK15.0.0  / Radio Driver 1.1.0 / nRF52840-Preview-DK / s140_nrf52_6.0.0_softdevice.hex

Source Define

preprocessor - 

DEBUG_LOG ENABLE_DEBUG_LOG=1 RAAL_SOFTDEVICE=1 NRF52840_AAAA=1 BOARD_PCA10056 CONFIG_GPIO_AS_PINRESET FLOAT_ABI_HARD NRF52840_XXAA NRF_SD_BLE_API_VERSION=6 S140 SOFTDEVICE_PRESENT SWI_DISABLE0 __HEAP_SIZE=8192 __STACK_SIZE=8192

nrf_802154_config.h - 

NRF_802154_USE_RAW_API 0
Import Files

I follow this link.

SoftDevice

  • nrf_802154_notification_swi.c
  • nrf_802154_priority_drop_swi.c
  • nrf_802154_request_swi.c
  • nrf_802154_swi.c
  • nrf_802154_swi.h
  • raal/softdevice/nrf_raal_softdevice.c
  • raal/softdevice/nrf_raal_softdevice.h

Clock

  • platform/clock/nrf_802154_clock_nodrv.c - uses the CLOCK peripheral directly <- using

Temperature

  • platform/temperature/nrf_802154_temperature_none.c - reports dummy temperature 20° C, does not allow to use temperature RSSI correction by the driver <- using

Timer

  • platform/timer/nrf_802154_timer_nodrv.c - uses an RTC peripheral as clock source for the timer module <- using
Source
int main(void)
{
    bool erase_bonds;
    // Initialize.
    uart_init();
    log_init();
    timers_init();
    buttons_leds_init(&erase_bonds);
    power_management_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();
    advertising_start();
    printf("\r\advertising_start.\r\n");
    NRF_LOG_INFO("Debug logging for UART over RTT started.");


    uint8_t message[MAX_MESSAGE_SIZE + 1];
    memset(message, 0, sizeof(message));

    for (uint32_t i = 0; i < sizeof(message) / sizeof(message[0]); i++)
    {
        message[i] = i;
    }

    message[0] = 0x41;                // Set MAC header: short addresses, no ACK
    message[1] = 0x98;                // Set MAC header
    message[5] = 0xff;
    message[6] = 0xff;
    m_tx_in_progress = false;
    m_tx_done        = false;
    
    nrf_802154_init();
    uint8_t short_addr[] = {0x12, 0x34};
    nrf_802154_short_address_set(short_addr);
    uint8_t pan_id[] = {0x11, 0x22};
    nrf_802154_pan_id_set(pan_id);
    nrf_802154_channel_set(CHANNEL);

    nrf_802154_receive();
    printf("\r\n802154 init.\r\n");
    m_tx_start = true;
    
    while (1)
    {
        if (m_tx_done)
        {
            m_tx_in_progress = false;
            m_tx_done        = false;
            printf("TX DONE !! \r\n");
        }

        if (!m_tx_in_progress)
        {
            m_tx_in_progress = nrf_802154_transmit(message, MAX_MESSAGE_SIZE, false);
        }
    }
    
}

void nrf_802154_transmitted(const uint8_t * p_frame,
                                       uint8_t       * p_ack,
                                       uint8_t          length,
                                       int8_t          power,
                                       uint8_t         lqi)
{
    (void) power;
    (void) lqi;
    test = 0;
    m_tx_done = true;
    
    if (p_ack != NULL)
    {
        printf("ack len : %d \r\n", length);
        //printf("p_ack is not null, length : %d \r\n", length);
        nrf_802154_buffer_free(p_ack);
    }
    
    if (p_frame != NULL)
    {
        printf("p_frame is not null \r\n");
    }
    //init_802154 = false;
}

void nrf_802154_transmit_failed(const uint8_t * p_frame, nrf_802154_tx_error_t error)
{
    (void)p_frame;
    (void)error;
    test = 0;
    m_tx_done = true;

    printf("FAIL \r\n");
}
Related