KB: Porting AX5043 Example Code to 3rd Party MCU

Introduction

The AX5043 is a versatile sub-GHz transceiver IC that communicates with a host microcontroller (MCU) via an SPI interface. The AXRadio Driver is a library that contains functions to configure the AX5043 for almost every mode of operation that it supports. This driver is distributed as part of example code that has been designed to run on ON Semiconductor System on Chip solutions, such as the AX8052F143 and AXM0F343 products. In cases where this example code is to be used to control the AX5043 from a 3rd party MCU, several aspects of the code need to be ported.

NOTE: It is recommended that for evaluation purposes, the radio examples first be tested using the ON Semiconductor development hardware. This will allow the developer to establish a baseline for performance that can be used to help debug during the porting process.

It is also recommended that the new AXM0F343 SDK, which is distributed in the form of a CMSIS-Pack along with the ON Semiconductor IDE, be used as the starting point for porting efforts to a different microcontroller. Where legacy software had the radio code tightly integrated into the 8052-based MCU code, the new SDK for AXM0F343 clearly distinguishes code for the MCU peripherals from that of the radio. This makes it easier to identify the core architecture of the radio firmware, and distinguish which functions are abstracting hardware and must be ported to the new platform.

AX5043 - MCU interface

The AX5043 has two principle interfaces with the host microcontroller:

  1. SPI connection
  2. Interrupt signal from pin IRQ on AX5043 to a GPIO on host MCU. This is used to wake up MCU from low-power modes when radio events occur.

Radio Application Structure

The AXRadio Driver is designed to be used in applications driven by a scheduler. The basic application architecture is as follows:

  • Main Function
    • Initialize MCU
    • Initialize Radio using axradio_init()
    • Set radio mode using axradio_set_mode()
    • Infinite loop:
      • Execute all pending scheduler tasks using wtimer_runcallbacks()
      • Enter low power mode using wtimer_idle()

Key Functions and Files to port

In general, any code in the driver that has a dependency on the MCU hardware must be ported, at least in part, to the new platform. This section identifies the most crucial parts of the example code to port to a new microcontroller. There are three main areas that require porting:

  1. Radio SPI Abstraction
  2. Scheduler and Power modes
  3. Radio Interrupt Service Routine

Radio SPI

Most of the AXRadio Code relies on functions such as radio_read8() to perform the SPI reads and writes. This function abstracts the hardware and is fairly easy to port to a new platform. The code is located in radio_axm0f343.c, and the functions serve as wrappers for performing an SPI write to a specific AX5043 register with a given value.

Scheduler

The scheduler has a large hardware dependency due to use of the hardware based wake-up timer, ticker timer, and power management unit for low-power modes. scheduler.c contains the top level api, as well as some functions that leverage the PMU driver to put the MCU into low power mode. The PMU functions should be replaced with equivalent functions to control power modes in the 3rd party MCU.

The drv_scheduler.c file contains some functions that are dependent on the ticker timer and the hardware-based wake-up-timer. This file should be ported to maintain the same functionality on the new hardware. Reference the AXM0F343 MCU Programming Manual for additional details on the specifics of the register writes performed in these and other functions.

Radio ISR

The final key area that should be ported is the radio interrupt. First, whichever MCU pin is connected to pin ISR on AX5043 should be configured as an interrupt and should wake up the MCU from low power mode. Second, the interrupt service routine for the GPIO interrupt should be configured such that the radio interrupt triggers the function axradio_isr() in easyAX5043.c.

3 Likes

can you direct me to the link for axm0f343 sdk

Hello. The AXM0F343 is not yet released to market, thus the SDK is not yet public.

FYI, the SDK is the On Semiconductor IDE (same as our RSL10, Radio SoC, Bluetooth 5 Certified ). The drivers, and examples for the AXM0F343 will be published as a CMSIS pack upon part release.