APPLICATION NOTE AND9316/D AX5043 Sending FM tones (ZVEI) Revision 2 2 Table of Contents 1. Introduction................................................................................................ 3 2. The AX5043_TX_FM_tones_(ZVEI) Project ................................................. 4 2.1. Routines ....................................................................................................... 4 void init_ax5043(void).................................................................................... 4 void send_tone_prepare(void) ......................................................................... 5 void send_tone(uint8_t n) ............................................................................... 5 void send_tone_end() .................................................................................... 5 void timer0_interrupt(void) ............................................................................. 5 2.2. Variables ...................................................................................................... 6 uint8_t freq_tbl_sin[256][4]............................................................................ 6 uint8_t tone_rclk_div ..................................................................................... 6 uint16_t tone_t0period ................................................................................... 6 const uint16_t tone_tbl[] ................................................................................ 6 const uint16_t tone_len .................................................................................. 6 3. Conclusion .................................................................................................. 7 www.onsemi.com AND9316/D Introduction 1. Introduction This application note describes how to use the AX5043 for transmitting FM tones as they are used for selective calling (ZVEI and similar schemes). www.onsemi.com AND9316/D 3 4 The AX5043_TX_FM_tones_(ZVEI) Project 2. The AX5043_TX_FM_tones_(ZVEI) Project The MASTER/main.c file of the AX5043_TX_FM_tones_(ZVEI) project demonstrates the transmission of FM tones. Upon pushing button “D” on the DVK-2 mainboard the tones encoding the digits ‘A’, ‘5’, ‘0’, ‘4’, ‘3’ in the ZVEI scheme are transmitted. The carrier frequency is 868.3MHz, +/-3kHz FM deviation are used and an 48MHz TCXO is assumed. The FM tones are generated as follows: The AX5043 is set up transmitting CW. Using a TIMER0 interrupt the frequency register is updated periodically in order to generate the desired tone. This is done for a defined number of sampling points. The procedure can be repeated for generating further tones. Finally the AX5043 is put into power-down mode and the MCU goes into sleep mode. Note: This project was derived from an AX-RadioLAB project. However, due to the nature of the task, the dependence of the AXRadioV2API has been removed and communication with the AX5043 radio chip is done directly in the code or via LibMF routines. In order to work with this project MASTER/MASTER.cbp should be opened using the AXCode::Blocks IDE. The files axradiolabstate.xml and AX_Radio_Lab_output/* have been kept. Thus it is still possible to open the project using AX-RadioLAB in order to compute register values when attempting to change parameters. However, the files AX_Radio_Lab_output/* are not used by the code. Changed register values have to be copied manually from AX_Radio_Lab_output/config.c into the init_ax5043() in main.c (see below). When using the F143-MINI-DVK rather than the DVK-2 it is necessary to comment in the line “//#define MINI_KIT” and to comment out “#define USE_LCD” at the top of main.c 2.1. Routines void init_ax5043(void) This routine resets the AX5043, configures the registers necessary for transmit and ranges the PLL for the frequency configured in the FREQA register. In order to change parameters as the carrier frequency, internal vs external VCO, XTAL or TCXO frequency etc. It is easiest to open the project with with AX-RadioLAB, change the corresponding parameters and update the register values in init_ax5043_regs from the values found in www.onsemi.com AND9316/D The AX5043_TX_FM_tones_(ZVEI) Project AX_Radio_Lab_output/config.c (the carrier frequency is not assigned to the FREQA register in config.c, but assigned to the axradio_phy_chanfreq variable). When cahnging the carrier frequency freq_tbl_sin[][] table (see below). it is further necessary to update the void send_tone_prepare(void) This routine powers up the transmitter in CW mode. Further TIMER0 is set up to be clocked at fradio_xtal / 2^tone_rclk_div and to generate interrupts at fs = fradio_xtal / 2^tone_rclk_div / tone_t0period. The frequency fs is the sampling frequency at which the AX5043 frequency register is updated. void send_tone(uint8_t n) This routine sets the frequency of the generated tone by writing the tone_tbl. It further resets tone_sample_cnt, which measures the length of the generated tone in samples. The routine returns after transmitting the tone. void send_tone_end() This routine puts the AX5043 into power-down and disables the TIMER0. void timer0_interrupt(void) This routine toggles the FREQSEL bit in AX5043_PLLLOOP, which switches between the AX5043_FREQA and AX5043_FREQB registers. It then increments the phase accumulator tone_phase by tone_freq and writes the frequency of the next sampling point to the currently unused frequency register. Further tone_cample_cnt is incremented. This counter measures the length of the tone in samples. Note: The execution time of the timer0_interrrupt ISR is roughly 10us. Modifications of this routine, e.g. in order to get rid of the hard-coded carrier frequency, may increase the execution time and thus require lower fs. (Increase tone_rclk_div or tone_t0period.) www.onsemi.com AND9316/D 5 6 The AX5043_TX_FM_tones_(ZVEI) Project 2.2. Variables uint8_t freq_tbl_sin[256][4] This array contains the frequency register values sampling one period of the modulation with 256 points, thus f carrier f deviation sin(2 n / 256) 2 24 f radio_ xtal . For each sampling point the 32bit frequency register value is stored as 4 bytes in the order {FREQA0, FREQA1, FREQA2, FREQA3}. Note that the PLL requires that bit 0 of the FREQA0 is always set in order to prevent tonal behaviour of the Sigma-Delta Modulator. Note that the full frequency is tabulated, not just the deviation from f carrier. This avoids 32bit addition on each frequncy update, allowing maximum sampling speed. The drawback is the lost flexibility in changing fcarrier. The file MASTER/print_tab.c contains a simple routine for computing the above table on the AX8052 MCU and printing it on the DebugLink interface. uint8_t tone_rclk_div TIMER0 is clocked at fradio_xtal / 2^tone_rclk_div Allowed values are [0, 11]. uint16_t tone_t0period TIMER0 interrupts for updating the frequency register are generated at the sampling frequency fs = fradio_xtal / 2^tone_rclk_div/ tone_t0period. Higher fs give higher quality representation of the tones. The default used in the example project is fs = 48MHz / 2^10 / 1 = 46.875kHz, which is on the high side. Note: The execution time of the timer0_interrrupt ISR, which handles the frequency adjustment, is roughly 10us. Modifications of that routine, e.g. in order to get rid of the hard-coded carrier frequency, may increase the execution time and thus require lower fs. const uint16_t tone_tbl[] This array lists the tone frequencies used. Default is ZVEI. The units are (f tone/fs)*2^16, where fs is the sampling frequency. const uint16_t tone_len This variable defines the tone length in samples. www.onsemi.com AND9316/D Conclusion 3. Conclusion It is possible to transmit analog FM tones as used in various selective calling schemes using the AX5043. www.onsemi.com AND9316/D 7