Contiki-NG
cc1200-868-fsk-1-2kbps.c
1 /*
2  * Copyright (c) 2015, Weptech elektronik GmbH Germany
3  * http://www.weptech.de
4  *
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30  * OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * This file is part of the Contiki operating system.
33  */
34 
35 #include "dev/radio/cc1200/cc1200-rf-cfg.h"
36 #include "dev/radio/cc1200/cc1200-const.h"
37 
38 /*
39  * This is a setup for the following configuration:
40  *
41  * cc1200 at 1.2 kbps, 2-FSK, 12.5 kHz Channel Spacing (868 MHz).
42  */
43 
44 /* Base frequency in kHz */
45 #define RF_CFG_CHAN_CENTER_F0 867787
46 /* Channel spacing in Hz */
47 #define RF_CFG_CHAN_SPACING 12500
48 /* The minimum channel */
49 #define RF_CFG_MIN_CHANNEL 0
50 /* The maximum channel */
51 #define RF_CFG_MAX_CHANNEL 33
52 /* The maximum output power in dBm */
53 #define RF_CFG_MAX_TXPOWER CC1200_CONST_TX_POWER_MAX
54 /* The carrier sense level used for CCA in dBm */
55 #define RF_CFG_CCA_THRESHOLD (-91)
56 /* The RSSI offset in dBm */
57 #define RF_CFG_RSSI_OFFSET (-99)
58 /*---------------------------------------------------------------------------*/
59 static const char rf_cfg_descriptor[] = "868MHz 2-FSK 1.2 kbps";
60 /*---------------------------------------------------------------------------*/
61 /*
62  * Register settings exported from SmartRF Studio using the standard template
63  * "trxEB RF Settings Performance Line".
64  */
65 
66 // Modulation format = 2-FSK
67 // Whitening = false
68 // Symbol rate = 1.2
69 // Deviation = 3.986359
70 // Carrier frequency = 867.999878
71 // Manchester enable = false
72 // Bit rate = 1.2
73 // RX filter BW = 10.964912
74 
75 static const registerSetting_t preferredSettings[]=
76 {
77  {CC1200_IOCFG2, 0x06},
78  {CC1200_DEVIATION_M, 0xD1},
79  {CC1200_MODCFG_DEV_E, 0x00},
80  {CC1200_DCFILT_CFG, 0x5D},
81  {CC1200_PREAMBLE_CFG0, 0x8A},
82  {CC1200_IQIC, 0xCB},
83  {CC1200_CHAN_BW, 0xA6},
84  {CC1200_MDMCFG1, 0x40},
85  {CC1200_MDMCFG0, 0x05},
86  {CC1200_SYMBOL_RATE2, 0x3F},
87  {CC1200_SYMBOL_RATE1, 0x75},
88  {CC1200_SYMBOL_RATE0, 0x10},
89  {CC1200_AGC_REF, 0x20},
90  {CC1200_AGC_CS_THR, 0xEC},
91  {CC1200_AGC_CFG1, 0x51},
92  {CC1200_AGC_CFG0, 0x87},
93  {CC1200_FIFO_CFG, 0x00},
94  {CC1200_FS_CFG, 0x12},
95  {CC1200_PKT_CFG2, 0x00},
96  {CC1200_PKT_CFG0, 0x20},
97  {CC1200_PKT_LEN, 0xFF},
98  {CC1200_IF_MIX_CFG, 0x1C},
99  {CC1200_FREQOFF_CFG, 0x22},
100  {CC1200_MDMCFG2, 0x0C},
101  {CC1200_FREQ2, 0x56},
102  {CC1200_FREQ1, 0xCC},
103  {CC1200_FREQ0, 0xCC},
104  {CC1200_IF_ADC1, 0xEE},
105  {CC1200_IF_ADC0, 0x10},
106  {CC1200_FS_DIG1, 0x07},
107  {CC1200_FS_DIG0, 0xAF},
108  {CC1200_FS_CAL1, 0x40},
109  {CC1200_FS_CAL0, 0x0E},
110  {CC1200_FS_DIVTWO, 0x03},
111  {CC1200_FS_DSM0, 0x33},
112  {CC1200_FS_DVC0, 0x17},
113  {CC1200_FS_PFD, 0x00},
114  {CC1200_FS_PRE, 0x6E},
115  {CC1200_FS_REG_DIV_CML, 0x1C},
116  {CC1200_FS_SPARE, 0xAC},
117  {CC1200_FS_VCO0, 0xB5},
118  {CC1200_XOSC5, 0x0E},
119  {CC1200_XOSC1, 0x03},
120 };
121 /*---------------------------------------------------------------------------*/
122 /* Global linkage: symbol name must be different in each exported file! */
123 const cc1200_rf_cfg_t cc1200_868_fsk_1_2kbps = {
124  .cfg_descriptor = rf_cfg_descriptor,
125  .register_settings = preferredSettings,
126  .size_of_register_settings = sizeof(preferredSettings),
127  .tx_pkt_lifetime = (2 * RTIMER_SECOND),
128  .tx_rx_turnaround = (RTIMER_SECOND / 2),
129  .delay_before_tx = 0,
130  .delay_before_rx = 0,
131  .delay_before_detect = 0,
132  .chan_center_freq0 = RF_CFG_CHAN_CENTER_F0,
133  .chan_spacing = RF_CFG_CHAN_SPACING,
134  .min_channel = RF_CFG_MIN_CHANNEL,
135  .max_channel = RF_CFG_MAX_CHANNEL,
136  .max_txpower = RF_CFG_MAX_TXPOWER,
137  .cca_threshold = RF_CFG_CCA_THRESHOLD,
138  .rssi_offset = RF_CFG_RSSI_OFFSET,
139  .bitrate = 1200,
140  .tsch_timing = NULL,
141 };
142 /*---------------------------------------------------------------------------*/
#define RTIMER_SECOND
Number of rtimer ticks for 1 second.
Definition: rtimer.h:112