furi_hal_subghz_configs.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. #pragma once
  2. #include <cc1101.h>
  3. static const uint8_t furi_hal_subghz_preset_ook_270khz_async_regs[][2] = {
  4. // https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/382066/cc1101---don-t-know-the-correct-registers-configuration
  5. /* GPIO GD0 */
  6. {CC1101_IOCFG0, 0x0D}, // GD0 as async serial data output/input
  7. /* FIFO and internals */
  8. {CC1101_FIFOTHR, 0x47}, // The only important bit is ADC_RETENTION, FIFO Tx=33 Rx=32
  9. /* Packet engine */
  10. {CC1101_PKTCTRL0, 0x32}, // Async, continious, no whitening
  11. /* Frequency Synthesizer Control */
  12. {CC1101_FSCTRL1, 0x06}, // IF = (26*10^6) / (2^10) * 0x06 = 152343.75Hz
  13. // Modem Configuration
  14. {CC1101_MDMCFG0, 0x00}, // Channel spacing is 25kHz
  15. {CC1101_MDMCFG1, 0x00}, // Channel spacing is 25kHz
  16. {CC1101_MDMCFG2, 0x30}, // Format ASK/OOK, No preamble/sync
  17. {CC1101_MDMCFG3, 0x32}, // Data rate is 3.79372 kBaud
  18. {CC1101_MDMCFG4, 0x67}, // Rx BW filter is 270.833333kHz
  19. /* Main Radio Control State Machine */
  20. {CC1101_MCSM0, 0x18}, // Autocalibrate on idle-to-rx/tx, PO_TIMEOUT is 64 cycles(149-155us)
  21. /* Frequency Offset Compensation Configuration */
  22. {CC1101_FOCCFG,
  23. 0x18}, // no frequency offset compensation, POST_K same as PRE_K, PRE_K is 4K, GATE is off
  24. /* Automatic Gain Control */
  25. {CC1101_AGCCTRL0,
  26. 0x40}, // 01 - Low hysteresis, small asymmetric dead zone, medium gain; 00 - 8 samples agc; 00 - Normal AGC, 00 - 4dB boundary
  27. {CC1101_AGCCTRL1,
  28. 0x00}, // 0; 0 - LNA 2 gain is decreased to minimum before decreasing LNA gain; 00 - Relative carrier sense threshold disabled; 0000 - RSSI to MAIN_TARGET
  29. {CC1101_AGCCTRL2, 0x03}, // 00 - DVGA all; 000 - MAX LNA+LNA2; 011 - MAIN_TARGET 24 dB
  30. /* Wake on radio and timeouts control */
  31. {CC1101_WORCTRL, 0xFB}, // WOR_RES is 2^15 periods (0.91 - 0.94 s) 16.5 - 17.2 hours
  32. /* Frontend configuration */
  33. {CC1101_FREND0, 0x11}, // Adjusts current TX LO buffer + high is PATABLE[1]
  34. {CC1101_FREND1, 0xB6}, //
  35. /* End */
  36. {0, 0},
  37. };
  38. static const uint8_t furi_hal_subghz_preset_ook_650khz_async_regs[][2] = {
  39. // https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/382066/cc1101---don-t-know-the-correct-registers-configuration
  40. /* GPIO GD0 */
  41. {CC1101_IOCFG0, 0x0D}, // GD0 as async serial data output/input
  42. /* FIFO and internals */
  43. {CC1101_FIFOTHR, 0x07}, // The only important bit is ADC_RETENTION
  44. /* Packet engine */
  45. {CC1101_PKTCTRL0, 0x32}, // Async, continious, no whitening
  46. /* Frequency Synthesizer Control */
  47. {CC1101_FSCTRL1, 0x06}, // IF = (26*10^6) / (2^10) * 0x06 = 152343.75Hz
  48. // Modem Configuration
  49. {CC1101_MDMCFG0, 0x00}, // Channel spacing is 25kHz
  50. {CC1101_MDMCFG1, 0x00}, // Channel spacing is 25kHz
  51. {CC1101_MDMCFG2, 0x30}, // Format ASK/OOK, No preamble/sync
  52. {CC1101_MDMCFG3, 0x32}, // Data rate is 3.79372 kBaud
  53. {CC1101_MDMCFG4, 0x17}, // Rx BW filter is 650.000kHz
  54. /* Main Radio Control State Machine */
  55. {CC1101_MCSM0, 0x18}, // Autocalibrate on idle-to-rx/tx, PO_TIMEOUT is 64 cycles(149-155us)
  56. /* Frequency Offset Compensation Configuration */
  57. {CC1101_FOCCFG,
  58. 0x18}, // no frequency offset compensation, POST_K same as PRE_K, PRE_K is 4K, GATE is off
  59. /* Automatic Gain Control */
  60. // {CC1101_AGCTRL0,0x40}, // 01 - Low hysteresis, small asymmetric dead zone, medium gain; 00 - 8 samples agc; 00 - Normal AGC, 00 - 4dB boundary
  61. // {CC1101_AGCTRL1,0x00}, // 0; 0 - LNA 2 gain is decreased to minimum before decreasing LNA gain; 00 - Relative carrier sense threshold disabled; 0000 - RSSI to MAIN_TARGET
  62. // {CC1101_AGCCTRL2, 0x03}, // 00 - DVGA all; 000 - MAX LNA+LNA2; 011 - MAIN_TARGET 24 dB
  63. //MAGN_TARGET for RX filter BW =< 100 kHz is 0x3. For higher RX filter BW's MAGN_TARGET is 0x7.
  64. {CC1101_AGCCTRL0,
  65. 0x91}, // 10 - Medium hysteresis, medium asymmetric dead zone, medium gain ; 01 - 16 samples agc; 00 - Normal AGC, 01 - 8dB boundary
  66. {CC1101_AGCCTRL1,
  67. 0x0}, // 0; 0 - LNA 2 gain is decreased to minimum before decreasing LNA gain; 00 - Relative carrier sense threshold disabled; 0000 - RSSI to MAIN_TARGET
  68. {CC1101_AGCCTRL2, 0x07}, // 00 - DVGA all; 000 - MAX LNA+LNA2; 111 - MAIN_TARGET 42 dB
  69. /* Wake on radio and timeouts control */
  70. {CC1101_WORCTRL, 0xFB}, // WOR_RES is 2^15 periods (0.91 - 0.94 s) 16.5 - 17.2 hours
  71. /* Frontend configuration */
  72. {CC1101_FREND0, 0x11}, // Adjusts current TX LO buffer + high is PATABLE[1]
  73. {CC1101_FREND1, 0xB6}, //
  74. /* End */
  75. {0, 0},
  76. };
  77. static const uint8_t furi_hal_subghz_preset_2fsk_dev2_38khz_async_regs[][2] = {
  78. /* GPIO GD0 */
  79. {CC1101_IOCFG0, 0x0D}, // GD0 as async serial data output/input
  80. /* Frequency Synthesizer Control */
  81. {CC1101_FSCTRL1, 0x06}, // IF = (26*10^6) / (2^10) * 0x06 = 152343.75Hz
  82. /* Packet engine */
  83. {CC1101_PKTCTRL0, 0x32}, // Async, continious, no whitening
  84. {CC1101_PKTCTRL1, 0x04},
  85. // // Modem Configuration
  86. {CC1101_MDMCFG0, 0x00},
  87. {CC1101_MDMCFG1, 0x02},
  88. {CC1101_MDMCFG2, 0x04}, // Format 2-FSK/FM, No preamble/sync, Disable (current optimized)
  89. {CC1101_MDMCFG3, 0x83}, // Data rate is 4.79794 kBaud
  90. {CC1101_MDMCFG4, 0x67}, //Rx BW filter is 270.833333 kHz
  91. {CC1101_DEVIATN, 0x04}, //Deviation 2.380371 kHz
  92. /* Main Radio Control State Machine */
  93. {CC1101_MCSM0, 0x18}, // Autocalibrate on idle-to-rx/tx, PO_TIMEOUT is 64 cycles(149-155us)
  94. /* Frequency Offset Compensation Configuration */
  95. {CC1101_FOCCFG,
  96. 0x16}, // no frequency offset compensation, POST_K same as PRE_K, PRE_K is 4K, GATE is off
  97. /* Automatic Gain Control */
  98. {CC1101_AGCCTRL0,
  99. 0x91}, //10 - Medium hysteresis, medium asymmetric dead zone, medium gain ; 01 - 16 samples agc; 00 - Normal AGC, 01 - 8dB boundary
  100. {CC1101_AGCCTRL1,
  101. 0x00}, // 0; 0 - LNA 2 gain is decreased to minimum before decreasing LNA gain; 00 - Relative carrier sense threshold disabled; 0000 - RSSI to MAIN_TARGET
  102. {CC1101_AGCCTRL2, 0x07}, // 00 - DVGA all; 000 - MAX LNA+LNA2; 111 - MAIN_TARGET 42 dB
  103. /* Wake on radio and timeouts control */
  104. {CC1101_WORCTRL, 0xFB}, // WOR_RES is 2^15 periods (0.91 - 0.94 s) 16.5 - 17.2 hours
  105. /* Frontend configuration */
  106. {CC1101_FREND0, 0x10}, // Adjusts current TX LO buffer
  107. {CC1101_FREND1, 0x56},
  108. /* End */
  109. {0, 0},
  110. };
  111. static const uint8_t furi_hal_subghz_preset_2fsk_dev47_6khz_async_regs[][2] = {
  112. /* GPIO GD0 */
  113. {CC1101_IOCFG0, 0x0D}, // GD0 as async serial data output/input
  114. /* Frequency Synthesizer Control */
  115. {CC1101_FSCTRL1, 0x06}, // IF = (26*10^6) / (2^10) * 0x06 = 152343.75Hz
  116. /* Packet engine */
  117. {CC1101_PKTCTRL0, 0x32}, // Async, continious, no whitening
  118. {CC1101_PKTCTRL1, 0x04},
  119. // // Modem Configuration
  120. {CC1101_MDMCFG0, 0x00},
  121. {CC1101_MDMCFG1, 0x02},
  122. {CC1101_MDMCFG2, 0x04}, // Format 2-FSK/FM, No preamble/sync, Disable (current optimized)
  123. {CC1101_MDMCFG3, 0x83}, // Data rate is 4.79794 kBaud
  124. {CC1101_MDMCFG4, 0x67}, //Rx BW filter is 270.833333 kHz
  125. {CC1101_DEVIATN, 0x47}, //Deviation 47.60742 kHz
  126. /* Main Radio Control State Machine */
  127. {CC1101_MCSM0, 0x18}, // Autocalibrate on idle-to-rx/tx, PO_TIMEOUT is 64 cycles(149-155us)
  128. /* Frequency Offset Compensation Configuration */
  129. {CC1101_FOCCFG,
  130. 0x16}, // no frequency offset compensation, POST_K same as PRE_K, PRE_K is 4K, GATE is off
  131. /* Automatic Gain Control */
  132. {CC1101_AGCCTRL0,
  133. 0x91}, //10 - Medium hysteresis, medium asymmetric dead zone, medium gain ; 01 - 16 samples agc; 00 - Normal AGC, 01 - 8dB boundary
  134. {CC1101_AGCCTRL1,
  135. 0x00}, // 0; 0 - LNA 2 gain is decreased to minimum before decreasing LNA gain; 00 - Relative carrier sense threshold disabled; 0000 - RSSI to MAIN_TARGET
  136. {CC1101_AGCCTRL2, 0x07}, // 00 - DVGA all; 000 - MAX LNA+LNA2; 111 - MAIN_TARGET 42 dB
  137. /* Wake on radio and timeouts control */
  138. {CC1101_WORCTRL, 0xFB}, // WOR_RES is 2^15 periods (0.91 - 0.94 s) 16.5 - 17.2 hours
  139. /* Frontend configuration */
  140. {CC1101_FREND0, 0x10}, // Adjusts current TX LO buffer
  141. {CC1101_FREND1, 0x56},
  142. /* End */
  143. {0, 0},
  144. };
  145. static const uint8_t furi_hal_subghz_preset_msk_99_97kb_async_regs[][2] = {
  146. /* GPIO GD0 */
  147. {CC1101_IOCFG0, 0x06},
  148. {CC1101_FIFOTHR, 0x07}, // The only important bit is ADC_RETENTION
  149. {CC1101_SYNC1, 0x46},
  150. {CC1101_SYNC0, 0x4C},
  151. {CC1101_ADDR, 0x00},
  152. {CC1101_PKTLEN, 0x00},
  153. {CC1101_CHANNR, 0x00},
  154. {CC1101_PKTCTRL0, 0x05},
  155. {CC1101_FSCTRL0, 0x23},
  156. {CC1101_FSCTRL1, 0x06},
  157. {CC1101_MDMCFG0, 0xF8},
  158. {CC1101_MDMCFG1, 0x22},
  159. {CC1101_MDMCFG2, 0x72},
  160. {CC1101_MDMCFG3, 0xF8},
  161. {CC1101_MDMCFG4, 0x5B},
  162. {CC1101_DEVIATN, 0x47},
  163. {CC1101_MCSM0, 0x18},
  164. {CC1101_FOCCFG, 0x16},
  165. {CC1101_AGCCTRL0, 0xB2},
  166. {CC1101_AGCCTRL1, 0x00},
  167. {CC1101_AGCCTRL2, 0xC7},
  168. {CC1101_FREND0, 0x10},
  169. {CC1101_FREND1, 0x56},
  170. {CC1101_BSCFG, 0x1C},
  171. {CC1101_FSTEST, 0x59},
  172. /* End */
  173. {0, 0},
  174. };
  175. static const uint8_t furi_hal_subghz_preset_gfsk_9_99kb_async_regs[][2] = {
  176. {CC1101_IOCFG0, 0x06}, //GDO0 Output Pin Configuration
  177. {CC1101_FIFOTHR, 0x47}, //RX FIFO and TX FIFO Thresholds
  178. //1 : CRC calculation in TX and CRC check in RX enabled,
  179. //1 : Variable packet length mode. Packet length configured by the first byte after sync word
  180. {CC1101_PKTCTRL0, 0x05},
  181. {CC1101_FSCTRL1, 0x06}, //Frequency Synthesizer Control
  182. {CC1101_SYNC1, 0x46},
  183. {CC1101_SYNC0, 0x4C},
  184. {CC1101_ADDR, 0x00},
  185. {CC1101_PKTLEN, 0x00},
  186. {CC1101_MDMCFG4, 0xC8}, //Modem Configuration 9.99
  187. {CC1101_MDMCFG3, 0x93}, //Modem Configuration
  188. {CC1101_MDMCFG2, 0x12}, // 2: 16/16 sync word bits detected
  189. {CC1101_DEVIATN, 0x34}, //Deviation = 19.042969
  190. {CC1101_MCSM0, 0x18}, //Main Radio Control State Machine Configuration
  191. {CC1101_FOCCFG, 0x16}, //Frequency Offset Compensation Configuration
  192. {CC1101_AGCCTRL2, 0x43}, //AGC Control
  193. {CC1101_AGCCTRL1, 0x40},
  194. {CC1101_AGCCTRL0, 0x91},
  195. {CC1101_WORCTRL, 0xFB}, //Wake On Radio Control
  196. /* End */
  197. {0, 0},
  198. };
  199. static const uint8_t furi_hal_subghz_preset_ook_async_patable[8] = {
  200. 0x00,
  201. 0xC0, // 12dBm 0xC0, 10dBm 0xC5, 7dBm 0xCD, 5dBm 0x86, 0dBm 0x50, -6dBm 0x37, -10dBm 0x26, -15dBm 0x1D, -20dBm 0x17, -30dBm 0x03
  202. 0x00,
  203. 0x00,
  204. 0x00,
  205. 0x00,
  206. 0x00,
  207. 0x00};
  208. static const uint8_t furi_hal_subghz_preset_ook_async_patable_au[8] = {
  209. 0x00,
  210. 0x37, // 12dBm 0xC0, 10dBm 0xC5, 7dBm 0xCD, 5dBm 0x86, 0dBm 0x50, -6dBm 0x37, -10dBm 0x26, -15dBm 0x1D, -20dBm 0x17, -30dBm 0x03
  211. 0x00,
  212. 0x00,
  213. 0x00,
  214. 0x00,
  215. 0x00,
  216. 0x00};
  217. static const uint8_t furi_hal_subghz_preset_2fsk_async_patable[8] = {
  218. 0xC0, // 10dBm 0xC0, 7dBm 0xC8, 5dBm 0x84, 0dBm 0x60, -10dBm 0x34, -15dBm 0x1D, -20dBm 0x0E, -30dBm 0x12
  219. 0x00,
  220. 0x00,
  221. 0x00,
  222. 0x00,
  223. 0x00,
  224. 0x00,
  225. 0x00};
  226. static const uint8_t furi_hal_subghz_preset_msk_async_patable[8] = {
  227. 0xC0, // 10dBm 0xC0, 7dBm 0xC8, 5dBm 0x84, 0dBm 0x60, -10dBm 0x34, -15dBm 0x1D, -20dBm 0x0E, -30dBm 0x12
  228. 0x00,
  229. 0x00,
  230. 0x00,
  231. 0x00,
  232. 0x00,
  233. 0x00,
  234. 0x00};
  235. static const uint8_t furi_hal_subghz_preset_gfsk_async_patable[8] = {
  236. 0xC0, // 10dBm 0xC0, 7dBm 0xC8, 5dBm 0x84, 0dBm 0x60, -10dBm 0x34, -15dBm 0x1D, -20dBm 0x0E, -30dBm 0x12
  237. 0x00,
  238. 0x00,
  239. 0x00,
  240. 0x00,
  241. 0x00,
  242. 0x00,
  243. 0x00};