Porting Checklist

This checklist is designed to assist in integrating the SPARK SDK with custom boards, ensuring that all necessary components are correctly integrated and nothing is missed.

  1. Implement the BSP for a Custom User Board.

  2. Implement the Backend of the SPARK Wireless Core Facade.

  3. Implement the Backend of the SPARK Audio Core Facade if the target application requires it.

  4. Implement the Backend of the SDK Application Facade.

1 - Implement the BSP for a Custom User Board

The BSP must be provided and will be used by the Wireless Core, the Audio Core, and the application itself. It is also responsible for providing a functional and initialized free-running timer to serve as the system tick. Therefore, the specific functions that need to be implemented will depend on the requirements of the following steps.

  • Create a new folder, such as bsp/new_bsp/src/ within the SDK, and include all BSP files in it.

  • Create the bsp/new_bsp/CMakeLists.txt file to compile the files of the new BSP.

  • Include the new BSP in bsp/CMakeLists.txt by adding a new add_subdirectory(new_bsp) instruction.

Tip

To determine which functions are needed, examine the facades of the Wireless and Audio Cores, as well as the application, to identify the specific functions they require.

Attention

Developers should plan their IRQ needs to ensure the most critical tasks receive prompt processing. For more information regarding the IRQ priorities used by SPARK, see IRQ Priority Scheme.

2 - Implement the Backend for the SPARK Wireless Core Facade

To integrate the Wireless Core, the backend for its facade needs to be implemented. This backend relies on the functions of the new BSP.

Facade

  • The facade for the SPARK Wireless Core is located in core/wireless/swc_hal_facade.h of the SDK.

Backend

  • Create a new folder, such as backend/new_bsp_backend/, where all backends for the new BSP will be implemented.

  • Create a new folder, such as backend/new_bsp_backend/wireless_core_backend/, to contain the Wireless Core Backend.

  • Implement the wireless_core_backend.c for the new BSP in the newly created folder.

  • Create the CMakeLists.txt file next to the backend implementation to link the Wireless Core Backend with the new BSP.

  • Include the new backend in backend/CMakeLists.txt by adding a new add_subdirectory(new_bsp_backend) instruction.

  • [ ] swc_hal_radio_1_context_switch

  • [ ] swc_hal_set_radio_1_irq_callback

  • [ ] swc_hal_set_radio_1_dma_rx_callback

  • [ ] swc_hal_radio_1_disable_irq_it

  • [ ] swc_hal_radio_1_enable_irq_it

  • [ ] swc_hal_radio_1_disable_dma_irq_it

  • [ ] swc_hal_radio_1_enable_dma_irq_it

  • [ ] swc_hal_radio_1_read_irq_pin

  • [ ] swc_hal_radio_1_set_reset_pin

  • [ ] swc_hal_radio_1_reset_reset_pin

  • [ ] swc_hal_radio_1_spi_set_cs

  • [ ] swc_hal_radio_1_spi_reset_cs

  • [ ] swc_hal_radio_1_spi_transfer_full_duplex_blocking

  • [ ] swc_hal_radio_1_spi_transfer_full_duplex_non_blocking

  • [ ] swc_hal_radio_1_is_spi_busy

  • [ ] swc_hal_get_tick_free_running_timer

  • [ ] swc_hal_get_free_running_timer_frequency_hz

Note

The weak implementations of the Wireless Core Facade for radio 2 are located in the swc_hal_facade.c file in the core/wireless/facade/ folder.

Radio 1

  • [ ] swc_hal_radio_1_context_switch

  • [ ] swc_hal_set_radio_1_irq_callback

  • [ ] swc_hal_set_radio_1_dma_rx_callback

  • [ ] swc_hal_radio_1_disable_irq_it

  • [ ] swc_hal_radio_1_enable_irq_it

  • [ ] swc_hal_radio_1_disable_dma_irq_it

  • [ ] swc_hal_radio_1_enable_dma_irq_it

  • [ ] swc_hal_radio_1_read_irq_pin

  • [ ] swc_hal_radio_1_set_reset_pin

  • [ ] swc_hal_radio_1_reset_reset_pin

  • [ ] swc_hal_radio_1_spi_set_cs

  • [ ] swc_hal_radio_1_spi_reset_cs

  • [ ] swc_hal_radio_1_spi_transfer_full_duplex_blocking

  • [ ] swc_hal_radio_1_spi_transfer_full_duplex_non_blocking

  • [ ] swc_hal_radio_1_is_spi_busy

  • [ ] swc_hal_get_tick_free_running_timer

  • [ ] swc_hal_get_free_running_timer_frequency_hz

Radio 2

  • [ ] swc_hal_radio_2_context_switch

  • [ ] swc_hal_set_radio_2_irq_callback

  • [ ] swc_hal_set_radio_2_dma_rx_callback

  • [ ] swc_hal_radio_2_disable_irq_it

  • [ ] swc_hal_radio_2_enable_irq_it

  • [ ] swc_hal_radio_2_disable_dma_irq_it

  • [ ] swc_hal_radio_2_enable_dma_irq_it

  • [ ] swc_hal_radio_2_read_irq_pin

  • [ ] swc_hal_radio_2_set_reset_pin

  • [ ] swc_hal_radio_2_reset_reset_pin

  • [ ] swc_hal_radio_2_spi_set_cs

  • [ ] swc_hal_radio_2_spi_reset_cs

  • [ ] swc_hal_radio_2_spi_transfer_full_duplex_blocking

  • [ ] swc_hal_radio_2_spi_transfer_full_duplex_non_blocking

  • [ ] swc_hal_radio_2_is_spi_busy

  • [ ] swc_hal_multi_radio_timer_init

  • [ ] swc_hal_set_multi_radio_timer_callback

  • [ ] swc_hal_timer_multi_radio_timer_start

  • [ ] swc_hal_timer_multi_radio_timer_stop

  • [ ] swc_hal_timer_multi_radio_timer_set_period

  • [ ] swc_hal_timer_multi_radio_timer_set_max_period

  • [ ] swc_hal_get_timer_multi_frequency_hz

Refer to the SPARK Wireless Core article for more details on each function.

3 - Implement the Backend for the SPARK Audio Core Facade

Like the Wireless Core, the Audio Core also requires specific functions to manage audio packets and control the codec on the board.

Note

The implementation of this backend is only required for audio applications. Therefore, only audio-related applications will include and utilize this facade.

Facade

  • The facade for the SPARK Audio Core is located in core/audio/sac_hal_facade.h of the SDK.

Backend

  • Create a new backend/new_bsp_backend/audio_core_backend/ folder to contain the Audio Core Backend.

  • Implement the audio_core_backend.c for the new BSP in the newly created folder.

  • Create the CMakeLists.txt file next to the backend implementation to link the Audio Core Backend with the new BSP.

Initialisation

  • [ ] sac_facade_hal_init

  • [ ] sac_facade_codec_endpoint_init

Clock Drift Compensation (CDC) Processing Stage

  • [ ] sac_facade_cdc_processing_init

  • [ ] sac_facade_cdc_format_stats

Private Codec Functions

Since the interfaces for the producer and consumer endpoints each require three function pointers for the tasks action, start and stop, it is recommended to implement and use the following static private functions in the backend of the Audio Core:

The Producer

  • [ ] codec_action_produce

  • [ ] codec_start_produce

  • [ ] codec_stop_produce

The Consumer

  • [ ] codec_action_consume

  • [ ] codec_start_consume

  • [ ] codec_stop_consume

Refer to the SPARK Audio Core article for more details on each function.

4 - Implement the Backend for the SDK Application

The application will then use functions provided by the BSP. The final step is to implement the backend for the application’s facade to ensure all necessary functionality is integrated. The Hello World application will be used as an example in this porting checklist, but all SDK applications share the same structure.

Facade

  • The facade for the Hello World Facade is located in app/example/hello_world/facade/hello_world_facade.h of the SDK.

Backend

  • Create a new folder, such as backend/new_bsp_backend/hello_world_backend/, to contain the app backend.

  • Implement the hello_world_backend.c for the new BSP in the newly created folder.

  • Create the CMakeLists.txt file next to the backend implementation to link the application backend with the new BSP.

  • [ ] facade_context_switch_trigger

  • [ ] facade_set_context_switch_handler

  • [ ] facade_board_init

  • [ ] facade_button_handling

  • [ ] facade_tx_conn_status

  • [ ] facade_rx_conn_status

  • [ ] facade_delay

  • [ ] facade_print_string

  • [ ] facade_notify_enter_pairing

  • [ ] facade_notify_not_paired

  • [ ] facade_notify_pairing_successful

  • [ ] facade_packet_generation_set_timer_callback

  • [ ] facade_packet_generation_timer_init

  • [ ] facade_packet_generation_timer_start

  • [ ] facade_packet_generation_timer_stop

  • [ ] facade_get_tick_ms

Refer to the Hello World section for more details on the application’s behavior.