Skip to content

nrfx 2.11.0 to 3.0.0

nika-nordic edited this page Apr 27, 2023 · 1 revision

nrfx 3.0 introduces API changes. This guide lists actions required to make your code compatible with these changes.

HALs

CACHE

  • Encapsulated the following parameters:

    • The set and way cache parameters in the nrf_cache_set_way_loc_t structure
    • The word cache data parameter in the nrf_cache_du_word_loc_t structure

    Action: update the nrf_cache_data_get(), nrf_cache_tag_get(), nrf_cache_line_validity_check() functions calls to use new structures instead of the set, way, word parameters.

CCM

  • Changed a type of the p_data parameter in the nrf_ccm_cnfptr_set() function to nrf_ccm_cnf_t.
    Action: update the affected code.
  • Changed a returned type of the nrf_ccm_cnfptr_get() function to nrf_ccm_cnf_t.
    Action: update the affected code.

CLOCK

  • Changed names of constants in the nrf_clock_lfclk_t enumerator to uppercase.
    Action: update the affected code.

COMP

  • Changed names of the following nrf_comp_ref_t enumerator constants:

    • NRF_COMP_REF_Int1V2 to NRF_COMP_REF_INT_1V2
    • NRF_COMP_REF_Int1V8 to NRF_COMP_REF_INT_1V8
    • NRF_COMP_REF_Int2V4 to NRF_COMP_REF_INT_2V4
    • NRF_COMP_REF_ARef to NRF_COMP_REF_AREF

    Action: update the affected code.

  • Changed names of constants in nrf_comp_main_mode_t, nrf_comp_hyst_t, nrf_comp_sp_mode_t, nrf_isource_t enumerators to uppercase.
    Action: update the affected code.

GPIO

  • Replaced the nrf_gpio_pin_mcusel_t enumerator with nrf_gpio_pin_sel_t.
    Action: replace all NRF_GPIO_PIN_MCUSEL_* symbols with NRF_GPIO_PIN_SEL_*.
  • Removed the deprecated nrf_gpio_pin_mcu_select() function.
    Action: use the nrf_gpio_pin_control_select() function instead.

I2S

  • Changed parameters in the nrf_i2s_pins_set() function to a pointer to the nrf_i2s_pins_t structure.
    Action: update the function calls to pass the I2S pins structure instead of individual parameters.
  • Changed parameters in the nrf_i2s_configure() function to a pointer to the nrf_i2s_config_t structure.
    Action: update the function calls to pass the I2S configuration structure instead of individual parameters.

QDEC

  • Changed names of constants in the nrf_qdec_sampleper_t enumerator to uppercase.
    Action: align symbols names in the affected code.
  • Removed the deprecated nrf_qdec_pio_assign() function.
    Action: use the nrf_qdec_pins_set() function instead.
  • Changed a name of the NRF_QDEC_LED_NOT_CONNECTED symbol to NRF_QDEC_PIN_NOT_CONNECTED.
    Action: update the affected code.

QSPI

  • Changed types of all members in the nrf_qspi_pins_t structure to uint32_t.
    Action: update the affected code.

RTC

  • Changed names of the following symbols:

    • RTC_FREQ_TO_PRESCALER() to NRF_RTC_FREQ_TO_PRESCALER()
    • RTC_WRAP() to NRF_RTC_WRAP()
    • RTC_CHANNEL_INT_MASK() to NRF_RTC_CHANNEL_INT_MASK()
    • RTC_INPUT_FREQ to NRF_RTC_INPUT_FREQ
    • RTC_CHANNEL_EVENT_ADDR to NRF_RTC_CHANNEL_EVENT_ADDR

    Action: update the affected code.

TIMER

  • Removed the deprecated nrf_timer_frequency_set() and nrf_timer_frequency_get() functions.
    Action: use nrf_timer_prescaler_set() and nrf_timer_prescaler_get() instead.
  • Changed a type of the channel parameter to uint8_t in the nrf_timer_capture_task_get(), nrf_timer_compare_event_get(), nrf_timer_compare_int_get() functions.
    Action: update the affected code.

WDT

  • Changed the nrf_wdt_behaviour_t type to nrf_wdt_behaviour_mask_t and added the _MASK suffix to all previously available elements in nrf_wdt_behaviour_t.
    Action: update the affected code.

  • Changed names of the following functions:

    • nrf_wdt_started() to nrf_wdt_started_check()
    • nrf_wdt_request_status() to nrf_wdt_request_status_check()
    • nrf_wdt_reload_request_is_enabled() to nrf_wdt_reload_request_enable_check()

    Action: update the affected code.

Drivers

COMP

  • Changed a name of the NRFX_VOLTAGE_THRESHOLD_TO_INT() macro to NRFX_COMP_VOLTAGE_THRESHOLD_TO_INT().
    Action: update the affected code.

GPIOTE

  • Removed the nrfx_gpiote_out_init(), nrfx_gpiote_out_prealloc_init() functions used for configuring an output pin to be controlled either by a GPIO OUT register or GPIOTE task.
    Action: change the following part of the code:

    nrfx_gpiote_out_config_t config = NRFX_GPIOTE_CONFIG_OUT_TASK_TOGGLE(init_high);
    err = nrfx_gpiote_out_init(pin, &config);
    

    to:

    uint8_t task_channel;
    err = nrfx_gpiote_channel_alloc(&task_channel);
    
    nrfx_gpiote_output_config_t config = NRFX_GPIOTE_DEFAULT_OUTPUT_CONFIG;
    nrfx_gpiote_task_config_t task_config = {
        .task_ch = task_channel,
        .polarity = NRF_GPIOTE_POLARITY_TOGGLE,
        .init_val = NRF_GPIOTE_INITIAL_VALUE_HIGH
    };
    
    err = nrfx_gpiote_output_configure(pin, &config, &task_config);
    
  • Removed the nrfx_gpiote_in_init(), nrfx_gpiote_in_prealloc_init() functions used for configuring an input pin to utilize GPIOTE IN or PORT events.
    Action: change the following part of the code:

    nrfx_gpiote_in_config_t config = NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);
    err = nrfx_gpiote_in_init(pin, &config, evt_handler);
    

    to:

    uint8_t evt_channel;
    err = nrfx_gpiote_channel_alloc(&evt_channel);
    
    nrfx_gpiote_input_config_t config = NRFX_GPIOTE_DEFAULT_INPUT_CONFIG;
    nrfx_gpiote_trigger_config_t trigger_config = {
        .trigger = NRFX_GPIOTE_TRIGGER_LOTOHI,
        .p_in_channel = evt_channel
    };
    nrfx_gpiote_handler_config_t handler_config = {
        .handler = evt_handler,
        .p_context = user_context
    };
    
    err = nrfx_gpiote_input_configure(pin, &config, &trigger_config, &handler_config);
    
  • Removed the nrfx_gpiote_in_uninit(), nrfx_gpiote_out_uninit() functions.
    Action: use the nrfx_gpiote_pin_uninit() function instead. If a channel (a task or event) is used, it should be freed explicitly by the user by calling the nrfx_gpiote_channel_free() function.

  • Changed names of the nrfx_gpiote_in_event_*() functions to nrfx_gpiote_trigger_*().
    Action: update the affected code.

  • Changed a name of the nrfx_gpiote_evt_handler_t event handler prototype to nrfx_gpiote_interrupt_handler_t, and added the p_context parameter.
    Action: update the callback function in the affected code.

  • Changed a name and type of the action parameter to trigger in the event handler prototype.
    Action: update the callback function in the affected code.

I2S

  • The driver now supports multiple I2S peripheral instances. Every function takes a pointer to the instance as the first parameter.
    Action: declare an instance and pass a pointer to the nrfx_i2s_t driver instance in the nrfx_i2s_init(), nrfx_i2s_start(), nrfx_i2s_next_buffers_set() functions as follows:

    nrfx_i2s_t const i2s_instance = NRFX_I2S_INSTANCE(0);
    
    ...
    
    nrfx_i2s_uninit(&i2s_instance);
    
  • Changed names of members in the nrfx_i2s_config_t structure:

    • Encapsulated sck_pin, lrck_pin, mck_pin, sdout_pin, sdin_pin in the pins structure of the nrf_i2s_pins_t type.
    • Encapsulated mode, format, alignment, sample_width, channels, mck_setup, ratio in the config structure of the nrf_i2s_config_t type.

    Action: update the affected code.

QDEC

  • The driver now supports multiple QDEC peripheral instances. Every function takes a pointer to the instance as the first parameter.
    Action: to support older code with the new QDEC driver, declare an instance and pass it as the first argument to each nrfx_qdec_* function as follows:

    nrfx_qdec_t const qdec_instance = NRFX_QDEC_INSTANCE(0);
    
    ...
    
    nrfx_qdec_enable(&qdec_instance);
    
  • Added context to the event handler declaration.
    Action: update the event handler definition in the affected code.

IPC

  • Removed the deprecated event handler prototype using the uint32_t event_mask parameter.
    Action: update callback functions to use the uint8_t event_idx parameter.
  • Changed a name of the nrfx_ipc_mem_get() function to nrfx_ipc_gpmem_get().
    Action: update the affected code.

LPCOMP

  • Changed a name of the hal member in the nrf_lpcomp_config_t structure to config.
    Action: update the affected code.

PDM

  • Changed names of the following members of the nrf_pdm_config_t structure:

    • pin_clk to clk_pin
    • pin_din to din_pin

    Action: update the affected code.

PWM

  • Changed names of the p_registers and drv_inst_idx members in the nrf_pwm_t structure to p_reg and instance_id.
    Action: update your driver instance structure.

  • Removed the following deprecated API functions:

    • nrfx_pwm_sequence_values_update()
    • nrfx_pwm_sequence_length_update()
    • nrfx_pwm_sequence_repeats_update()
    • nrfx_pwm_sequence_end_delay_update()

    Action: use the nrfx_pwm_sequence_update() function instead.

  • Removed the NRFX_PWM_PIN_NOT_USED symbol.
    Action: use the NRF_PWM_PIN_NOT_CONNECTED symbol instead.

  • Changed a name of the nrfx_pwm_is_stopped() function to nrfx_pwm_stopped_check().
    Action: update the affected code.

SPIM

  • Removed the NRFX_SPIM_PIN_NOT_USED symbol.
    Action: use the NRF_SPIM_PIN_NOT_CONNECTED symbol instead.

  • Changed names of the following functions and made them inline:

    • nrfx_spim_start_task_get() to nrfx_spim_start_task_address_get()
    • nrfx_spim_end_event_get() to nrfx_spim_end_event_address_get()

    Action: update the affected code.

  • Changed a type of the *_pin fields in nrfx_spim_config_t from uint8_t to uint32_t.
    Action: update the affected code.

  • Changed a type of the frequency field in nrfx_spim_config_t from nrf_spim_frequency_t to uint32_t. It now takes a frequency value in Hz.
    Action: update the use of the frequency field of the configuration structure in the affected code.

SPIS

  • Removed the NRFX_SPIS_PIN_NOT_USED symbol.
    Action: use the NRF_SPIS_PIN_NOT_CONNECTED symbol instead.

TIMER

  • Added the frequency parameter to the NRFX_TIMER_DEFAULT_CONFIG() macro.
    Action: update the use of macro with the frequency parameter.
  • Changed a type of the frequency field in nrfx_timer_config_t from nrf_timer_frequency_t to uint32_t. It now takes a frequency value in Hz.
    Action: update the use of the frequency field of the configuration structure in the affected code.
  • Changed the nrfx_timer_us_to_ticks() and nrfx_timer_ms_to_ticks() functions to non-inline functions.

TWIM

  • Changed names of the scl and sda fields in the nrfx_twim_config_t structure to scl_pin and sda_pin, respectively.
    Action: update the affected code.

  • Changed names of the following functions:

    • nrfx_twim_start_task_get() to nrfx_twim_start_task_address_get()
    • nrfx_twim_stopped_event_get() to nrfx_twim_stopped_event_address_get()

    Action: update the affected code.

TWIS

  • Changed names of the scl and sda fields in the nrfx_twis_config_t structure to scl_pin and sda_pin, respectively.
    Action: update the affected code.

UARTE

  • Changed names of the following members of the nrfx_uarte_config_t structure:

    • pseltxd to txd_pin
    • pselrxd to rxd_pin
    • pselrts to rts_pin
    • pselcts to cts_pin
    • hal_cfg to config

    Action: update the affected code.

  • Added the following new parameters:

    • uint32_t flags to the nrfx_uarte_tx() function
    • bool sync to the nrfx_uarte_tx_abort() function
    • size_t * p_rx_amount to the nrfx_uarte_rx_ready() function
    • bool disable_all and bool sync to the nrfx_uarte_rx_abort() function

    Action: update the affected code.

  • Changed the return type to nrfx_err_t in the following functions:

    • nrfx_uarte_tx_abort()
    • nrfx_uarte_rx_ready()
    • nrfx_uarte_rx_abort()

    Action: update the affected code.

  • Changed a name of the rxtx member in the nrfx_uarte_xfer_evt_t structure to rx.
    Action: update the affected code.

  • Replaced the rxtx member in the nrfx_uarte_xfer_evt_t structure to rx and tx members.
    Action: update the affected code.

WDT

  • Extended the event handler prototype with a value of the request status register.
    Action: update the event handler function in the affected code.
  • Changed a type of the behaviour field in the nrfx_wdt_config_t structure from nrf_wdt_behaviour_t to uint32_t. It now accepts masks constructed from nrf_wdt_behaviour_mask_t elements.
    Action: update the affected code.

Others

nrfx_common.h

  • Changed the method for API version checking from boolean symbols to NRFX_API_VER_AT_LEAST() macro.
    Action: update the affected code.
  • Changed the type casting inside the NRFX_PERIPHERAL_ID_GET() macro from uint8_t to uint16_t.

nrfx_gppi.h

  • Changed all functions to non-inline and non-static functions.
    Action: add corresponding source files to the compilation.