mirror of
https://github.com/g4klx/MMDVM_HS.git
synced 2026-02-09 08:54:32 +01:00
Compare commits
381 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ff74ed1ba | ||
|
|
29bb3cf352 | ||
|
|
192cba3ecc | ||
|
|
f0586fdf74 | ||
|
|
14e1c4bae4 | ||
|
|
070bf8ee7a | ||
|
|
520f39148a | ||
|
|
a12e7f6fce | ||
|
|
5e6ac20a8a | ||
|
|
ba19e26630 | ||
|
|
3dfd2264ad | ||
|
|
a4948312e3 | ||
|
|
4d51976f6a | ||
|
|
d4cb546a7c | ||
|
|
931cfde894 | ||
|
|
0f3a4fa249 | ||
|
|
ab3c9a39a3 | ||
|
|
92597e0d00 | ||
|
|
023462a86d | ||
|
|
d408845f82 | ||
|
|
6fc189793d | ||
|
|
d9621c5c8b | ||
|
|
6781dec322 | ||
|
|
1908a0ee9a | ||
|
|
2ea38a3bfe | ||
|
|
36f607250a | ||
|
|
a80dc06ed6 | ||
|
|
800ec4fe14 | ||
|
|
e3cadb7f32 | ||
|
|
9498ef4e82 | ||
|
|
436cebb7a4 | ||
|
|
3fee6b47cd | ||
|
|
df3a140173 | ||
|
|
9a3e3704e2 | ||
|
|
5cbaf98d2d | ||
|
|
cf00e2f347 | ||
|
|
2f52282c47 | ||
|
|
4f1ed20d77 | ||
|
|
eb6b2cc2b2 | ||
|
|
138260fef7 | ||
|
|
08a6c21c17 | ||
|
|
6c4f2041cb | ||
|
|
0f7a64115d | ||
|
|
c9bd700100 | ||
|
|
d732807ee3 | ||
|
|
93d08d7703 | ||
|
|
1bfec1717e | ||
|
|
fb4c543211 | ||
|
|
cde5b19080 | ||
|
|
818a27d114 | ||
|
|
43732fbf3c | ||
|
|
743d0ca12f | ||
|
|
69d08790bd | ||
|
|
956ee1a81c | ||
|
|
dc2171bef7 | ||
|
|
3f83f671a3 | ||
|
|
fc9cb227f3 | ||
|
|
bb9fe7f561 | ||
|
|
89daa20476 | ||
|
|
506740ba49 | ||
|
|
5013e19a21 | ||
|
|
414ea06098 | ||
|
|
af1537dcdc | ||
|
|
f212b8974c | ||
|
|
9658d83dab | ||
|
|
4ce0878ca6 | ||
|
|
33510b6832 | ||
|
|
dcc23cf6fa | ||
|
|
6dbb436002 | ||
|
|
f74043a040 | ||
|
|
98895e5939 | ||
|
|
3c0c3abcc3 | ||
|
|
1210748cdb | ||
|
|
146e6fb3e6 | ||
|
|
bdb610e973 | ||
|
|
5fdf64d7d0 | ||
|
|
623d4bb351 | ||
|
|
ce0ad59bcc | ||
|
|
fb931db47f | ||
|
|
c1e279af7d | ||
|
|
754a9c6657 | ||
|
|
506a514d8b | ||
|
|
c4623c2890 | ||
|
|
3c63f30a08 | ||
|
|
8967348bcc | ||
|
|
c34f5d511d | ||
|
|
f96cd2af84 | ||
|
|
4669198c77 | ||
|
|
c909c2dbc5 | ||
|
|
c305359ce5 | ||
|
|
06e02d54f9 | ||
|
|
8e5e06de30 | ||
|
|
f26469737e | ||
|
|
279251d484 | ||
|
|
e1ef453979 | ||
|
|
97d270a1fe | ||
|
|
cc451c4036 | ||
|
|
7e924a21b6 | ||
|
|
3cdeb26aa0 | ||
|
|
fbeb5a39b7 | ||
|
|
e9b89208cc | ||
|
|
269f6b4358 | ||
|
|
6b751d595e | ||
|
|
6781fa5c8b | ||
|
|
3fd75cd177 | ||
|
|
88455a50dd | ||
|
|
139eb95b66 | ||
|
|
0ec39c32c5 | ||
|
|
8254f2233e | ||
|
|
1790bde635 | ||
|
|
8519f767c5 | ||
|
|
2fd7e6a978 | ||
|
|
d716321820 | ||
|
|
82d0f71ebb | ||
|
|
d0db461a56 | ||
|
|
5a45650c12 | ||
|
|
b2e79b2ea5 | ||
|
|
89fd1805a3 | ||
|
|
9fe7d1a2a1 | ||
|
|
91d0f939f3 | ||
|
|
8cf46cab92 | ||
|
|
6419cad878 | ||
|
|
ac75ffdb0f | ||
|
|
544576e98d | ||
|
|
54208aa317 | ||
|
|
ed487bcad4 | ||
|
|
c72f357f2c | ||
|
|
b401d06c1f | ||
|
|
2903847ac2 | ||
|
|
5932cc227b | ||
|
|
b7a6edef6d | ||
|
|
d50d0c070b | ||
|
|
8d77ff32cf | ||
|
|
e042c0c777 | ||
|
|
a9fed35d1c | ||
|
|
6183d00264 | ||
|
|
7bdef738b2 | ||
|
|
dec70516c3 | ||
|
|
0e8783c533 | ||
|
|
6add9c540d | ||
|
|
1aab7ec355 | ||
|
|
c45a7cf38f | ||
|
|
e0332c4efa | ||
|
|
3284a72feb | ||
|
|
8d55079058 | ||
|
|
77c988c21d | ||
|
|
2b53c86277 | ||
|
|
5834da83d8 | ||
|
|
03f276db2c | ||
|
|
7020510f2e | ||
|
|
bc48446e77 | ||
|
|
943df053a9 | ||
|
|
b0ab167f03 | ||
|
|
a0b9ae8142 | ||
|
|
45fc69cee5 | ||
|
|
b9fd0b1233 | ||
|
|
ad2df94a46 | ||
|
|
3fbeee3c3b | ||
|
|
ceb6a4d07a | ||
|
|
2e3f304d2e | ||
|
|
96e0a368b9 | ||
|
|
6c64ef1336 | ||
|
|
b14548e9db | ||
|
|
a86f263fdb | ||
|
|
06d8efa446 | ||
|
|
0f1bc29114 | ||
|
|
23f13269ca | ||
|
|
48fdade2f1 | ||
|
|
f3cca5a229 | ||
|
|
10c725c1dd | ||
|
|
cd1e95ff31 | ||
|
|
17161460bf | ||
|
|
7d69ad7e79 | ||
|
|
12e8114a3e | ||
|
|
75e93c9ac3 | ||
|
|
b7e0c0ac55 | ||
|
|
ba1a9045f0 | ||
|
|
ba97bd2cde | ||
|
|
169ab45e9c | ||
|
|
029c6e7da0 | ||
|
|
4ceaab33bc | ||
|
|
745273a7b0 | ||
|
|
bd9529eab3 | ||
|
|
a6811881a5 | ||
|
|
994c7b81a1 | ||
|
|
d7e5f2be76 | ||
|
|
41d13c2653 | ||
|
|
f3fb35132e | ||
|
|
5d2b8c8e08 | ||
|
|
bffa0b5a2e | ||
|
|
c33c599d09 | ||
|
|
a80e996371 | ||
|
|
0800781244 | ||
|
|
a8fdf6b09e | ||
|
|
6fa1c6507e | ||
|
|
8f0e0dacad | ||
|
|
32721d8bb2 | ||
|
|
4bfae22ef0 | ||
|
|
4d66c27885 | ||
|
|
46ba5cc4f7 | ||
|
|
6729d23b78 | ||
|
|
ab929d2bd2 | ||
|
|
1fec6e5f77 | ||
|
|
1f2ae86612 | ||
|
|
56d3b16493 | ||
|
|
d5bfe0e5df | ||
|
|
5da9d93db6 | ||
|
|
6499fd1596 | ||
|
|
5f7b628417 | ||
|
|
12ec1b78e4 | ||
|
|
1364fa1658 | ||
|
|
f8565fc084 | ||
|
|
59d86007a6 | ||
|
|
491dd309a1 | ||
|
|
a0cbf3bb90 | ||
|
|
5585d56088 | ||
|
|
2abaa77969 | ||
|
|
e30b9f0bcb | ||
|
|
8ee2886bdd | ||
|
|
e1dabaa6db | ||
|
|
53bdee6244 | ||
|
|
97939376a3 | ||
|
|
0400ab4019 | ||
|
|
dedb41954f | ||
|
|
2e2d2b3004 | ||
|
|
1791efe6a5 | ||
|
|
34ef6fd0cf | ||
|
|
d533940a27 | ||
|
|
57878e1cea | ||
|
|
602d773377 | ||
|
|
dc9b8c28f6 | ||
|
|
773c69afb0 | ||
|
|
654403afc0 | ||
|
|
81d61b3fbf | ||
|
|
f04cd58e19 | ||
|
|
1387760e72 | ||
|
|
60894b7364 | ||
|
|
72e7a4362f | ||
|
|
c35aa8d874 | ||
|
|
707157a777 | ||
|
|
d4dec3d76d | ||
|
|
d9a868eb10 | ||
|
|
a2d0795482 | ||
|
|
113b6444d8 | ||
|
|
121e909367 | ||
|
|
82b62b9645 | ||
|
|
ebdbd8bd72 | ||
|
|
f25e3c3934 | ||
|
|
a6603a6024 | ||
|
|
c1a31f227a | ||
|
|
cc3d7c2f05 | ||
|
|
62f34d8f68 | ||
|
|
ef79d6bb5d | ||
|
|
9034c1add8 | ||
|
|
623b28067c | ||
|
|
a0d6e8ab1c | ||
|
|
b268e40025 | ||
|
|
8b3828c394 | ||
|
|
0d4bc47674 | ||
|
|
d1ac21188f | ||
|
|
bd6217a4a6 | ||
|
|
337f967b14 | ||
|
|
851a7141a2 | ||
|
|
a2bad49418 | ||
|
|
979554b0e4 | ||
|
|
1428fdb7ff | ||
|
|
ecc597b6fe | ||
|
|
05d5b38ab9 | ||
|
|
fb8806ec01 | ||
|
|
5540c60ee1 | ||
|
|
9e11854e43 | ||
|
|
8f9e1b822b | ||
|
|
5e737eaf10 | ||
|
|
ddbc5993a0 | ||
|
|
21ab8e94a2 | ||
|
|
3f9cd34c0e | ||
|
|
4c9c67286c | ||
|
|
17d81e35c7 | ||
|
|
b9d2277e3b | ||
|
|
d90263f52e | ||
|
|
40f3200370 | ||
|
|
426e00eab9 | ||
|
|
fc7dd52ef4 | ||
|
|
8a39d11eb9 | ||
|
|
0303c06a54 | ||
|
|
53ed1ad198 | ||
|
|
e841ae2d89 | ||
|
|
c7b9bea1cb | ||
|
|
bbfee914c1 | ||
|
|
7af016e1b7 | ||
|
|
3ad4299e03 | ||
|
|
62323e7030 | ||
|
|
d1047a4020 | ||
|
|
74ccfbb925 | ||
|
|
f832ac0a55 | ||
|
|
33681d749b | ||
|
|
9147f68d28 | ||
|
|
cf557ad690 | ||
|
|
51554a6a68 | ||
|
|
a12d757ff2 | ||
|
|
48d61d2721 | ||
|
|
74a6934eb5 | ||
|
|
1855f4a3b1 | ||
|
|
d8e74634d4 | ||
|
|
ba9345e4e8 | ||
|
|
f8ed6b17d5 | ||
|
|
3c6e1b9a6e | ||
|
|
d001aeecb3 | ||
|
|
37724bbabf | ||
|
|
64cad981fa | ||
|
|
8b4be8df31 | ||
|
|
a41caa3277 | ||
|
|
0256d3ce01 | ||
|
|
982fc0212a | ||
|
|
2b37bcf466 | ||
|
|
dd332febfd | ||
|
|
cdca026205 | ||
|
|
4ac0f51887 | ||
|
|
95037e713a | ||
|
|
0bd287bc89 | ||
|
|
db1d885614 | ||
|
|
115806c570 | ||
|
|
4fdf4254b2 | ||
|
|
725c905da0 | ||
|
|
44b36684a6 | ||
|
|
3a27213c41 | ||
|
|
93bcd17e21 | ||
|
|
bc0f7bcc87 | ||
|
|
ae4431c884 | ||
|
|
f1fe279408 | ||
|
|
3788ad540f | ||
|
|
c675d347ae | ||
|
|
b19c8663bb | ||
|
|
84d3258a5d | ||
|
|
5824e9ffc3 | ||
|
|
d83f4ae21a | ||
|
|
02e11fedf4 | ||
|
|
24402471d6 | ||
|
|
7cf8b36e95 | ||
|
|
cccf7dad72 | ||
|
|
40260e5275 | ||
|
|
03a51452d6 | ||
|
|
bdfc809c75 | ||
|
|
24990dde39 | ||
|
|
8be501eec4 | ||
|
|
affc59fe2f | ||
|
|
b397b1292c | ||
|
|
40cb087e9e | ||
|
|
7ce1d91bc7 | ||
|
|
00b58cf795 | ||
|
|
840462fafe | ||
|
|
97b4436796 | ||
|
|
49e9377474 | ||
|
|
9bb4224a94 | ||
|
|
0574352e9e | ||
|
|
8c4dae6792 | ||
|
|
1aeab079e1 | ||
|
|
7e2ea66572 | ||
|
|
6b611fcb9c | ||
|
|
8b1042e2b1 | ||
|
|
90a6759baa | ||
|
|
4c67850fd3 | ||
|
|
a17386eb51 | ||
|
|
6c34fd4c6d | ||
|
|
bfb82b4bd0 | ||
|
|
9d44f7c284 | ||
|
|
3beb926328 | ||
|
|
dc3392a883 | ||
|
|
b1295a5390 | ||
|
|
d64de29b0d | ||
|
|
f523fdd369 | ||
|
|
93f6951af3 | ||
|
|
c70e7e2fbe | ||
|
|
4841099047 | ||
|
|
f399978733 | ||
|
|
bb0ead1c15 | ||
|
|
e8fb0854c2 | ||
|
|
4fbe10e867 | ||
|
|
a69fe5951e | ||
|
|
aa824aedf3 | ||
|
|
58d732660c |
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -5,4 +5,4 @@ bin/
|
||||||
|
|
||||||
GitVersion\.h
|
GitVersion\.h
|
||||||
|
|
||||||
STM32F10X_Lib/
|
.vscode/
|
||||||
|
|
|
||||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "STM32F10X_Lib"]
|
||||||
|
path = STM32F10X_Lib
|
||||||
|
url = https://github.com/juribeparada/STM32F10X_Lib
|
||||||
674
ADF7021.cpp
674
ADF7021.cpp
File diff suppressed because it is too large
Load diff
71
ADF7021.h
71
ADF7021.h
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016 by Jim McLaughlin KI6ZUM
|
* Copyright (C) 2016 by Jim McLaughlin KI6ZUM
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
|
||||||
* Copyright (C) 2017 by Danilo DB4PLE
|
* Copyright (C) 2017 by Danilo DB4PLE
|
||||||
*
|
*
|
||||||
* Some of the code is based on work of Guus Van Dooren PE1PLM:
|
* Some of the code is based on work of Guus Van Dooren PE1PLM:
|
||||||
|
|
@ -52,7 +53,7 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
||||||
// Support for ADF7021-N version:
|
// Support for ADF7021-N version:
|
||||||
// #define ADF7021_N_VER
|
// #define ADF7021_N_VER
|
||||||
|
|
||||||
// Enable AFC support for DMR, YSF and P25 (experimental):
|
// Enable AFC support for DMR, YSF, P25, and M17 (experimental):
|
||||||
// (AFC is already enabled by default in D-Star)
|
// (AFC is already enabled by default in D-Star)
|
||||||
// #define ADF7021_ENABLE_4FSK_AFC
|
// #define ADF7021_ENABLE_4FSK_AFC
|
||||||
|
|
||||||
|
|
@ -65,7 +66,9 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
||||||
// R = 4
|
// R = 4
|
||||||
// DEMOD_CLK = 2.4576 MHz (DSTAR)
|
// DEMOD_CLK = 2.4576 MHz (DSTAR)
|
||||||
// DEMOD_CLK = 4.9152 MHz (DMR, YSF_L, P25)
|
// DEMOD_CLK = 4.9152 MHz (DMR, YSF_L, P25)
|
||||||
// DEMOD_CLK = 7.3728 MHz (YSF_H)
|
// DEMOD_CLK = 7.3728 MHz (YSF_H, M17)
|
||||||
|
// DEMOD CLK = 3.6864 MHz (NXDN)
|
||||||
|
// DEMOD_CLK = 7.3728 MHz (POCSAG)
|
||||||
#define ADF7021_PFD 3686400.0
|
#define ADF7021_PFD 3686400.0
|
||||||
|
|
||||||
// PLL (REG 01)
|
// PLL (REG 01)
|
||||||
|
|
@ -84,6 +87,9 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
||||||
#else
|
#else
|
||||||
#define ADF7021_DEV_P25 22U
|
#define ADF7021_DEV_P25 22U
|
||||||
#endif
|
#endif
|
||||||
|
#define ADF7021_DEV_NXDN 13U
|
||||||
|
#define ADF7021_DEV_M17 28U
|
||||||
|
#define ADF7021_DEV_POCSAG 160U
|
||||||
|
|
||||||
// TX/RX CLOCK register (REG 03)
|
// TX/RX CLOCK register (REG 03)
|
||||||
#define ADF7021_REG3_DSTAR 0x2A4C4193
|
#define ADF7021_REG3_DSTAR 0x2A4C4193
|
||||||
|
|
@ -92,12 +98,17 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
||||||
#define ADF7021_REG3_YSF_L 0x2A4C04D3
|
#define ADF7021_REG3_YSF_L 0x2A4C04D3
|
||||||
#define ADF7021_REG3_YSF_H 0x2A4C0493
|
#define ADF7021_REG3_YSF_H 0x2A4C0493
|
||||||
#define ADF7021_REG3_P25 0x2A4C04D3
|
#define ADF7021_REG3_P25 0x2A4C04D3
|
||||||
|
#define ADF7021_REG3_NXDN 0x2A4C04D3
|
||||||
|
#define ADF7021_REG3_M17 0x2A4C04D3
|
||||||
#else
|
#else
|
||||||
#define ADF7021_REG3_DMR 0x2A4C80D3
|
#define ADF7021_REG3_DMR 0x2A4C80D3
|
||||||
#define ADF7021_REG3_YSF_L 0x2A4C80D3
|
#define ADF7021_REG3_YSF_L 0x2A4C80D3
|
||||||
#define ADF7021_REG3_YSF_H 0x2A4CC093
|
#define ADF7021_REG3_YSF_H 0x2A4CC093
|
||||||
#define ADF7021_REG3_P25 0x2A4C80D3
|
#define ADF7021_REG3_P25 0x2A4C80D3
|
||||||
|
#define ADF7021_REG3_NXDN 0x2A4CC113
|
||||||
|
#define ADF7021_REG3_M17 0x2A4CC093
|
||||||
#endif
|
#endif
|
||||||
|
#define ADF7021_REG3_POCSAG 0x2A4F0093
|
||||||
|
|
||||||
// Discriminator bandwith, demodulator (REG 04)
|
// Discriminator bandwith, demodulator (REG 04)
|
||||||
// Bug in ADI evaluation software, use datasheet formula (4FSK)
|
// Bug in ADI evaluation software, use datasheet formula (4FSK)
|
||||||
|
|
@ -106,12 +117,18 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
||||||
#define ADF7021_DISC_BW_YSF_L 393U // K=32
|
#define ADF7021_DISC_BW_YSF_L 393U // K=32
|
||||||
#define ADF7021_DISC_BW_YSF_H 516U // K=28
|
#define ADF7021_DISC_BW_YSF_H 516U // K=28
|
||||||
#define ADF7021_DISC_BW_P25 394U // K=32
|
#define ADF7021_DISC_BW_P25 394U // K=32
|
||||||
|
#define ADF7021_DISC_BW_NXDN 295U // K=32
|
||||||
|
#define ADF7021_DISC_BW_M17 590U // K=32
|
||||||
|
#define ADF7021_DISC_BW_POCSAG 406U // K=22
|
||||||
|
|
||||||
// Post demodulator bandwith (REG 04)
|
// Post demodulator bandwith (REG 04)
|
||||||
#define ADF7021_POST_BW_DSTAR 10U
|
#define ADF7021_POST_BW_DSTAR 10U
|
||||||
#define ADF7021_POST_BW_DMR 150U
|
#define ADF7021_POST_BW_DMR 80U
|
||||||
#define ADF7021_POST_BW_YSF 20U
|
#define ADF7021_POST_BW_YSF 20U
|
||||||
#define ADF7021_POST_BW_P25 6U
|
#define ADF7021_POST_BW_P25 6U
|
||||||
|
#define ADF7021_POST_BW_NXDN 7U
|
||||||
|
#define ADF7021_POST_BW_M17 7U // Test
|
||||||
|
#define ADF7021_POST_BW_POCSAG 1U
|
||||||
|
|
||||||
// IF filter (REG 05)
|
// IF filter (REG 05)
|
||||||
#define ADF7021_REG5 0x000024F5
|
#define ADF7021_REG5 0x000024F5
|
||||||
|
|
@ -121,27 +138,38 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
||||||
|
|
||||||
// AFC configuration (REG 10)
|
// AFC configuration (REG 10)
|
||||||
#define ADF7021_REG10_DSTAR 0x0C96473A
|
#define ADF7021_REG10_DSTAR 0x0C96473A
|
||||||
|
#define ADF7021_REG10_POCSAG 0x1496473A
|
||||||
|
|
||||||
#if defined(ADF7021_ENABLE_4FSK_AFC)
|
#if defined(ADF7021_ENABLE_4FSK_AFC)
|
||||||
#define ADF7021_REG10_DMR 0x01FE473A
|
#define ADF7021_REG10_DMR 0x01FE473A
|
||||||
#define ADF7021_REG10_YSF 0x01FE473A
|
#define ADF7021_REG10_YSF 0x01FE473A
|
||||||
#define ADF7021_REG10_P25 0x01FE473A
|
#define ADF7021_REG10_P25 0x01FE473A
|
||||||
|
#define ADF7021_REG10_NXDN 0x01FE473A
|
||||||
|
#define ADF7021_REG10_M17 0x01FE473A
|
||||||
#if defined(ADF7021_AFC_POS)
|
#if defined(ADF7021_AFC_POS)
|
||||||
#define AFC_OFFSET_DMR -250
|
#define AFC_OFFSET_DMR -250
|
||||||
#define AFC_OFFSET_YSF -250
|
#define AFC_OFFSET_YSF -250
|
||||||
#define AFC_OFFSET_P25 -250
|
#define AFC_OFFSET_P25 -250
|
||||||
|
#define AFC_OFFSET_NXDN -250
|
||||||
|
#define AFC_OFFSET_M17 -250
|
||||||
#else
|
#else
|
||||||
#define AFC_OFFSET_DMR 250
|
#define AFC_OFFSET_DMR 250
|
||||||
#define AFC_OFFSET_YSF 250
|
#define AFC_OFFSET_YSF 250
|
||||||
#define AFC_OFFSET_P25 250
|
#define AFC_OFFSET_P25 250
|
||||||
|
#define AFC_OFFSET_NXDN 250
|
||||||
|
#define AFC_OFFSET_M17 250
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define ADF7021_REG10_DMR 0x049E472A
|
#define ADF7021_REG10_DMR 0x049E472A
|
||||||
#define ADF7021_REG10_YSF 0x049E472A
|
#define ADF7021_REG10_YSF 0x049E472A
|
||||||
#define ADF7021_REG10_P25 0x049E472A
|
#define ADF7021_REG10_P25 0x049E472A
|
||||||
|
#define ADF7021_REG10_NXDN 0x049E472A
|
||||||
|
#define ADF7021_REG10_M17 0x049E472A
|
||||||
#define AFC_OFFSET_DMR 0
|
#define AFC_OFFSET_DMR 0
|
||||||
#define AFC_OFFSET_YSF 0
|
#define AFC_OFFSET_YSF 0
|
||||||
#define AFC_OFFSET_P25 0
|
#define AFC_OFFSET_P25 0
|
||||||
|
#define AFC_OFFSET_NXDN 0
|
||||||
|
#define AFC_OFFSET_M17 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****** Support for 12.2880 MHz TCXO ******/
|
/****** Support for 12.2880 MHz TCXO ******/
|
||||||
|
|
@ -149,7 +177,9 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
||||||
|
|
||||||
// R = 2
|
// R = 2
|
||||||
// DEMOD_CLK = 2.4576 MHz (DSTAR)
|
// DEMOD_CLK = 2.4576 MHz (DSTAR)
|
||||||
// DEMOD_CLK = 6.1440 MHz (DMR, YSF_H, YSF_L, P25)
|
// DEMOD_CLK = 6.1440 MHz (DMR, YSF_H, YSF_L, P25, M17)
|
||||||
|
// DEMOD_CLK = 3.0720 MHz (NXDN)
|
||||||
|
// DEMOD_CLK = 6.1440 MHz (POCSAG)
|
||||||
#define ADF7021_PFD 6144000.0
|
#define ADF7021_PFD 6144000.0
|
||||||
|
|
||||||
// PLL (REG 01)
|
// PLL (REG 01)
|
||||||
|
|
@ -168,6 +198,9 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
||||||
#else
|
#else
|
||||||
#define ADF7021_DEV_P25 13U
|
#define ADF7021_DEV_P25 13U
|
||||||
#endif
|
#endif
|
||||||
|
#define ADF7021_DEV_NXDN 8U
|
||||||
|
#define ADF7021_DEV_M17 17U
|
||||||
|
#define ADF7021_DEV_POCSAG 96U
|
||||||
|
|
||||||
// TX/RX CLOCK register (REG 03)
|
// TX/RX CLOCK register (REG 03)
|
||||||
#define ADF7021_REG3_DSTAR 0x29EC4153
|
#define ADF7021_REG3_DSTAR 0x29EC4153
|
||||||
|
|
@ -176,12 +209,17 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
||||||
#define ADF7021_REG3_YSF_L 0x29EC0493
|
#define ADF7021_REG3_YSF_L 0x29EC0493
|
||||||
#define ADF7021_REG3_YSF_H 0x29EC0493
|
#define ADF7021_REG3_YSF_H 0x29EC0493
|
||||||
#define ADF7021_REG3_P25 0x29EC0493
|
#define ADF7021_REG3_P25 0x29EC0493
|
||||||
|
#define ADF7021_REG3_NXDN 0x29EC0493
|
||||||
|
#define ADF7021_REG3_M17 0x29EC0493
|
||||||
#else
|
#else
|
||||||
#define ADF7021_REG3_DMR 0x29ECA093
|
#define ADF7021_REG3_DMR 0x29ECA093
|
||||||
#define ADF7021_REG3_YSF_L 0x29ECA093
|
#define ADF7021_REG3_YSF_L 0x29ECA093
|
||||||
#define ADF7021_REG3_YSF_H 0x29ECA093
|
#define ADF7021_REG3_YSF_H 0x29ECA093
|
||||||
#define ADF7021_REG3_P25 0x29ECA093
|
#define ADF7021_REG3_P25 0x29ECA093
|
||||||
|
#define ADF7021_REG3_NXDN 0x29ECA113
|
||||||
|
#define ADF7021_REG3_M17 0x29ECA093
|
||||||
#endif
|
#endif
|
||||||
|
#define ADF7021_REG3_POCSAG 0x29EE8093
|
||||||
|
|
||||||
// Discriminator bandwith, demodulator (REG 04)
|
// Discriminator bandwith, demodulator (REG 04)
|
||||||
// Bug in ADI evaluation software, use datasheet formula (4FSK)
|
// Bug in ADI evaluation software, use datasheet formula (4FSK)
|
||||||
|
|
@ -190,12 +228,18 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
||||||
#define ADF7021_DISC_BW_YSF_L 491U // K=32
|
#define ADF7021_DISC_BW_YSF_L 491U // K=32
|
||||||
#define ADF7021_DISC_BW_YSF_H 430U // K=28
|
#define ADF7021_DISC_BW_YSF_H 430U // K=28
|
||||||
#define ADF7021_DISC_BW_P25 493U // K=32
|
#define ADF7021_DISC_BW_P25 493U // K=32
|
||||||
|
#define ADF7021_DISC_BW_NXDN 246U // K=32
|
||||||
|
#define ADF7021_DISC_BW_M17 492U // K=32
|
||||||
|
#define ADF7021_DISC_BW_POCSAG 338U // K=22
|
||||||
|
|
||||||
// Post demodulator bandwith (REG 04)
|
// Post demodulator bandwith (REG 04)
|
||||||
#define ADF7021_POST_BW_DSTAR 10U
|
#define ADF7021_POST_BW_DSTAR 10U
|
||||||
#define ADF7021_POST_BW_DMR 150U
|
#define ADF7021_POST_BW_DMR 80U
|
||||||
#define ADF7021_POST_BW_YSF 20U
|
#define ADF7021_POST_BW_YSF 20U
|
||||||
#define ADF7021_POST_BW_P25 6U
|
#define ADF7021_POST_BW_P25 6U
|
||||||
|
#define ADF7021_POST_BW_NXDN 8U
|
||||||
|
#define ADF7021_POST_BW_M17 8U // Test
|
||||||
|
#define ADF7021_POST_BW_POCSAG 1U
|
||||||
|
|
||||||
// IF filter (REG 05)
|
// IF filter (REG 05)
|
||||||
#define ADF7021_REG5 0x00001ED5
|
#define ADF7021_REG5 0x00001ED5
|
||||||
|
|
@ -205,27 +249,38 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
||||||
|
|
||||||
// AFC (REG 10)
|
// AFC (REG 10)
|
||||||
#define ADF7021_REG10_DSTAR 0x0C96557A
|
#define ADF7021_REG10_DSTAR 0x0C96557A
|
||||||
|
#define ADF7021_REG10_POCSAG 0x1496557A
|
||||||
|
|
||||||
#if defined(ADF7021_ENABLE_4FSK_AFC)
|
#if defined(ADF7021_ENABLE_4FSK_AFC)
|
||||||
#define ADF7021_REG10_DMR 0x01FE557A
|
#define ADF7021_REG10_DMR 0x01FE557A
|
||||||
#define ADF7021_REG10_YSF 0x01FE557A
|
#define ADF7021_REG10_YSF 0x01FE557A
|
||||||
#define ADF7021_REG10_P25 0x01FE557A
|
#define ADF7021_REG10_P25 0x01FE557A
|
||||||
|
#define ADF7021_REG10_NXDN 0x01FE557A
|
||||||
|
#define ADF7021_REG10_M17 0x01FE557A
|
||||||
#if defined(ADF7021_AFC_POS)
|
#if defined(ADF7021_AFC_POS)
|
||||||
#define AFC_OFFSET_DMR -250
|
#define AFC_OFFSET_DMR -250
|
||||||
#define AFC_OFFSET_YSF -250
|
#define AFC_OFFSET_YSF -250
|
||||||
#define AFC_OFFSET_P25 -250
|
#define AFC_OFFSET_P25 -250
|
||||||
|
#define AFC_OFFSET_NXDN -250
|
||||||
|
#define AFC_OFFSET_M17 -250
|
||||||
#else
|
#else
|
||||||
#define AFC_OFFSET_DMR 250
|
#define AFC_OFFSET_DMR 250
|
||||||
#define AFC_OFFSET_YSF 250
|
#define AFC_OFFSET_YSF 250
|
||||||
#define AFC_OFFSET_P25 250
|
#define AFC_OFFSET_P25 250
|
||||||
|
#define AFC_OFFSET_NXDN 250
|
||||||
|
#define AFC_OFFSET_M17 250
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define ADF7021_REG10_DMR 0x049E556A
|
#define ADF7021_REG10_DMR 0x049E556A
|
||||||
#define ADF7021_REG10_YSF 0x049E556A
|
#define ADF7021_REG10_YSF 0x049E556A
|
||||||
#define ADF7021_REG10_P25 0x049E556A
|
#define ADF7021_REG10_P25 0x049E556A
|
||||||
|
#define ADF7021_REG10_NXDN 0x049E556A
|
||||||
|
#define ADF7021_REG10_M17 0x049E556A
|
||||||
#define AFC_OFFSET_DMR 0
|
#define AFC_OFFSET_DMR 0
|
||||||
#define AFC_OFFSET_YSF 0
|
#define AFC_OFFSET_YSF 0
|
||||||
#define AFC_OFFSET_P25 0
|
#define AFC_OFFSET_P25 0
|
||||||
|
#define AFC_OFFSET_NXDN 0
|
||||||
|
#define AFC_OFFSET_M17 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -238,6 +293,8 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
||||||
#define ADF7021_SLICER_TH_YSF_L 35U
|
#define ADF7021_SLICER_TH_YSF_L 35U
|
||||||
#define ADF7021_SLICER_TH_YSF_H 69U
|
#define ADF7021_SLICER_TH_YSF_H 69U
|
||||||
#define ADF7021_SLICER_TH_P25 43U
|
#define ADF7021_SLICER_TH_P25 43U
|
||||||
|
#define ADF7021_SLICER_TH_NXDN 26U
|
||||||
|
#define ADF7021_SLICER_TH_M17 59U // Test
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
@ -246,6 +303,8 @@ www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
||||||
#define ADF7021_SLICER_TH_YSF_L 38U
|
#define ADF7021_SLICER_TH_YSF_L 38U
|
||||||
#define ADF7021_SLICER_TH_YSF_H 75U
|
#define ADF7021_SLICER_TH_YSF_H 75U
|
||||||
#define ADF7021_SLICER_TH_P25 47U
|
#define ADF7021_SLICER_TH_P25 47U
|
||||||
|
#define ADF7021_SLICER_TH_NXDN 26U
|
||||||
|
#define ADF7021_SLICER_TH_M17 59U // Test
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
196
BUILD.md
196
BUILD.md
|
|
@ -1,12 +1,13 @@
|
||||||
# Building instructions
|
# Building instructions
|
||||||
|
|
||||||
This is a detailed guide for building the firmware of MMDVM_HS from the source code. For quick instructions, please see [README.md](README.md). This software runs on STM32F103 microcontroller. You can build this code using Arduino IDE with STM32duino package, or using "make" with ARM GCC tools. Also, Arduino with 3.3 V I/O (Arduino Due and Zero) and Teensy (3.1, 3.2, 3.5 or 3.6) are supported.
|
This is a detailed guide for building the firmware of MMDVM_HS from the source code. For quick instructions, please see [README.md](README.md). This software runs on STM32F103 microcontroller. Also, Arduino with 3.3 V I/O (Arduino Due and Zero) and Teensy (3.1, 3.2, 3.5 or 3.6) are supported. You can build this code using Arduino IDE with Roger Clark's [STM32duino](https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/ZUMspot) package, or using command line tools with ARM GCC tools. The preferred method under Windows is using STM32duino, and under Linux or macOS (command line) is using [STM32F10X_Lib](https://github.com/juribeparada/STM32F10X_Lib).
|
||||||
|
|
||||||
# Index
|
# Index
|
||||||
|
|
||||||
- ZUMspot RPi
|
- ZUMspot RPi
|
||||||
- ZUMspot Libre Kit
|
- ZUMspot Libre Kit
|
||||||
- ZUMspot USB
|
- ZUMspot USB
|
||||||
|
- MMDVM_HS_Hat
|
||||||
- Makefile options
|
- Makefile options
|
||||||
- Config.h options
|
- Config.h options
|
||||||
- Pinout definitions
|
- Pinout definitions
|
||||||
|
|
@ -70,7 +71,16 @@ Reboot your RPi:
|
||||||
|
|
||||||
sudo reboot
|
sudo reboot
|
||||||
|
|
||||||
### Build de firmware and upload to ZUMspot RPi
|
### Build the firmware and upload to ZUMspot RPi
|
||||||
|
|
||||||
|
If you are using Pi-Star, expand filesystem (if you haven't done before):
|
||||||
|
|
||||||
|
sudo pistar-expand
|
||||||
|
sudo reboot
|
||||||
|
|
||||||
|
Enable RW filesystem if you are using Pi-Star:
|
||||||
|
|
||||||
|
rpi-rw
|
||||||
|
|
||||||
Install the necessary software tools:
|
Install the necessary software tools:
|
||||||
|
|
||||||
|
|
@ -88,7 +98,8 @@ Download the firmware sources:
|
||||||
cd ~
|
cd ~
|
||||||
git clone https://github.com/juribeparada/MMDVM_HS
|
git clone https://github.com/juribeparada/MMDVM_HS
|
||||||
cd MMDVM_HS/
|
cd MMDVM_HS/
|
||||||
git clone https://github.com/juribeparada/STM32F10X_Lib
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
|
||||||
(Please do not download any different code inside MMDVM_HS folder)
|
(Please do not download any different code inside MMDVM_HS folder)
|
||||||
|
|
||||||
|
|
@ -98,7 +109,7 @@ Edit Config.h
|
||||||
|
|
||||||
and enable:
|
and enable:
|
||||||
|
|
||||||
#define PI_HAT_7021_REV_03
|
#define ZUMSPOT_ADF7021
|
||||||
#define ENABLE_ADF7021
|
#define ENABLE_ADF7021
|
||||||
#define ADF7021_14_7456
|
#define ADF7021_14_7456
|
||||||
#define STM32_USART1_HOST
|
#define STM32_USART1_HOST
|
||||||
|
|
@ -108,6 +119,12 @@ Build the firmware:
|
||||||
|
|
||||||
make
|
make
|
||||||
|
|
||||||
|
If you are using Pi-Star, stop services:
|
||||||
|
|
||||||
|
sudo pistar-watchdog.service stop
|
||||||
|
sudo systemctl stop mmdvmhost.timer
|
||||||
|
sudo systemctl stop mmdvmhost.service
|
||||||
|
|
||||||
Upload the firmware to ZUMspot RPi board:
|
Upload the firmware to ZUMspot RPi board:
|
||||||
|
|
||||||
sudo make zumspot-pi
|
sudo make zumspot-pi
|
||||||
|
|
@ -152,23 +169,19 @@ Install the USB bootloader to STM32F103. Follow the instructions:
|
||||||
|
|
||||||
https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/stm32duino-bootloader
|
https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/stm32duino-bootloader
|
||||||
|
|
||||||
Connect the ZUMspot Libre Kit to your PC. Install the USB Mapple driver using the bat file
|
Connect the ZUMspot Libre Kit to your PC. Install the USB Mapple driver using the bat file (you may also check http://wiki.stm32duino.com/index.php?title=Windows_driver_installation):
|
||||||
(you may also check http://wiki.stm32duino.com/index.php?title=Windows_driver_installation):
|
|
||||||
|
|
||||||
My Documents/Arduino/hardware/Arduino_STM32/drivers/win/install_drivers.bat
|
My Documents/Arduino/hardware/Arduino_STM32/drivers/win/install_drivers.bat
|
||||||
|
|
||||||
You have to be sure that Windows detect your ZUMspot as an USB serial device COMx (please
|
You have to be sure that Windows detect your ZUMspot as an USB serial device COMx (please see Windows Device Manager).
|
||||||
see Windows Device Manager).
|
|
||||||
|
|
||||||
Download the source (zip file) of MMDVM_HS from:
|
Download the source (zip file) of MMDVM_HS from:
|
||||||
|
|
||||||
https://github.com/juribeparada/MMDVM_HS
|
https://github.com/juribeparada/MMDVM_HS
|
||||||
|
|
||||||
Do not download or install the STM32F103 library (STM32F10X_Lib) this is not necessary
|
Do not download or install the STM32F103 library (STM32F10X_Lib) this is not necessary under STM32duino.
|
||||||
under STM32duino.
|
|
||||||
|
|
||||||
Unzip MMDVM_HS-master.zip and change the folder name to "MMDVM_HS". The path name to this
|
Unzip MMDVM_HS-master.zip and change the folder name to "MMDVM_HS". The path name to this folder can't have spaces.
|
||||||
folder can't have spaces.
|
|
||||||
|
|
||||||
Start the Arduino IDE. Open the MMDVM_HS.ino file in the MMDVM_HS folder.
|
Start the Arduino IDE. Open the MMDVM_HS.ino file in the MMDVM_HS folder.
|
||||||
|
|
||||||
|
|
@ -182,7 +195,7 @@ Under the menu "Tools" select "Board" and then select:
|
||||||
|
|
||||||
Edit Config.h:
|
Edit Config.h:
|
||||||
|
|
||||||
#define ADF7021_CARRIER_BOARD
|
#define LIBRE_KIT_ADF7021
|
||||||
#define ENABLE_ADF7021
|
#define ENABLE_ADF7021
|
||||||
#define ADF7021_14_7456
|
#define ADF7021_14_7456
|
||||||
#define STM32_USB_HOST
|
#define STM32_USB_HOST
|
||||||
|
|
@ -190,39 +203,35 @@ Edit Config.h:
|
||||||
|
|
||||||
Click the Upload button in the IDE and wait for the transfer.
|
Click the Upload button in the IDE and wait for the transfer.
|
||||||
|
|
||||||
Once the transfer is completed, press the RESET button of the board or disconnect and
|
Once the transfer is completed, press the RESET button of the board or disconnect and connect the USB cable. You will see the LED (PC13) of the blue pill blinking. Once you connect with MMDVMHost, the LED will blink fast.
|
||||||
connect the USB cable. You will see the LED (PC13) of the blue pill blinking. Once you connect
|
|
||||||
with MMDVMHost, the LED will blink fast.
|
For further help with STM32duino and STM32F103 blue pill boards, please see the STM32duino [forum](http://www.stm32duino.com).
|
||||||
|
|
||||||
## Windows with command line
|
## Windows with command line
|
||||||
|
|
||||||
Download the source code (zip file) of MMDVM_HS from:
|
Download the source code (zip file) of MMDVM_HS from:
|
||||||
|
|
||||||
https://github.com/juribeparada/MMDVM_HS
|
https://github.com/juribeparada/MMDVM_HS
|
||||||
|
|
||||||
Unzip MMDVM_HS-master.zip and change the folder name to "MMDVM_HS". The path name to this
|
Unzip MMDVM_HS-master.zip and change the folder name to "MMDVM_HS". The path name to this folder can't have spaces.
|
||||||
folder can't have spaces.
|
|
||||||
|
|
||||||
Download the ST libraries STM32F10X_Lib-master.zip from:
|
Download the ST libraries STM32F10X_Lib-master.zip from:
|
||||||
|
|
||||||
https://github.com/juribeparada/STM32F10X_Lib/
|
https://github.com/juribeparada/STM32F10X_Lib/
|
||||||
|
|
||||||
Extract the STM32F10X_Lib-master folder into the same folder as the MMDVM_HS. Change the folder
|
Extract the STM32F10X_Lib-master folder into the same folder as the MMDVM_HS. Change the folder name to "STM32F10X_Lib".
|
||||||
name to "STM32F10X_Lib".
|
|
||||||
|
|
||||||
Download the GNU make utility:
|
Download the GNU make utility:
|
||||||
|
|
||||||
http://gnuwin32.sourceforge.net/packages/make.htm
|
http://gnuwin32.sourceforge.net/packages/make.htm
|
||||||
|
|
||||||
Download the binaries zip file and extract make.exe and put it in the same directory MMDVM_HS. Download
|
Download the binaries zip file and extract make.exe and put it in the same directory MMDVM_HS. Download the dependencies zip file and extract libintl3.dll and libiconv2.dll and put them in the same directory MMDVM_HS.
|
||||||
the dependencies zip file and extract libintl3.dll and libiconv2.dll and put them in the same directory MMDVM_HS.
|
|
||||||
|
|
||||||
Download the GNU ARM embedded toolchain from here:
|
Download the GNU ARM embedded toolchain from here:
|
||||||
|
|
||||||
https://launchpad.net/gcc-arm-embedded/+download
|
https://launchpad.net/gcc-arm-embedded/+download
|
||||||
|
|
||||||
Currently the direct link to the installer is here:
|
Currently the direct link to the installer is here:
|
||||||
|
|
||||||
https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update/+download/gcc-arm-none-eabi-5_4-2016q3-20160926-win32.exe
|
https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update/+download/gcc-arm-none-eabi-5_4-2016q3-20160926-win32.exe
|
||||||
|
|
||||||
Download STM32duino (Arduino for STM32) from this URL (only for USB drivers):
|
Download STM32duino (Arduino for STM32) from this URL (only for USB drivers):
|
||||||
|
|
@ -232,9 +241,8 @@ Download STM32duino (Arduino for STM32) from this URL (only for USB drivers):
|
||||||
Unzip and copy Arduino_STM32-ZUMspot folder in (for example):
|
Unzip and copy Arduino_STM32-ZUMspot folder in (for example):
|
||||||
|
|
||||||
C:\Arduino_STM32-ZUMspot
|
C:\Arduino_STM32-ZUMspot
|
||||||
|
|
||||||
Connect the ZUMspot Libre Kit to your PC. Install the USB Mapple driver using the bat file
|
Connect the ZUMspot Libre Kit to your PC. Install the USB Mapple driver using the bat file (you may also check http://wiki.stm32duino.com/index.php?title=Windows_driver_installation):
|
||||||
(you may also check http://wiki.stm32duino.com/index.php?title=Windows_driver_installation):
|
|
||||||
|
|
||||||
C:\Arduino_STM32-ZUMspot\drivers\win\install_drivers.bat
|
C:\Arduino_STM32-ZUMspot\drivers\win\install_drivers.bat
|
||||||
|
|
||||||
|
|
@ -256,6 +264,15 @@ Press the reset button of ZUMspot and upload the firmware:
|
||||||
|
|
||||||
## Linux Raspbian
|
## Linux Raspbian
|
||||||
|
|
||||||
|
If you are using Pi-Star, expand filesystem (if you haven't done before):
|
||||||
|
|
||||||
|
sudo pistar-expand
|
||||||
|
sudo reboot
|
||||||
|
|
||||||
|
Enable RW filesystem if you are using Pi-Star:
|
||||||
|
|
||||||
|
rpi-rw
|
||||||
|
|
||||||
Install the necessary software tools:
|
Install the necessary software tools:
|
||||||
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
@ -266,7 +283,8 @@ Download the sources:
|
||||||
cd ~
|
cd ~
|
||||||
git clone https://github.com/juribeparada/MMDVM_HS
|
git clone https://github.com/juribeparada/MMDVM_HS
|
||||||
cd MMDVM_HS/
|
cd MMDVM_HS/
|
||||||
git clone https://github.com/juribeparada/STM32F10X_Lib
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
|
||||||
(Please do not download any different code inside MMDVM_HS folder)
|
(Please do not download any different code inside MMDVM_HS folder)
|
||||||
|
|
||||||
|
|
@ -276,7 +294,7 @@ Edit Config.h:
|
||||||
|
|
||||||
and enable:
|
and enable:
|
||||||
|
|
||||||
#define ADF7021_CARRIER_BOARD
|
#define LIBRE_KIT_ADF7021
|
||||||
#define ENABLE_ADF7021
|
#define ENABLE_ADF7021
|
||||||
#define ADF7021_14_7456
|
#define ADF7021_14_7456
|
||||||
#define STM32_USB_HOST
|
#define STM32_USB_HOST
|
||||||
|
|
@ -286,9 +304,13 @@ Build the firmware with bootloader support:
|
||||||
|
|
||||||
make bl
|
make bl
|
||||||
|
|
||||||
Upload bootloader and firmware to ZUMspot Libre Kit, using serial port first (you
|
If you are using Pi-Star, stop services:
|
||||||
are using an USB-serial converter with device name /dev/ttyUSB0). Move BOOT0
|
|
||||||
jumper to 1, next press and release RESET and execute:
|
sudo pistar-watchdog.service stop
|
||||||
|
sudo systemctl stop mmdvmhost.timer
|
||||||
|
sudo systemctl stop mmdvmhost.service
|
||||||
|
|
||||||
|
Upload bootloader and firmware to ZUMspot Libre Kit, using serial port first (you are using an USB-serial converter with device name /dev/ttyUSB0). Move BOOT0 jumper to 1, next press and release RESET and execute:
|
||||||
|
|
||||||
sudo make serial-bl devser=/dev/ttyUSB0
|
sudo make serial-bl devser=/dev/ttyUSB0
|
||||||
|
|
||||||
|
|
@ -364,7 +386,7 @@ Under the menu "Tools" select "Board" and then select:
|
||||||
|
|
||||||
Edit Config.h:
|
Edit Config.h:
|
||||||
|
|
||||||
#define PI_HAT_7021_REV_03
|
#define ZUMSPOT_ADF7021
|
||||||
#define ENABLE_ADF7021
|
#define ENABLE_ADF7021
|
||||||
#define ADF7021_14_7456
|
#define ADF7021_14_7456
|
||||||
#define STM32_USB_HOST
|
#define STM32_USB_HOST
|
||||||
|
|
@ -377,6 +399,15 @@ connect the USB cable.
|
||||||
|
|
||||||
## Linux Raspbian
|
## Linux Raspbian
|
||||||
|
|
||||||
|
If you are using Pi-Star, expand filesystem (if you haven't done before):
|
||||||
|
|
||||||
|
sudo pistar-expand
|
||||||
|
sudo reboot
|
||||||
|
|
||||||
|
Enable RW filesystem if you are using Pi-Star:
|
||||||
|
|
||||||
|
rpi-rw
|
||||||
|
|
||||||
Install the necessary software tools:
|
Install the necessary software tools:
|
||||||
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
|
|
@ -387,7 +418,8 @@ Download the sources:
|
||||||
cd ~
|
cd ~
|
||||||
git clone https://github.com/juribeparada/MMDVM_HS
|
git clone https://github.com/juribeparada/MMDVM_HS
|
||||||
cd MMDVM_HS/
|
cd MMDVM_HS/
|
||||||
git clone https://github.com/juribeparada/STM32F10X_Lib
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
|
||||||
(Please do not download any different code inside MMDVM_HS folder)
|
(Please do not download any different code inside MMDVM_HS folder)
|
||||||
|
|
||||||
|
|
@ -397,7 +429,7 @@ Edit Config.h
|
||||||
|
|
||||||
and enable:
|
and enable:
|
||||||
|
|
||||||
#define PI_HAT_7021_REV_03
|
#define ZUMSPOT_ADF7021
|
||||||
#define ENABLE_ADF7021
|
#define ENABLE_ADF7021
|
||||||
#define ADF7021_14_7456
|
#define ADF7021_14_7456
|
||||||
#define STM32_USB_HOST
|
#define STM32_USB_HOST
|
||||||
|
|
@ -407,6 +439,12 @@ Build the firmware with bootloader support:
|
||||||
|
|
||||||
make bl
|
make bl
|
||||||
|
|
||||||
|
If you are using Pi-Star, stop services:
|
||||||
|
|
||||||
|
sudo pistar-watchdog.service stop
|
||||||
|
sudo systemctl stop mmdvmhost.timer
|
||||||
|
sudo systemctl stop mmdvmhost.service
|
||||||
|
|
||||||
Upload the firmware to ZUMspot USB:
|
Upload the firmware to ZUMspot USB:
|
||||||
|
|
||||||
sudo make dfu devser=/dev/ttyACM0
|
sudo make dfu devser=/dev/ttyACM0
|
||||||
|
|
@ -426,6 +464,12 @@ Edit MMDVM.ini according your preferences
|
||||||
Execute MMDVMHost:
|
Execute MMDVMHost:
|
||||||
|
|
||||||
./MMDVMHost MMDVM.ini
|
./MMDVMHost MMDVM.ini
|
||||||
|
|
||||||
|
# MMDVM_HS_Hat
|
||||||
|
|
||||||
|
Please check here for detailed instructions:
|
||||||
|
|
||||||
|
https://github.com/mathisschmieder/MMDVM_HS_Hat/blob/master/README.md
|
||||||
|
|
||||||
# Makefile options
|
# Makefile options
|
||||||
|
|
||||||
|
|
@ -435,27 +479,43 @@ Execute MMDVMHost:
|
||||||
|
|
||||||
- make bl: it builds a firmware with USB bootloader support.
|
- make bl: it builds a firmware with USB bootloader support.
|
||||||
|
|
||||||
- make zumspot-pi: upload the firmware to a ZUMspot RPi version (using internal RPi serial port)
|
- make zumspot-pi: upload the firmware to a ZUMspot RPi version (using internal RPi serial port)
|
||||||
|
|
||||||
- make dfu [devser=/dev/ttyXXX]: upload firmware using USB bootloader. "devser" is optional,
|
- make mmdvm_hs_hat: upload the firmware to MMDVM_HS_Hat board (using internal RPi serial port)
|
||||||
and it corresponds to the USB serial port device name. This option permits to perform a reset
|
|
||||||
to enter to booloader mode (DFU). If you don't use "devser", you have to press the reset button
|
- make nano-hotspot: upload the firmware to Nano hotSPOT board (using internal serial port)
|
||||||
of the ZUMspot just before using this command.
|
|
||||||
|
- make nano-dv: upload the firmware to NanoDV board (using internal serial port)
|
||||||
|
|
||||||
|
- make d2rg_mmdvm_hs: upload the firmware to D2RG MMDVM_HS board (using internal serial port)
|
||||||
|
|
||||||
|
- make skybridge: upload the firmware to SkyBridge HotSpot board (using internal serial port)
|
||||||
|
|
||||||
|
- make dfu [devser=/dev/ttyXXX]: upload firmware using USB bootloader. "devser" is optional, and it corresponds to the USB serial port device name. This option permits to perform a reset to enter to booloader mode (DFU). If you don't use "devser", you have to press the reset button of the ZUMspot just before using this command.
|
||||||
|
|
||||||
- make serial devser=/dev/ttyXXX: upload standard firmware using serial port bootloader method.
|
- make serial devser=/dev/ttyXXX: upload standard firmware using serial port bootloader method.
|
||||||
|
|
||||||
- make serial-bl devser=/dev/ttyXXX: upload firmware with USB bootloader support using serial
|
- make serial-bl devser=/dev/ttyXXX: upload firmware with USB bootloader support using serial port bootloader method.
|
||||||
port bootloader method.
|
|
||||||
|
- make serial-nobl devser=/dev/ttyXXX: upload firmware with USB support using serial port bootloader method, but without USB bootloader installation.
|
||||||
|
|
||||||
|
- make serial-bl-old devser=/dev/ttyXXX: same as "make serial-bl" but using bootloader with short reset pulse.
|
||||||
|
|
||||||
- make stlink: upload standard firmware using ST-Link interface.
|
- make stlink: upload standard firmware using ST-Link interface.
|
||||||
|
|
||||||
- make stlink-bl: upload firmware with USB bootloader support using ST-Link interface.
|
- make stlink-bl: upload firmware with USB bootloader support using ST-Link interface.
|
||||||
|
|
||||||
- make ocd: upload standard firmware using ST-Link interface. This method uses a local
|
- make stlink-nobl: upload firmware with USB support using ST-Link interface, but without USB bootloader.
|
||||||
openocd installation.
|
|
||||||
|
|
||||||
- make ocd-bl: upload firmware with USB bootloader support using ST-Link interface. This
|
- make stlink-bl-old: same as "make stlink-bl" but using bootloader with short reset pulse.
|
||||||
method uses a local openocd installation.
|
|
||||||
|
- make ocd: upload standard firmware using ST-Link interface. This method uses a local openocd installation.
|
||||||
|
|
||||||
|
- make ocd-nobl: upload firmware with USB support using ST-Link interface, but without USB bootloader. This method uses a local openocd installation.
|
||||||
|
|
||||||
|
- make ocd-bl: upload firmware with USB bootloader support using ST-Link interface. This method uses a local openocd installation.
|
||||||
|
|
||||||
|
- make ocd-bl-old: same as "make ocd-bl" but using bootloader with short reset pulse.
|
||||||
|
|
||||||
## Common Makefile commands
|
## Common Makefile commands
|
||||||
|
|
||||||
|
|
@ -480,11 +540,17 @@ ZUMspot RPi (no USB support needed):
|
||||||
|
|
||||||
# Config.h options
|
# Config.h options
|
||||||
|
|
||||||
- #define PI_HAT_7021_REV_03: enable pinouts support for ZUMspot RPi or ZUMspot USB. You have
|
- #define ZUMSPOT_ADF7021: enable pinouts support for ZUMspot RPi or ZUMspot USB. You have to enable this option if you have one of these products.
|
||||||
to enable this option if you have one of these products.
|
|
||||||
|
|
||||||
- #define ADF7021_CARRIER_BOARD: enable this option if you have a ZUMspot Libre Kit (Board with
|
- #define LIBRE_KIT_ADF7021: enable this option if you have a ZUMspot Libre Kit (Board with modified RF7021SE and Blue Pill STM32F103).
|
||||||
modified RF7021SE and Blue Pill STM32F103).
|
|
||||||
|
- #define MMDVM_HS_HAT_REV12: enable this option if you have a MMDVM_HS_Hat board for RPi.
|
||||||
|
|
||||||
|
- #define MMDVM_HS_DUAL_HAT_REV10: enable this option if you have a MMDVM_HS_Dual_Hat board for RPi/USB.
|
||||||
|
|
||||||
|
- #define NANO_HOTSPOT: enable this option if you have a Nano hotSPOT (BI7JTA).
|
||||||
|
|
||||||
|
- #define NANO_DV_REV10: enable this option if you have a Nano DV (BG4TGO & BG5HHP).
|
||||||
|
|
||||||
- #define ENABLE_ADF7021: add support for ADF7021 (all boards, enabled by default).
|
- #define ENABLE_ADF7021: add support for ADF7021 (all boards, enabled by default).
|
||||||
|
|
||||||
|
|
@ -494,16 +560,11 @@ modified RF7021SE and Blue Pill STM32F103).
|
||||||
|
|
||||||
- #define ADF7021_12_2880: select this option if your board uses a 12.2880 MHz.
|
- #define ADF7021_12_2880: select this option if your board uses a 12.2880 MHz.
|
||||||
|
|
||||||
- #define STM32_USART1_HOST: enable direct serial host communication with ZUMspot (using USART1
|
- #define STM32_USART1_HOST: enable direct serial host communication with ZUMspot (using USART1 PA9 and PA10 pins). Disable STM32_USB_HOST if you enable this option. Enable this if you have a ZUMspot RPi. You don't need to enable this option if you will transfer the bootloader.
|
||||||
PA9 and PA10 pins). Disable STM32_USB_HOST if you enable this option. Enable this if you have
|
|
||||||
a ZUMspot RPi. You don't need to enable this option if you will transfer the bootloader.
|
|
||||||
|
|
||||||
- #define STM32_USB_HOST: enable USB host communication with ZUMspot (using STM32F103 USB
|
- #define STM32_USB_HOST: enable USB host communication with ZUMspot (using STM32F103 USB interface). Disable STM32_USART1_HOST if you enable this option. Enable this if you have a ZUMspot USB or ZUMspot Libre Kit.
|
||||||
interface). Disable STM32_USART1_HOST if you enable this option. Enable this if you have
|
|
||||||
a ZUMspot USB or ZUMspot Libre Kit.
|
|
||||||
|
|
||||||
- #define ENABLE_SCAN_MODE: enable automatic mode detection in ZUMspot. This is based on
|
- #define ENABLE_SCAN_MODE: enable automatic mode detection in ZUMspot. This is based on scanning over all enabled modes, and you could have some detection delay. Enabled by default.
|
||||||
scanning over all enabled modes, and you could have some detection delay. Enabled by default.
|
|
||||||
|
|
||||||
- #define SEND_RSSI_DATA: enable RSSI reports to MMDVMHost. It is already converted to dBm.
|
- #define SEND_RSSI_DATA: enable RSSI reports to MMDVMHost. It is already converted to dBm.
|
||||||
|
|
||||||
|
|
@ -558,6 +619,7 @@ Status LEDs:
|
||||||
|
|
||||||
COS_LED PB15
|
COS_LED PB15
|
||||||
PTT_LED PB14
|
PTT_LED PB14
|
||||||
|
NXDN_LED PA8
|
||||||
P25_LED PB0
|
P25_LED PB0
|
||||||
YSF_LED PB1
|
YSF_LED PB1
|
||||||
DMR_LED PB13
|
DMR_LED PB13
|
||||||
|
|
@ -568,8 +630,7 @@ Misc pins:
|
||||||
PIN_LED PC13 (status led)
|
PIN_LED PC13 (status led)
|
||||||
PIN_DEB PB9 (debugging pin)
|
PIN_DEB PB9 (debugging pin)
|
||||||
|
|
||||||
You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for
|
You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for reducing EMI.
|
||||||
reducing EMI.
|
|
||||||
|
|
||||||
## Pinout definitions for Arduino Due/Zero + RF7021SE
|
## Pinout definitions for Arduino Due/Zero + RF7021SE
|
||||||
|
|
||||||
|
|
@ -597,6 +658,7 @@ Status LEDs:
|
||||||
|
|
||||||
COS_LED 10
|
COS_LED 10
|
||||||
PTT_LED 9
|
PTT_LED 9
|
||||||
|
NXDN_LED 18
|
||||||
P25_LED 17
|
P25_LED 17
|
||||||
YSF_LED 16
|
YSF_LED 16
|
||||||
DMR_LED 15
|
DMR_LED 15
|
||||||
|
|
@ -607,8 +669,7 @@ Misc pins:
|
||||||
PIN_LED 13
|
PIN_LED 13
|
||||||
PIN_DEB 11
|
PIN_DEB 11
|
||||||
|
|
||||||
You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for
|
You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for reducing EMI.
|
||||||
reducing EMI.
|
|
||||||
|
|
||||||
## Pinout definitions for Teensy (3.1, 3.2, 3.5 or 3.6) + RF7021SE:
|
## Pinout definitions for Teensy (3.1, 3.2, 3.5 or 3.6) + RF7021SE:
|
||||||
|
|
||||||
|
|
@ -638,6 +699,7 @@ Status LEDs:
|
||||||
|
|
||||||
COS_LED 15
|
COS_LED 15
|
||||||
PTT_LED 14
|
PTT_LED 14
|
||||||
|
NXDN_LED 20
|
||||||
P25_LED 19
|
P25_LED 19
|
||||||
YSF_LED 18
|
YSF_LED 18
|
||||||
DMR_LED 17
|
DMR_LED 17
|
||||||
|
|
@ -648,8 +710,7 @@ Misc pins:
|
||||||
PIN_LED 13
|
PIN_LED 13
|
||||||
PIN_DEB 23
|
PIN_DEB 23
|
||||||
|
|
||||||
You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for
|
You could install a serie resistor (10 - 100 ohms) in each TxRxData and TxRxCLK lines, for reducing EMI.
|
||||||
reducing EMI.
|
|
||||||
|
|
||||||
# Hidden functions
|
# Hidden functions
|
||||||
|
|
||||||
|
|
@ -663,11 +724,9 @@ Also in ADF7021.h:
|
||||||
|
|
||||||
- #define ADF7021_N_VER: enable support for narrow band version of ADF7021 (ADF7021N). Disabled by default, in general all boards will have just ADF7021.
|
- #define ADF7021_N_VER: enable support for narrow band version of ADF7021 (ADF7021N). Disabled by default, in general all boards will have just ADF7021.
|
||||||
|
|
||||||
- #define ADF7021_ENABLE_4FSK_AFC: enable AFC support for DMR, YSF and P25. This is experimental,
|
- #define ADF7021_ENABLE_4FSK_AFC: enable AFC support for DMR, YSF and P25. This is experimental, depending on your frequency offset this option will improve or not your BER reception.
|
||||||
depending on your frequency offset this option will improve or not your BER reception.
|
|
||||||
|
|
||||||
- #define ADF7021_AFC_POS: enable this option if you can not receive any signal after enable the
|
- #define ADF7021_AFC_POS: enable this option if you can not receive any signal after enable the ADF7021_ENABLE_4FSK_AFC option.
|
||||||
ADF7021_ENABLE_4FSK_AFC option.
|
|
||||||
|
|
||||||
- #define ADF7021_DISABLE_RC_4FSK: disable TX Raised Cosine filter for 4FSK modulation in ADF7021. Default TX pulse shaping filter for 4FSK is not optimum for DMR, YSF and P25. Activating this option might improve audio in 4FSK digital modes.
|
- #define ADF7021_DISABLE_RC_4FSK: disable TX Raised Cosine filter for 4FSK modulation in ADF7021. Default TX pulse shaping filter for 4FSK is not optimum for DMR, YSF and P25. Activating this option might improve audio in 4FSK digital modes.
|
||||||
|
|
||||||
|
|
@ -678,4 +737,3 @@ In Globals.h:
|
||||||
In IOSTM.cpp:
|
In IOSTM.cpp:
|
||||||
|
|
||||||
- #define PI_HAT_7021_REV_02: enable pinouts for first revision of ZUMspot RPi. In general is not used.
|
- #define PI_HAT_7021_REV_02: enable pinouts for first revision of ZUMspot RPi. In general is not used.
|
||||||
|
|
||||||
|
|
|
||||||
19
BitRB.cpp
19
BitRB.cpp
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
TX fifo control - Copyright (C) KI6ZUM 2015
|
TX fifo control - Copyright (C) KI6ZUM 2015
|
||||||
Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
||||||
Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
|
|
@ -21,6 +21,11 @@ Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
#include "BitRB.h"
|
#include "BitRB.h"
|
||||||
|
|
||||||
|
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
||||||
|
|
||||||
|
#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
|
||||||
|
#define READ_BIT1(p,i) ((p[(i)>>3] & BIT_MASK_TABLE[(i)&7]) >> (7 - ((i)&7)))
|
||||||
|
|
||||||
CBitRB::CBitRB(uint16_t length) :
|
CBitRB::CBitRB(uint16_t length) :
|
||||||
m_length(length),
|
m_length(length),
|
||||||
m_bits(NULL),
|
m_bits(NULL),
|
||||||
|
|
@ -30,8 +35,8 @@ m_tail(0U),
|
||||||
m_full(false),
|
m_full(false),
|
||||||
m_overflow(false)
|
m_overflow(false)
|
||||||
{
|
{
|
||||||
m_bits = new uint8_t[length];
|
m_bits = new uint8_t[length / 8U];
|
||||||
m_control = new uint8_t[length];
|
m_control = new uint8_t[length / 8U];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t CBitRB::getSpace() const
|
uint16_t CBitRB::getSpace() const
|
||||||
|
|
@ -68,8 +73,8 @@ bool CBitRB::put(uint8_t bit, uint8_t control)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bits[m_head] = bit;
|
WRITE_BIT1(m_bits, m_head, bit);
|
||||||
m_control[m_head] = control;
|
WRITE_BIT1(m_control, m_head, control);
|
||||||
|
|
||||||
m_head++;
|
m_head++;
|
||||||
if (m_head >= m_length)
|
if (m_head >= m_length)
|
||||||
|
|
@ -86,8 +91,8 @@ bool CBitRB::get(uint8_t& bit, uint8_t& control)
|
||||||
if (m_head == m_tail && !m_full)
|
if (m_head == m_tail && !m_full)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bit = m_bits[m_tail];
|
bit = READ_BIT1(m_bits, m_tail);
|
||||||
control = m_control[m_tail];
|
control = READ_BIT1(m_control, m_tail);
|
||||||
|
|
||||||
m_full = false;
|
m_full = false;
|
||||||
|
|
||||||
|
|
|
||||||
6
BitRB.h
6
BitRB.h
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Serial fifo control - Copyright (C) KI6ZUM 2015
|
Serial fifo control - Copyright (C) KI6ZUM 2015
|
||||||
Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
||||||
Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
Copyright (C) 2016,2017 by Andy Uribe CA6JAU
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
|
|
@ -24,6 +24,10 @@ Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
#if defined(STM32F10X_MD)
|
#if defined(STM32F10X_MD)
|
||||||
#include "stm32f10x.h"
|
#include "stm32f10x.h"
|
||||||
|
#elif defined(STM32F4XX)
|
||||||
|
#include "stm32f4xx.h"
|
||||||
|
#elif defined(STM32F7XX)
|
||||||
|
#include "stm32f7xx.h"
|
||||||
#else
|
#else
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
175
CWIdTX.cpp
Normal file
175
CWIdTX.cpp
Normal file
|
|
@ -0,0 +1,175 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2009-2017 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
|
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "CWIdTX.h"
|
||||||
|
|
||||||
|
// 4FSK symbol sequence (800 Hz "tone" at 4800 baud): +1 +3 +1 -1 -3 -1
|
||||||
|
// Bit sequence: 00 01 00 10 11 10
|
||||||
|
uint8_t TONE[] = {0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0};
|
||||||
|
|
||||||
|
uint8_t SILENCE[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
const uint8_t CYCLE_LENGTH = 12U;
|
||||||
|
|
||||||
|
const uint8_t DOT_LENGTH = 40U;
|
||||||
|
|
||||||
|
const struct {
|
||||||
|
uint8_t c;
|
||||||
|
uint32_t pattern;
|
||||||
|
uint8_t length;
|
||||||
|
} SYMBOL_LIST[] = {
|
||||||
|
{'A', 0xB8000000U, 8U},
|
||||||
|
{'B', 0xEA800000U, 12U},
|
||||||
|
{'C', 0xEBA00000U, 14U},
|
||||||
|
{'D', 0xEA000000U, 10U},
|
||||||
|
{'E', 0x80000000U, 4U},
|
||||||
|
{'F', 0xAE800000U, 12U},
|
||||||
|
{'G', 0xEE800000U, 12U},
|
||||||
|
{'H', 0xAA000000U, 10U},
|
||||||
|
{'I', 0xA0000000U, 6U},
|
||||||
|
{'J', 0xBBB80000U, 16U},
|
||||||
|
{'K', 0xEB800000U, 12U},
|
||||||
|
{'L', 0xBA800000U, 12U},
|
||||||
|
{'M', 0xEE000000U, 10U},
|
||||||
|
{'N', 0xE8000000U, 8U},
|
||||||
|
{'O', 0xEEE00000U, 14U},
|
||||||
|
{'P', 0xBBA00000U, 14U},
|
||||||
|
{'Q', 0xEEB80000U, 16U},
|
||||||
|
{'R', 0xBA000000U, 10U},
|
||||||
|
{'S', 0xA8000000U, 8U},
|
||||||
|
{'T', 0xE0000000U, 6U},
|
||||||
|
{'U', 0xAE000000U, 10U},
|
||||||
|
{'V', 0xAB800000U, 12U},
|
||||||
|
{'W', 0xBB800000U, 12U},
|
||||||
|
{'X', 0xEAE00000U, 14U},
|
||||||
|
{'Y', 0xEBB80000U, 16U},
|
||||||
|
{'Z', 0xEEA00000U, 14U},
|
||||||
|
{'1', 0xBBBB8000U, 20U},
|
||||||
|
{'2', 0xAEEE0000U, 18U},
|
||||||
|
{'3', 0xABB80000U, 16U},
|
||||||
|
{'4', 0xAAE00000U, 14U},
|
||||||
|
{'5', 0xAA800000U, 12U},
|
||||||
|
{'6', 0xEAA00000U, 14U},
|
||||||
|
{'7', 0xEEA80000U, 16U},
|
||||||
|
{'8', 0xEEEA0000U, 18U},
|
||||||
|
{'9', 0xEEEE8000U, 20U},
|
||||||
|
{'0', 0xEEEEE000U, 22U},
|
||||||
|
{'/', 0xEAE80000U, 16U},
|
||||||
|
{'?', 0xAEEA0000U, 18U},
|
||||||
|
{',', 0xEEAEE000U, 22U},
|
||||||
|
{'-', 0xEAAE0000U, 18U},
|
||||||
|
{'=', 0xEAB80000U, 16U},
|
||||||
|
{'.', 0xBAEB8000U, 20U},
|
||||||
|
{' ', 0x00000000U, 4U},
|
||||||
|
{0U, 0x00000000U, 0U}
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
||||||
|
|
||||||
|
#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
|
||||||
|
#define READ_BIT1(p,i) (p[(i)>>3] & BIT_MASK_TABLE[(i)&7])
|
||||||
|
|
||||||
|
CCWIdTX::CCWIdTX() :
|
||||||
|
m_poBuffer(),
|
||||||
|
m_poLen(0U),
|
||||||
|
m_poPtr(0U),
|
||||||
|
m_n(0U)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCWIdTX::process()
|
||||||
|
{
|
||||||
|
if (m_poLen == 0U)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint16_t space = io.getSpace();
|
||||||
|
|
||||||
|
while (space > CYCLE_LENGTH) {
|
||||||
|
bool b = READ_BIT1(m_poBuffer, m_poPtr);
|
||||||
|
if (b)
|
||||||
|
io.write(TONE, CYCLE_LENGTH);
|
||||||
|
else
|
||||||
|
io.write(SILENCE, CYCLE_LENGTH);
|
||||||
|
|
||||||
|
space -= CYCLE_LENGTH;
|
||||||
|
|
||||||
|
m_n++;
|
||||||
|
if (m_n >= DOT_LENGTH) {
|
||||||
|
m_poPtr++;
|
||||||
|
m_n = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_poPtr >= m_poLen) {
|
||||||
|
m_poPtr = 0U;
|
||||||
|
m_poLen = 0U;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CCWIdTX::write(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
::memset(m_poBuffer, 0x00U, 300U * sizeof(uint8_t));
|
||||||
|
|
||||||
|
m_poLen = 8U;
|
||||||
|
m_poPtr = 0U;
|
||||||
|
m_n = 0U;
|
||||||
|
|
||||||
|
for (uint8_t i = 0U; i < length; i++) {
|
||||||
|
for (uint8_t j = 0U; SYMBOL_LIST[j].c != 0U; j++) {
|
||||||
|
if (SYMBOL_LIST[j].c == data[i]) {
|
||||||
|
uint32_t MASK = 0x80000000U;
|
||||||
|
for (uint8_t k = 0U; k < SYMBOL_LIST[j].length; k++, m_poLen++, MASK >>= 1) {
|
||||||
|
bool b = (SYMBOL_LIST[j].pattern & MASK) == MASK;
|
||||||
|
WRITE_BIT1(m_poBuffer, m_poLen, b);
|
||||||
|
|
||||||
|
if (m_poLen >= 295U) {
|
||||||
|
m_poLen = 0U;
|
||||||
|
return 4U;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// An empty message
|
||||||
|
if (m_poLen == 8U) {
|
||||||
|
m_poLen = 0U;
|
||||||
|
return 4U;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_poLen += 5U;
|
||||||
|
|
||||||
|
DEBUG2("Message created with length", m_poLen);
|
||||||
|
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCWIdTX::reset()
|
||||||
|
{
|
||||||
|
m_poLen = 0U;
|
||||||
|
m_poPtr = 0U;
|
||||||
|
m_n = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
44
CWIdTX.h
Normal file
44
CWIdTX.h
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
|
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CWIDTX_H)
|
||||||
|
#define CWIDTX_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
class CCWIdTX {
|
||||||
|
public:
|
||||||
|
CCWIdTX();
|
||||||
|
|
||||||
|
void process();
|
||||||
|
|
||||||
|
uint8_t write(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t m_poBuffer[300U];
|
||||||
|
uint16_t m_poLen;
|
||||||
|
uint16_t m_poPtr;
|
||||||
|
uint8_t m_n;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
152
CalDMR.cpp
Normal file
152
CalDMR.cpp
Normal file
|
|
@ -0,0 +1,152 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
|
* Copyright (C) 2018,2019 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "CalDMR.h"
|
||||||
|
|
||||||
|
// Voice coding data + FEC, 1031 Hz Test Pattern
|
||||||
|
const uint8_t VOICE_1K[] = {0x00U,
|
||||||
|
0xCEU, 0xA8U, 0xFEU, 0x83U, 0xACU, 0xC4U, 0x58U, 0x20U, 0x0AU, 0xCEU, 0xA8U,
|
||||||
|
0xFEU, 0x83U, 0xA0U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x0CU, 0xC4U, 0x58U,
|
||||||
|
0x20U, 0x0AU, 0xCEU, 0xA8U, 0xFEU, 0x83U, 0xACU, 0xC4U, 0x58U, 0x20U, 0x0AU};
|
||||||
|
|
||||||
|
// Voice LC MS Header, CC: 1, srcID: 1, dstID: TG9
|
||||||
|
const uint8_t VH_DMO1K[] = {0x00U,
|
||||||
|
0x00U, 0x20U, 0x08U, 0x08U, 0x02U, 0x38U, 0x15U, 0x00U, 0x2CU, 0xA0U, 0x14U,
|
||||||
|
0x60U, 0x84U, 0x6DU, 0x5DU, 0x7FU, 0x77U, 0xFDU, 0x75U, 0x7EU, 0x30U, 0x30U,
|
||||||
|
0x01U, 0x10U, 0x01U, 0x40U, 0x03U, 0xC0U, 0x13U, 0xC1U, 0x1EU, 0x80U, 0x6FU};
|
||||||
|
|
||||||
|
// Voice Term MS with LC, CC: 1, srcID: 1, dstID: TG9
|
||||||
|
const uint8_t VT_DMO1K[] = {0x00U,
|
||||||
|
0x00U, 0x4FU, 0x08U, 0xDCU, 0x02U, 0x88U, 0x15U, 0x78U, 0x2CU, 0xD0U, 0x14U,
|
||||||
|
0xC0U, 0x84U, 0xADU, 0x5DU, 0x7FU, 0x77U, 0xFDU, 0x75U, 0x79U, 0x65U, 0x24U,
|
||||||
|
0x02U, 0x28U, 0x06U, 0x20U, 0x0FU, 0x80U, 0x1BU, 0xC1U, 0x07U, 0x80U, 0x5CU};
|
||||||
|
|
||||||
|
// Embedded LC MS: CC: 1, srcID: 1, dstID: TG9
|
||||||
|
const uint8_t SYNCEMB_DMO1K[6][7] = {
|
||||||
|
{0x07U, 0xF7U, 0xD5U, 0xDDU, 0x57U, 0xDFU, 0xD0U}, // MS VOICE SYNC (audio seq 0)
|
||||||
|
{0x01U, 0x30U, 0x00U, 0x00U, 0x90U, 0x09U, 0x10U}, // EMB + Embedded LC1 (audio seq 1)
|
||||||
|
{0x01U, 0x70U, 0x00U, 0x90U, 0x00U, 0x07U, 0x40U}, // EMB + Embedded LC2 (audio seq 2)
|
||||||
|
{0x01U, 0x70U, 0x00U, 0x31U, 0x40U, 0x07U, 0x40U}, // EMB + Embedded LC3 (audio seq 3)
|
||||||
|
{0x01U, 0x50U, 0xA1U, 0x71U, 0xD1U, 0x70U, 0x70U}, // EMB + Embedded LC4 (audio seq 4)
|
||||||
|
{0x01U, 0x10U, 0x00U, 0x00U, 0x00U, 0x0EU, 0x20U}}; // EMB (audio seq 5)
|
||||||
|
|
||||||
|
CCalDMR::CCalDMR() :
|
||||||
|
m_transmit(false),
|
||||||
|
m_state(DMRCAL1K_IDLE),
|
||||||
|
m_dmr1k(),
|
||||||
|
m_audioSeq(0),
|
||||||
|
m_count(0)
|
||||||
|
{
|
||||||
|
::memcpy(m_dmr1k, VOICE_1K, DMR_FRAME_LENGTH_BYTES + 1U);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCalDMR::process()
|
||||||
|
{
|
||||||
|
switch (m_calState) {
|
||||||
|
case STATE_DMRCAL:
|
||||||
|
if (m_transmit) {
|
||||||
|
dmrDMOTX.setCal(true);
|
||||||
|
dmrDMOTX.process();
|
||||||
|
} else {
|
||||||
|
dmrDMOTX.setCal(false);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case STATE_DMRDMO1K:
|
||||||
|
dmrdmo1k();
|
||||||
|
break;
|
||||||
|
case STATE_INTCAL:
|
||||||
|
// Simple interrupt counter for board diagnostics (TCXO, connections, etc)
|
||||||
|
// Not intended for precise interrupt frequency measurements
|
||||||
|
m_count++;
|
||||||
|
if (m_count >= CAL_DLY_LOOP) {
|
||||||
|
m_count = 0U;
|
||||||
|
uint16_t int1, int2;
|
||||||
|
io.getIntCounter(int1, int2);
|
||||||
|
DEBUG3("Counter INT1/INT2:", int1 >> 1U, int2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCalDMR::createDataDMO1k(uint8_t n)
|
||||||
|
{
|
||||||
|
for(uint8_t i = 0; i < 5U; i++)
|
||||||
|
m_dmr1k[i + 15U] = SYNCEMB_DMO1K[n][i + 1U];
|
||||||
|
|
||||||
|
m_dmr1k[14U] &= 0xF0U;
|
||||||
|
m_dmr1k[20U] &= 0x0FU;
|
||||||
|
m_dmr1k[14U] |= SYNCEMB_DMO1K[n][0] & 0x0FU;
|
||||||
|
m_dmr1k[20U] |= SYNCEMB_DMO1K[n][6] & 0xF0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCalDMR::dmrdmo1k()
|
||||||
|
{
|
||||||
|
dmrDMOTX.process();
|
||||||
|
|
||||||
|
uint16_t space = dmrDMOTX.getSpace();
|
||||||
|
if (space < 1U)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (m_state) {
|
||||||
|
case DMRCAL1K_VH:
|
||||||
|
dmrDMOTX.writeData(VH_DMO1K, DMR_FRAME_LENGTH_BYTES + 1U);
|
||||||
|
m_state = DMRCAL1K_VOICE;
|
||||||
|
break;
|
||||||
|
case DMRCAL1K_VOICE:
|
||||||
|
createDataDMO1k(m_audioSeq);
|
||||||
|
dmrDMOTX.writeData(m_dmr1k, DMR_FRAME_LENGTH_BYTES + 1U);
|
||||||
|
if(m_audioSeq == 5U) {
|
||||||
|
m_audioSeq = 0U;
|
||||||
|
if(!m_transmit)
|
||||||
|
m_state = DMRCAL1K_VT;
|
||||||
|
} else
|
||||||
|
m_audioSeq++;
|
||||||
|
break;
|
||||||
|
case DMRCAL1K_VT:
|
||||||
|
dmrDMOTX.writeData(VT_DMO1K, DMR_FRAME_LENGTH_BYTES + 1U);
|
||||||
|
m_state = DMRCAL1K_IDLE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_state = DMRCAL1K_IDLE;
|
||||||
|
m_audioSeq = 0U;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CCalDMR::write(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (length != 1U)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
m_transmit = data[0U] == 1U;
|
||||||
|
|
||||||
|
if (m_transmit && m_state == DMRCAL1K_IDLE && m_calState == STATE_DMRDMO1K)
|
||||||
|
m_state = DMRCAL1K_VH;
|
||||||
|
|
||||||
|
if (m_transmit)
|
||||||
|
io.ifConf(STATE_DMR, true);
|
||||||
|
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
|
||||||
54
CalDMR.h
Normal file
54
CalDMR.h
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
|
* Copyright (C) 2018 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CALDMR_H)
|
||||||
|
#define CALDMR_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "DMRDefines.h"
|
||||||
|
|
||||||
|
enum DMRCAL1K {
|
||||||
|
DMRCAL1K_IDLE,
|
||||||
|
DMRCAL1K_VH,
|
||||||
|
DMRCAL1K_VOICE,
|
||||||
|
DMRCAL1K_VT,
|
||||||
|
DMRCAL1K_WAIT
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCalDMR {
|
||||||
|
public:
|
||||||
|
CCalDMR();
|
||||||
|
|
||||||
|
void process();
|
||||||
|
void dmrdmo1k();
|
||||||
|
void createDataDMO1k(uint8_t n);
|
||||||
|
|
||||||
|
uint8_t write(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_transmit;
|
||||||
|
DMRCAL1K m_state;
|
||||||
|
uint8_t m_dmr1k[DMR_FRAME_LENGTH_BYTES + 1U];
|
||||||
|
uint8_t m_audioSeq;
|
||||||
|
uint32_t m_count;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
74
CalRSSI.cpp
Normal file
74
CalRSSI.cpp
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2018 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "CalRSSI.h"
|
||||||
|
|
||||||
|
CCalRSSI::CCalRSSI() :
|
||||||
|
m_count(0U),
|
||||||
|
m_navg(0U),
|
||||||
|
m_accum(0U),
|
||||||
|
m_min(0xFFFFU),
|
||||||
|
m_max(0x0000U)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCalRSSI::process()
|
||||||
|
{
|
||||||
|
m_count++;
|
||||||
|
|
||||||
|
if (m_count >= 32000U) {
|
||||||
|
uint16_t rssi = io.readRSSI();
|
||||||
|
m_count = 0U;
|
||||||
|
m_navg++;
|
||||||
|
|
||||||
|
m_accum += rssi;
|
||||||
|
|
||||||
|
if (rssi > m_max)
|
||||||
|
m_max = rssi;
|
||||||
|
if (rssi < m_min)
|
||||||
|
m_min = rssi;
|
||||||
|
|
||||||
|
if (m_navg >= 6U) {
|
||||||
|
uint16_t ave = m_accum / 6U;
|
||||||
|
|
||||||
|
uint8_t buffer[6U];
|
||||||
|
buffer[0U] = (m_max >> 8) & 0xFFU;
|
||||||
|
buffer[1U] = (m_max >> 0) & 0xFFU;
|
||||||
|
buffer[2U] = (m_min >> 8) & 0xFFU;
|
||||||
|
buffer[3U] = (m_min >> 0) & 0xFFU;
|
||||||
|
buffer[4U] = (ave >> 8) & 0xFFU;
|
||||||
|
buffer[5U] = (ave >> 0) & 0xFFU;
|
||||||
|
|
||||||
|
serial.writeRSSIData(buffer, 6U);
|
||||||
|
|
||||||
|
m_navg = 0U;
|
||||||
|
m_accum = 0U;
|
||||||
|
m_min = 0xFFFFU;
|
||||||
|
m_max = 0x0000U;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
44
CalRSSI.h
Normal file
44
CalRSSI.h
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2018 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CALRSSI_H)
|
||||||
|
#define CALRSSI_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
|
||||||
|
class CCalRSSI {
|
||||||
|
public:
|
||||||
|
CCalRSSI();
|
||||||
|
|
||||||
|
void process();
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32_t m_count;
|
||||||
|
uint8_t m_navg;
|
||||||
|
uint32_t m_accum;
|
||||||
|
uint16_t m_min;
|
||||||
|
uint16_t m_max;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
71
Config.h
71
Config.h
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -20,17 +20,29 @@
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
// Select one board (STM32F103 based boards)
|
// Select one board (STM32F103 based boards)
|
||||||
// 1) ZUMspot USB and ZUMspot RPi:
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
// #define PI_HAT_7021_REV_03
|
// #define ZUMSPOT_ADF7021
|
||||||
// 2) ZUMspot Libre Kit or board with modified RF7021SE and Blue Pill STM32F103:
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
#define ADF7021_CARRIER_BOARD
|
#define LIBRE_KIT_ADF7021
|
||||||
// 3) MMDVM_HS_Hat revisions 1.1 and 1.2 (DB9MAT & DF2ET)
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
// #define MMDVM_HS_HAT_REV12
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
// 9) LoneStar USB Stick ADF7071
|
||||||
|
// #define LONESTAR_USB
|
||||||
|
|
||||||
// Enable ADF7021 support:
|
// Enable ADF7021 support:
|
||||||
#define ENABLE_ADF7021
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
// Enable full duplex support with dual ADF7021:
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
// #define DUPLEX
|
// #define DUPLEX
|
||||||
|
|
||||||
// TCXO of the ADF7021
|
// TCXO of the ADF7021
|
||||||
|
|
@ -39,9 +51,23 @@
|
||||||
// For 12.2880 MHz:
|
// For 12.2880 MHz:
|
||||||
// #define ADF7021_12_2880
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
// Host communication selection:
|
// Host communication selection:
|
||||||
// #define STM32_USART1_HOST
|
// #define STM32_USART1_HOST
|
||||||
#define STM32_USB_HOST
|
#define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
// Enable mode detection:
|
// Enable mode detection:
|
||||||
#define ENABLE_SCAN_MODE
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
@ -51,6 +77,7 @@
|
||||||
|
|
||||||
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
#define SERIAL_REPEATER
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
// #define SERIAL_REPEATER_USART1
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
@ -61,4 +88,34 @@
|
||||||
// Disable mode LEDs blink during scan mode:
|
// Disable mode LEDs blink during scan mode:
|
||||||
// #define QUIET_MODE_LEDS
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
#define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
// #define ENABLE_UDID
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
88
DMRDMORX.cpp
88
DMRDMORX.cpp
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -33,8 +33,14 @@ const uint8_t CONTROL_NONE = 0x00U;
|
||||||
const uint8_t CONTROL_VOICE = 0x20U;
|
const uint8_t CONTROL_VOICE = 0x20U;
|
||||||
const uint8_t CONTROL_DATA = 0x40U;
|
const uint8_t CONTROL_DATA = 0x40U;
|
||||||
|
|
||||||
|
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
||||||
|
|
||||||
|
#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
|
||||||
|
#define READ_BIT1(p,i) ((p[(i)>>3] & BIT_MASK_TABLE[(i)&7]) >> (7 - ((i)&7)))
|
||||||
|
|
||||||
CDMRDMORX::CDMRDMORX() :
|
CDMRDMORX::CDMRDMORX() :
|
||||||
m_patternBuffer(0x00U),
|
m_patternBuffer(0x00U),
|
||||||
|
m_buffer(),
|
||||||
m_dataPtr(0U),
|
m_dataPtr(0U),
|
||||||
m_syncPtr(0U),
|
m_syncPtr(0U),
|
||||||
m_startPtr(0U),
|
m_startPtr(0U),
|
||||||
|
|
@ -59,9 +65,9 @@ void CDMRDMORX::reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDMRDMORX::databit(bool bit)
|
void CDMRDMORX::databit(bool bit)
|
||||||
{
|
{
|
||||||
m_buffer[m_dataPtr] = bit;
|
WRITE_BIT1(m_buffer, m_dataPtr, bit);
|
||||||
|
|
||||||
m_patternBuffer <<= 1;
|
m_patternBuffer <<= 1;
|
||||||
if (bit)
|
if (bit)
|
||||||
m_patternBuffer |= 0x01U;
|
m_patternBuffer |= 0x01U;
|
||||||
|
|
@ -86,7 +92,7 @@ void CDMRDMORX::databit(bool bit)
|
||||||
correlateSync();
|
correlateSync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dataPtr == m_endPtr) {
|
if (m_dataPtr == m_endPtr) {
|
||||||
frame[0U] = m_control;
|
frame[0U] = m_control;
|
||||||
|
|
||||||
|
|
@ -183,7 +189,7 @@ void CDMRDMORX::databit(bool bit)
|
||||||
// End of this slot, reset some items for the next slot.
|
// End of this slot, reset some items for the next slot.
|
||||||
m_control = CONTROL_NONE;
|
m_control = CONTROL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dataPtr++;
|
m_dataPtr++;
|
||||||
|
|
||||||
if (m_dataPtr >= DMO_BUFFER_LENGTH_BITS)
|
if (m_dataPtr >= DMO_BUFFER_LENGTH_BITS)
|
||||||
|
|
@ -193,41 +199,37 @@ void CDMRDMORX::databit(bool bit)
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDMRDMORX::correlateSync()
|
void CDMRDMORX::correlateSync()
|
||||||
{
|
{
|
||||||
if ( (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_DATA_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) || \
|
if ( (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_DATA_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) || \
|
||||||
(countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_S2_DATA_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) ) {
|
(countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_S2_DATA_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) ) {
|
||||||
|
m_control = CONTROL_DATA;
|
||||||
|
m_syncPtr = m_dataPtr;
|
||||||
|
|
||||||
m_control = CONTROL_DATA;
|
m_startPtr = m_dataPtr + DMO_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1;
|
||||||
m_syncPtr = m_dataPtr;
|
if (m_startPtr >= DMO_BUFFER_LENGTH_BITS)
|
||||||
|
m_startPtr -= DMO_BUFFER_LENGTH_BITS;
|
||||||
|
|
||||||
m_startPtr = m_dataPtr + DMO_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1;
|
m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U;
|
||||||
if (m_startPtr >= DMO_BUFFER_LENGTH_BITS)
|
if (m_endPtr >= DMO_BUFFER_LENGTH_BITS)
|
||||||
m_startPtr -= DMO_BUFFER_LENGTH_BITS;
|
m_endPtr -= DMO_BUFFER_LENGTH_BITS;
|
||||||
|
|
||||||
m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U;
|
m_modeTimerCnt = 0;
|
||||||
if (m_endPtr >= DMO_BUFFER_LENGTH_BITS)
|
//DEBUG4("SYNC MS Data found pos/start/end:", m_dataPtr, m_startPtr, m_endPtr);
|
||||||
m_endPtr -= DMO_BUFFER_LENGTH_BITS;
|
|
||||||
|
|
||||||
m_modeTimerCnt = 0;
|
|
||||||
|
|
||||||
//DEBUG4("SYNC MS Data found pos/start/end:", m_dataPtr, m_startPtr, m_endPtr);
|
|
||||||
} else if ( (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_VOICE_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) || \
|
} else if ( (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_VOICE_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) || \
|
||||||
(countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_S2_VOICE_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) ) {
|
(countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_S2_VOICE_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) ) {
|
||||||
|
m_control = CONTROL_VOICE;
|
||||||
|
m_syncPtr = m_dataPtr;
|
||||||
|
|
||||||
m_control = CONTROL_VOICE;
|
m_startPtr = m_dataPtr + DMO_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1;
|
||||||
m_syncPtr = m_dataPtr;
|
if (m_startPtr >= DMO_BUFFER_LENGTH_BITS)
|
||||||
|
m_startPtr -= DMO_BUFFER_LENGTH_BITS;
|
||||||
|
|
||||||
m_startPtr = m_dataPtr + DMO_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1;
|
m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U;
|
||||||
if (m_startPtr >= DMO_BUFFER_LENGTH_BITS)
|
if (m_endPtr >= DMO_BUFFER_LENGTH_BITS)
|
||||||
m_startPtr -= DMO_BUFFER_LENGTH_BITS;
|
m_endPtr -= DMO_BUFFER_LENGTH_BITS;
|
||||||
|
|
||||||
m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U;
|
m_modeTimerCnt = 0;
|
||||||
if (m_endPtr >= DMO_BUFFER_LENGTH_BITS)
|
//DEBUG4("SYNC MS Voice found pos/start/end: ", m_dataPtr, m_startPtr, m_endPtr);
|
||||||
m_endPtr -= DMO_BUFFER_LENGTH_BITS;
|
|
||||||
|
|
||||||
m_modeTimerCnt = 0;
|
|
||||||
|
|
||||||
//DEBUG4("SYNC MS Voice found pos/start/end: ", m_dataPtr, m_startPtr, m_endPtr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -236,28 +238,36 @@ void CDMRDMORX::bitsToBytes(uint16_t start, uint8_t count, uint8_t* buffer)
|
||||||
for (uint8_t i = 0U; i < count; i++) {
|
for (uint8_t i = 0U; i < count; i++) {
|
||||||
|
|
||||||
buffer[i] = 0U;
|
buffer[i] = 0U;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 7);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 7;
|
||||||
|
start++;
|
||||||
if (start >= DMO_BUFFER_LENGTH_BITS)
|
if (start >= DMO_BUFFER_LENGTH_BITS)
|
||||||
start -= DMO_BUFFER_LENGTH_BITS;
|
start -= DMO_BUFFER_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 6);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 6;
|
||||||
|
start++;
|
||||||
if (start >= DMO_BUFFER_LENGTH_BITS)
|
if (start >= DMO_BUFFER_LENGTH_BITS)
|
||||||
start -= DMO_BUFFER_LENGTH_BITS;
|
start -= DMO_BUFFER_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 5);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 5;
|
||||||
|
start++;
|
||||||
if (start >= DMO_BUFFER_LENGTH_BITS)
|
if (start >= DMO_BUFFER_LENGTH_BITS)
|
||||||
start -= DMO_BUFFER_LENGTH_BITS;
|
start -= DMO_BUFFER_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 4);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 4;
|
||||||
|
start++;
|
||||||
if (start >= DMO_BUFFER_LENGTH_BITS)
|
if (start >= DMO_BUFFER_LENGTH_BITS)
|
||||||
start -= DMO_BUFFER_LENGTH_BITS;
|
start -= DMO_BUFFER_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 3);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 3;
|
||||||
|
start++;
|
||||||
if (start >= DMO_BUFFER_LENGTH_BITS)
|
if (start >= DMO_BUFFER_LENGTH_BITS)
|
||||||
start -= DMO_BUFFER_LENGTH_BITS;
|
start -= DMO_BUFFER_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 2);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 2;
|
||||||
|
start++;
|
||||||
if (start >= DMO_BUFFER_LENGTH_BITS)
|
if (start >= DMO_BUFFER_LENGTH_BITS)
|
||||||
start -= DMO_BUFFER_LENGTH_BITS;
|
start -= DMO_BUFFER_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 1);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 1;
|
||||||
|
start++;
|
||||||
if (start >= DMO_BUFFER_LENGTH_BITS)
|
if (start >= DMO_BUFFER_LENGTH_BITS)
|
||||||
start -= DMO_BUFFER_LENGTH_BITS;
|
start -= DMO_BUFFER_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 0);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 0;
|
||||||
|
start++;
|
||||||
if (start >= DMO_BUFFER_LENGTH_BITS)
|
if (start >= DMO_BUFFER_LENGTH_BITS)
|
||||||
start -= DMO_BUFFER_LENGTH_BITS;
|
start -= DMO_BUFFER_LENGTH_BITS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -41,7 +41,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint64_t m_patternBuffer;
|
uint64_t m_patternBuffer;
|
||||||
uint8_t m_buffer[DMO_BUFFER_LENGTH_BITS];
|
uint8_t m_buffer[DMO_BUFFER_LENGTH_BITS / 8U]; // 72 bytes
|
||||||
uint8_t frame[DMR_FRAME_LENGTH_BYTES + 3U];
|
uint8_t frame[DMR_FRAME_LENGTH_BYTES + 3U];
|
||||||
uint16_t m_dataPtr;
|
uint16_t m_dataPtr;
|
||||||
uint16_t m_syncPtr;
|
uint16_t m_syncPtr;
|
||||||
|
|
|
||||||
69
DMRDMOTX.cpp
69
DMRDMOTX.cpp
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -21,6 +21,13 @@
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
|
// PR FILL pattern
|
||||||
|
const uint8_t PR_FILL[] =
|
||||||
|
{0x63U, 0xEAU, 0x00U, 0x76U, 0x6CU, 0x76U, 0xC4U, 0x52U, 0xC8U, 0x78U,
|
||||||
|
0x09U, 0x2DU, 0xB8U, 0x79U, 0x27U, 0x57U, 0x9BU, 0x31U, 0xBCU, 0x3EU,
|
||||||
|
0xEAU, 0x45U, 0xC3U, 0x30U, 0x49U, 0x17U, 0x93U, 0xAEU, 0x8BU, 0x6DU,
|
||||||
|
0xA4U, 0xA5U, 0xADU, 0xA2U, 0xF1U, 0x35U, 0xB5U, 0x3CU, 0x1EU};
|
||||||
|
|
||||||
const uint8_t DMR_SYNC = 0x5FU;
|
const uint8_t DMR_SYNC = 0x5FU;
|
||||||
|
|
||||||
CDMRDMOTX::CDMRDMOTX() :
|
CDMRDMOTX::CDMRDMOTX() :
|
||||||
|
|
@ -29,27 +36,37 @@ m_poBuffer(),
|
||||||
m_poLen(0U),
|
m_poLen(0U),
|
||||||
m_poPtr(0U),
|
m_poPtr(0U),
|
||||||
m_txDelay(240U), // 200ms
|
m_txDelay(240U), // 200ms
|
||||||
m_count(0U)
|
m_delay(false),
|
||||||
|
m_cal(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDMRDMOTX::process()
|
void CDMRDMOTX::process()
|
||||||
{
|
{
|
||||||
if (m_poLen == 0U && m_fifo.getData() > 0U) {
|
if (m_cal) {
|
||||||
if (!m_tx) {
|
if (m_poLen == 0U) {
|
||||||
m_delay = true;
|
|
||||||
m_poLen = m_txDelay;
|
|
||||||
} else {
|
|
||||||
m_delay = false;
|
m_delay = false;
|
||||||
|
createCal();
|
||||||
for (unsigned int i = 0U; i < 72U; i++)
|
|
||||||
m_poBuffer[m_poLen++] = DMR_SYNC;
|
|
||||||
|
|
||||||
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++)
|
|
||||||
m_poBuffer[i] = m_fifo.get();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (m_poLen == 0U && m_fifo.getData() > 0U) {
|
||||||
|
if (!m_tx) {
|
||||||
|
m_delay = true;
|
||||||
|
m_poLen = m_txDelay;
|
||||||
|
} else {
|
||||||
|
m_delay = false;
|
||||||
|
|
||||||
m_poPtr = 0U;
|
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++)
|
||||||
|
m_poBuffer[i] = m_fifo.get();
|
||||||
|
|
||||||
|
for (unsigned int i = 0U; i < 39U; i++)
|
||||||
|
m_poBuffer[i + DMR_FRAME_LENGTH_BYTES] = PR_FILL[i];
|
||||||
|
|
||||||
|
m_poLen = 72U;
|
||||||
|
}
|
||||||
|
m_poPtr = 0U;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_poLen > 0U) {
|
if (m_poLen > 0U) {
|
||||||
|
|
@ -60,10 +77,10 @@ void CDMRDMOTX::process()
|
||||||
m_poPtr++;
|
m_poPtr++;
|
||||||
writeByte(DMR_SYNC);
|
writeByte(DMR_SYNC);
|
||||||
} else
|
} else
|
||||||
writeByte(m_poBuffer[m_poPtr++]);
|
writeByte(m_poBuffer[m_poPtr++]);
|
||||||
|
|
||||||
space -= 8U;
|
space -= 8U;
|
||||||
|
|
||||||
if (m_poPtr >= m_poLen) {
|
if (m_poPtr >= m_poLen) {
|
||||||
m_poPtr = 0U;
|
m_poPtr = 0U;
|
||||||
m_poLen = 0U;
|
m_poLen = 0U;
|
||||||
|
|
@ -72,7 +89,6 @@ void CDMRDMOTX::process()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t CDMRDMOTX::writeData(const uint8_t* data, uint8_t length)
|
uint8_t CDMRDMOTX::writeData(const uint8_t* data, uint8_t length)
|
||||||
|
|
@ -105,6 +121,25 @@ void CDMRDMOTX::writeByte(uint8_t c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDMRDMOTX::setCal(bool start)
|
||||||
|
{
|
||||||
|
m_cal = start ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDMRDMOTX::createCal()
|
||||||
|
{
|
||||||
|
// 1.2 kHz sine wave generation
|
||||||
|
if (m_calState == STATE_DMRCAL) {
|
||||||
|
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) {
|
||||||
|
m_poBuffer[i] = 0x5FU; // +3, +3, -3, -3 pattern for deviation cal.
|
||||||
|
}
|
||||||
|
|
||||||
|
m_poLen = DMR_FRAME_LENGTH_BYTES;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_poPtr = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t CDMRDMOTX::getSpace() const
|
uint16_t CDMRDMOTX::getSpace() const
|
||||||
{
|
{
|
||||||
return m_fifo.getSpace() / (DMR_FRAME_LENGTH_BYTES + 2U);
|
return m_fifo.getSpace() / (DMR_FRAME_LENGTH_BYTES + 2U);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -33,6 +33,8 @@ public:
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
|
|
||||||
|
void setCal(bool start);
|
||||||
|
|
||||||
void setTXDelay(uint8_t delay);
|
void setTXDelay(uint8_t delay);
|
||||||
|
|
||||||
uint16_t getSpace() const;
|
uint16_t getSpace() const;
|
||||||
|
|
@ -43,10 +45,12 @@ private:
|
||||||
uint16_t m_poLen;
|
uint16_t m_poLen;
|
||||||
uint16_t m_poPtr;
|
uint16_t m_poPtr;
|
||||||
uint16_t m_txDelay;
|
uint16_t m_txDelay;
|
||||||
uint32_t m_count;
|
|
||||||
bool m_delay;
|
bool m_delay;
|
||||||
|
bool m_cal;
|
||||||
|
|
||||||
void writeByte(uint8_t c);
|
void writeByte(uint8_t c);
|
||||||
|
void createCal();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2017 by Jonathan Naylor G4KLX
|
* Copyright (C) 2009-2017 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2017,2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -26,15 +26,20 @@
|
||||||
#include "DMRSlotType.h"
|
#include "DMRSlotType.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
const uint8_t MAX_SYNC_SYMBOLS_ERRS = 2U;
|
const uint8_t MAX_SYNC_BYTES_ERRS = 2U;
|
||||||
const uint8_t MAX_SYNC_BYTES_ERRS = 3U;
|
|
||||||
|
|
||||||
const uint16_t NOENDPTR = 9999U;
|
const uint16_t NOENDPTR = 9999U;
|
||||||
|
|
||||||
const uint8_t CONTROL_IDLE = 0x80U;
|
const uint8_t CONTROL_IDLE = 0x80U;
|
||||||
const uint8_t CONTROL_DATA = 0x40U;
|
const uint8_t CONTROL_DATA = 0x40U;
|
||||||
|
|
||||||
|
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
||||||
|
|
||||||
|
#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
|
||||||
|
#define READ_BIT1(p,i) ((p[(i)>>3] & BIT_MASK_TABLE[(i)&7]) >> (7 - ((i)&7)))
|
||||||
|
|
||||||
CDMRIdleRX::CDMRIdleRX() :
|
CDMRIdleRX::CDMRIdleRX() :
|
||||||
|
m_patternBuffer(0U),
|
||||||
m_buffer(),
|
m_buffer(),
|
||||||
m_dataPtr(0U),
|
m_dataPtr(0U),
|
||||||
m_endPtr(NOENDPTR),
|
m_endPtr(NOENDPTR),
|
||||||
|
|
@ -50,25 +55,23 @@ void CDMRIdleRX::reset()
|
||||||
|
|
||||||
void CDMRIdleRX::databit(bool bit)
|
void CDMRIdleRX::databit(bool bit)
|
||||||
{
|
{
|
||||||
m_buffer[m_dataPtr] = bit;
|
WRITE_BIT1(m_buffer, m_dataPtr, bit);
|
||||||
|
|
||||||
m_patternBuffer <<= 1;
|
m_patternBuffer <<= 1;
|
||||||
if (bit)
|
if (bit)
|
||||||
m_patternBuffer |= 0x01U;
|
m_patternBuffer |= 0x01U;
|
||||||
|
|
||||||
if (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_DATA_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) {
|
if (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_DATA_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) {
|
||||||
m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U;
|
m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U;
|
||||||
if (m_endPtr >= DMR_FRAME_LENGTH_BITS)
|
if (m_endPtr >= DMR_IDLE_LENGTH_BITS)
|
||||||
m_endPtr -= DMR_FRAME_LENGTH_BITS;
|
m_endPtr -= DMR_IDLE_LENGTH_BITS;
|
||||||
|
// DEBUG3("SYNC MS Data found pos/end:", m_dataPtr, m_endPtr);
|
||||||
DEBUG3("SYNC MS Data found pos/end:", m_dataPtr, m_endPtr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dataPtr == m_endPtr) {
|
if (m_dataPtr == m_endPtr) {
|
||||||
uint16_t ptr = m_endPtr + 1;
|
uint16_t ptr = m_endPtr + DMR_IDLE_LENGTH_BITS - DMR_FRAME_LENGTH_BITS + 1;
|
||||||
|
if (ptr >= DMR_IDLE_LENGTH_BITS)
|
||||||
if (ptr >= DMR_FRAME_LENGTH_BITS)
|
ptr -= DMR_IDLE_LENGTH_BITS;
|
||||||
ptr -= DMR_FRAME_LENGTH_BITS;
|
|
||||||
|
|
||||||
uint8_t frame[DMR_FRAME_LENGTH_BYTES + 1U];
|
uint8_t frame[DMR_FRAME_LENGTH_BYTES + 1U];
|
||||||
bitsToBytes(ptr, DMR_FRAME_LENGTH_BYTES, frame + 1U);
|
bitsToBytes(ptr, DMR_FRAME_LENGTH_BYTES, frame + 1U);
|
||||||
|
|
@ -77,7 +80,7 @@ void CDMRIdleRX::databit(bool bit)
|
||||||
uint8_t dataType;
|
uint8_t dataType;
|
||||||
CDMRSlotType slotType;
|
CDMRSlotType slotType;
|
||||||
slotType.decode(frame + 1U, colorCode, dataType);
|
slotType.decode(frame + 1U, colorCode, dataType);
|
||||||
|
|
||||||
if (colorCode == m_colorCode && dataType == DT_CSBK) {
|
if (colorCode == m_colorCode && dataType == DT_CSBK) {
|
||||||
frame[0U] = CONTROL_IDLE | CONTROL_DATA | DT_CSBK;
|
frame[0U] = CONTROL_IDLE | CONTROL_DATA | DT_CSBK;
|
||||||
serial.writeDMRData(false, frame, DMR_FRAME_LENGTH_BYTES + 1U);
|
serial.writeDMRData(false, frame, DMR_FRAME_LENGTH_BYTES + 1U);
|
||||||
|
|
@ -87,7 +90,7 @@ void CDMRIdleRX::databit(bool bit)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dataPtr++;
|
m_dataPtr++;
|
||||||
if (m_dataPtr >= DMR_FRAME_LENGTH_BITS)
|
if (m_dataPtr >= DMR_IDLE_LENGTH_BITS)
|
||||||
m_dataPtr = 0U;
|
m_dataPtr = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,30 +98,38 @@ void CDMRIdleRX::bitsToBytes(uint16_t start, uint8_t count, uint8_t* buffer)
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0U; i < count; i++) {
|
for (uint8_t i = 0U; i < count; i++) {
|
||||||
buffer[i] = 0U;
|
buffer[i] = 0U;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 7);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 7;
|
||||||
if (start >= DMR_FRAME_LENGTH_BITS)
|
start++;
|
||||||
start -= DMR_FRAME_LENGTH_BITS;
|
if (start >= DMR_IDLE_LENGTH_BITS)
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 6);
|
start -= DMR_IDLE_LENGTH_BITS;
|
||||||
if (start >= DMR_FRAME_LENGTH_BITS)
|
buffer[i] |= READ_BIT1(m_buffer, start) << 6;
|
||||||
start -= DMR_FRAME_LENGTH_BITS;
|
start++;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 5);
|
if (start >= DMR_IDLE_LENGTH_BITS)
|
||||||
if (start >= DMR_FRAME_LENGTH_BITS)
|
start -= DMR_IDLE_LENGTH_BITS;
|
||||||
start -= DMR_FRAME_LENGTH_BITS;
|
buffer[i] |= READ_BIT1(m_buffer, start) << 5;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 4);
|
start++;
|
||||||
if (start >= DMR_FRAME_LENGTH_BITS)
|
if (start >= DMR_IDLE_LENGTH_BITS)
|
||||||
start -= DMR_FRAME_LENGTH_BITS;
|
start -= DMR_IDLE_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 3);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 4;
|
||||||
if (start >= DMR_FRAME_LENGTH_BITS)
|
start++;
|
||||||
start -= DMR_FRAME_LENGTH_BITS;
|
if (start >= DMR_IDLE_LENGTH_BITS)
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 2);
|
start -= DMR_IDLE_LENGTH_BITS;
|
||||||
if (start >= DMR_FRAME_LENGTH_BITS)
|
buffer[i] |= READ_BIT1(m_buffer, start) << 3;
|
||||||
start -= DMR_FRAME_LENGTH_BITS;
|
start++;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 1);
|
if (start >= DMR_IDLE_LENGTH_BITS)
|
||||||
if (start >= DMR_FRAME_LENGTH_BITS)
|
start -= DMR_IDLE_LENGTH_BITS;
|
||||||
start -= DMR_FRAME_LENGTH_BITS;
|
buffer[i] |= READ_BIT1(m_buffer, start) << 2;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 0);
|
start++;
|
||||||
if (start >= DMR_FRAME_LENGTH_BITS)
|
if (start >= DMR_IDLE_LENGTH_BITS)
|
||||||
start -= DMR_FRAME_LENGTH_BITS;
|
start -= DMR_IDLE_LENGTH_BITS;
|
||||||
|
buffer[i] |= READ_BIT1(m_buffer, start) << 1;
|
||||||
|
start++;
|
||||||
|
if (start >= DMR_IDLE_LENGTH_BITS)
|
||||||
|
start -= DMR_IDLE_LENGTH_BITS;
|
||||||
|
buffer[i] |= READ_BIT1(m_buffer, start) << 0;
|
||||||
|
start++;
|
||||||
|
if (start >= DMR_IDLE_LENGTH_BITS)
|
||||||
|
start -= DMR_IDLE_LENGTH_BITS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2017,2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
#include "DMRDefines.h"
|
#include "DMRDefines.h"
|
||||||
|
|
||||||
|
const uint16_t DMR_IDLE_LENGTH_BITS = 320U;
|
||||||
|
|
||||||
class CDMRIdleRX {
|
class CDMRIdleRX {
|
||||||
public:
|
public:
|
||||||
CDMRIdleRX();
|
CDMRIdleRX();
|
||||||
|
|
@ -38,7 +40,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint64_t m_patternBuffer;
|
uint64_t m_patternBuffer;
|
||||||
uint8_t m_buffer[DMR_FRAME_LENGTH_BITS];
|
uint8_t m_buffer[DMR_IDLE_LENGTH_BITS / 8U];
|
||||||
uint16_t m_dataPtr;
|
uint16_t m_dataPtr;
|
||||||
uint16_t m_endPtr;
|
uint16_t m_endPtr;
|
||||||
uint8_t m_colorCode;
|
uint8_t m_colorCode;
|
||||||
|
|
|
||||||
18
DMRRX.cpp
18
DMRRX.cpp
|
|
@ -24,23 +24,21 @@
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "DMRRX.h"
|
#include "DMRRX.h"
|
||||||
|
|
||||||
CDMRRX::CDMRRX()
|
CDMRRX::CDMRRX() :
|
||||||
|
m_control_old(0U)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDMRRX::databit(bool bit, const uint8_t control)
|
void CDMRRX::databit(bool bit, const uint8_t control)
|
||||||
{
|
{
|
||||||
switch (control) {
|
if (control != m_control_old) {
|
||||||
case MARK_SLOT1:
|
m_control_old = control;
|
||||||
m_slotRX.start(false);
|
if (control)
|
||||||
break;
|
|
||||||
case MARK_SLOT2:
|
|
||||||
m_slotRX.start(true);
|
m_slotRX.start(true);
|
||||||
break;
|
else
|
||||||
default:
|
m_slotRX.start(false);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
io.setDecode(m_slotRX.databit(bit));
|
io.setDecode(m_slotRX.databit(bit));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
1
DMRRX.h
1
DMRRX.h
|
|
@ -39,6 +39,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CDMRSlotRX m_slotRX;
|
CDMRSlotRX m_slotRX;
|
||||||
|
uint8_t m_control_old;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
518
DMRSlotRX.cpp
518
DMRSlotRX.cpp
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2017 by Jonathan Naylor G4KLX
|
* Copyright (C) 2009-2017 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2017,2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -36,22 +36,35 @@ const uint8_t CONTROL_NONE = 0x00U;
|
||||||
const uint8_t CONTROL_VOICE = 0x20U;
|
const uint8_t CONTROL_VOICE = 0x20U;
|
||||||
const uint8_t CONTROL_DATA = 0x40U;
|
const uint8_t CONTROL_DATA = 0x40U;
|
||||||
|
|
||||||
|
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
||||||
|
|
||||||
|
#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
|
||||||
|
#define READ_BIT1(p,i) ((p[(i)>>3] & BIT_MASK_TABLE[(i)&7]) >> (7 - ((i)&7)))
|
||||||
|
|
||||||
CDMRSlotRX::CDMRSlotRX() :
|
CDMRSlotRX::CDMRSlotRX() :
|
||||||
m_slot(false),
|
m_slot(false),
|
||||||
m_patternBuffer(0x00U),
|
m_patternBuffer(0x00U),
|
||||||
m_buffer(),
|
m_buffer(),
|
||||||
m_dataPtr(0U),
|
m_dataPtr(0U),
|
||||||
m_syncPtr(0U),
|
m_syncPtr1(0U),
|
||||||
m_startPtr(0U),
|
m_startPtr1(0U),
|
||||||
m_endPtr(NOENDPTR),
|
m_endPtr1(NOENDPTR),
|
||||||
|
m_control1(CONTROL_NONE),
|
||||||
|
m_syncCount1(0U),
|
||||||
|
m_state1(DMRRXS_NONE),
|
||||||
|
m_n1(0U),
|
||||||
|
m_type1(0U),
|
||||||
|
m_syncPtr2(0U),
|
||||||
|
m_startPtr2(0U),
|
||||||
|
m_endPtr2(NOENDPTR),
|
||||||
|
m_control2(CONTROL_NONE),
|
||||||
|
m_syncCount2(0U),
|
||||||
|
m_state2(DMRRXS_NONE),
|
||||||
|
m_n2(0U),
|
||||||
|
m_type2(0U),
|
||||||
m_delayPtr(0U),
|
m_delayPtr(0U),
|
||||||
m_control(CONTROL_NONE),
|
|
||||||
m_syncCount(0U),
|
|
||||||
m_colorCode(0U),
|
m_colorCode(0U),
|
||||||
m_delay(0U),
|
m_delay(0U)
|
||||||
m_state(DMRRXS_NONE),
|
|
||||||
m_n(0U),
|
|
||||||
m_type(0U)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,35 +76,62 @@ void CDMRSlotRX::start(bool slot)
|
||||||
|
|
||||||
void CDMRSlotRX::reset()
|
void CDMRSlotRX::reset()
|
||||||
{
|
{
|
||||||
m_syncPtr = 0U;
|
|
||||||
m_dataPtr = 0U;
|
m_dataPtr = 0U;
|
||||||
m_delayPtr = 0U;
|
m_delayPtr = 0U;
|
||||||
m_control = CONTROL_NONE;
|
|
||||||
m_syncCount = 0U;
|
|
||||||
m_state = DMRRXS_NONE;
|
|
||||||
m_startPtr = 0U;
|
|
||||||
m_patternBuffer = 0U;
|
m_patternBuffer = 0U;
|
||||||
m_endPtr = NOENDPTR;
|
|
||||||
|
reset1();
|
||||||
|
reset2();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDMRSlotRX::reset1()
|
||||||
|
{
|
||||||
|
m_syncPtr1 = 0U;
|
||||||
|
m_control1 = CONTROL_NONE;
|
||||||
|
m_syncCount1 = 0U;
|
||||||
|
m_state1 = DMRRXS_NONE;
|
||||||
|
m_startPtr1 = 0U;
|
||||||
|
m_endPtr1 = NOENDPTR;
|
||||||
|
m_type1 = 0U;
|
||||||
|
m_n1 = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDMRSlotRX::reset2()
|
||||||
|
{
|
||||||
|
m_syncPtr2 = 0U;
|
||||||
|
m_control2 = CONTROL_NONE;
|
||||||
|
m_syncCount2 = 0U;
|
||||||
|
m_state2 = DMRRXS_NONE;
|
||||||
|
m_startPtr2 = 0U;
|
||||||
|
m_endPtr2 = NOENDPTR;
|
||||||
|
m_type2 = 0U;
|
||||||
|
m_n2 = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDMRSlotRX::databit(bool bit)
|
bool CDMRSlotRX::databit(bool bit)
|
||||||
{
|
{
|
||||||
|
uint16_t min, max;
|
||||||
|
|
||||||
m_delayPtr++;
|
m_delayPtr++;
|
||||||
if (m_delayPtr < m_delay)
|
if (m_delayPtr < m_delay)
|
||||||
return m_state != DMRRXS_NONE;
|
return (m_state1 != DMRRXS_NONE) || (m_state2 != DMRRXS_NONE);
|
||||||
|
|
||||||
|
WRITE_BIT1(m_buffer, m_dataPtr, bit);
|
||||||
|
|
||||||
m_buffer[m_dataPtr] = bit;
|
|
||||||
|
|
||||||
m_patternBuffer <<= 1;
|
m_patternBuffer <<= 1;
|
||||||
if (bit)
|
if (bit)
|
||||||
m_patternBuffer |= 0x01U;
|
m_patternBuffer |= 0x01U;
|
||||||
|
|
||||||
if (m_state == DMRRXS_NONE) {
|
if (m_state1 == DMRRXS_NONE || m_state2 == DMRRXS_NONE) {
|
||||||
correlateSync();
|
correlateSync();
|
||||||
} else {
|
} else {
|
||||||
|
if(m_slot) {
|
||||||
uint16_t min = m_syncPtr + DMR_BUFFER_LENGTH_BITS - 2;
|
min = m_syncPtr2 + DMR_BUFFER_LENGTH_BITS - 2;
|
||||||
uint16_t max = m_syncPtr + 2;
|
max = m_syncPtr2 + 2;
|
||||||
|
} else {
|
||||||
|
min = m_syncPtr1 + DMR_BUFFER_LENGTH_BITS - 2;
|
||||||
|
max = m_syncPtr1 + 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (min >= DMR_BUFFER_LENGTH_BITS)
|
if (min >= DMR_BUFFER_LENGTH_BITS)
|
||||||
min -= DMR_BUFFER_LENGTH_BITS;
|
min -= DMR_BUFFER_LENGTH_BITS;
|
||||||
|
|
@ -107,144 +147,278 @@ bool CDMRSlotRX::databit(bool bit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dataPtr == m_endPtr) {
|
if(m_slot)
|
||||||
frame[0U] = m_control;
|
procSlot2();
|
||||||
|
else
|
||||||
bitsToBytes(m_startPtr, DMR_FRAME_LENGTH_BYTES, frame + 1U);
|
procSlot1();
|
||||||
|
|
||||||
if (m_control == CONTROL_DATA) {
|
|
||||||
// Data sync
|
|
||||||
uint8_t colorCode;
|
|
||||||
uint8_t dataType;
|
|
||||||
CDMRSlotType slotType;
|
|
||||||
slotType.decode(frame + 1U, colorCode, dataType);
|
|
||||||
|
|
||||||
if (colorCode == m_colorCode) {
|
|
||||||
m_syncCount = 0U;
|
|
||||||
m_n = 0U;
|
|
||||||
|
|
||||||
frame[0U] |= dataType;
|
|
||||||
|
|
||||||
switch (dataType) {
|
|
||||||
case DT_DATA_HEADER:
|
|
||||||
DEBUG3("DMRSlotRX: data header found slot/pos", m_slot ? 2U : 1U, m_syncPtr);
|
|
||||||
writeRSSIData(frame);
|
|
||||||
m_state = DMRRXS_DATA;
|
|
||||||
m_type = 0x00U;
|
|
||||||
break;
|
|
||||||
case DT_RATE_12_DATA:
|
|
||||||
case DT_RATE_34_DATA:
|
|
||||||
case DT_RATE_1_DATA:
|
|
||||||
if (m_state == DMRRXS_DATA) {
|
|
||||||
DEBUG3("DMRSlotRX: data payload found slot/pos", m_slot ? 2U : 1U, m_syncPtr);
|
|
||||||
writeRSSIData(frame);
|
|
||||||
m_type = dataType;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DT_VOICE_LC_HEADER:
|
|
||||||
DEBUG3("DMRSlotRX: voice header found slot/pos", m_slot ? 2U : 1U, m_syncPtr);
|
|
||||||
writeRSSIData(frame);
|
|
||||||
m_state = DMRRXS_VOICE;
|
|
||||||
break;
|
|
||||||
case DT_VOICE_PI_HEADER:
|
|
||||||
if (m_state == DMRRXS_VOICE) {
|
|
||||||
DEBUG3("DMRSlotRX: voice pi header found slot/pos", m_slot ? 2U : 1U, m_syncPtr);
|
|
||||||
writeRSSIData(frame);
|
|
||||||
}
|
|
||||||
m_state = DMRRXS_VOICE;
|
|
||||||
break;
|
|
||||||
case DT_TERMINATOR_WITH_LC:
|
|
||||||
if (m_state == DMRRXS_VOICE) {
|
|
||||||
DEBUG3("DMRSlotRX: voice terminator found slot/pos", m_slot ? 2U : 1U, m_syncPtr);
|
|
||||||
writeRSSIData(frame);
|
|
||||||
m_state = DMRRXS_NONE;
|
|
||||||
m_endPtr = NOENDPTR;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default: // DT_CSBK
|
|
||||||
DEBUG3("DMRSlotRX: csbk found slot/pos", m_slot ? 2U : 1U, m_syncPtr);
|
|
||||||
writeRSSIData(frame);
|
|
||||||
m_state = DMRRXS_NONE;
|
|
||||||
m_endPtr = NOENDPTR;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (m_control == CONTROL_VOICE) {
|
|
||||||
// Voice sync
|
|
||||||
DEBUG3("DMRSlotRX: voice sync found slot/pos", m_slot ? 2U : 1U, m_syncPtr);
|
|
||||||
writeRSSIData(frame);
|
|
||||||
m_state = DMRRXS_VOICE;
|
|
||||||
m_syncCount = 0U;
|
|
||||||
m_n = 0U;
|
|
||||||
} else {
|
|
||||||
if (m_state != DMRRXS_NONE) {
|
|
||||||
m_syncCount++;
|
|
||||||
if (m_syncCount >= MAX_SYNC_LOST_FRAMES) {
|
|
||||||
serial.writeDMRLost(m_slot);
|
|
||||||
m_state = DMRRXS_NONE;
|
|
||||||
m_endPtr = NOENDPTR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_state == DMRRXS_VOICE) {
|
|
||||||
if (m_n >= 5U) {
|
|
||||||
frame[0U] = CONTROL_VOICE;
|
|
||||||
m_n = 0U;
|
|
||||||
} else {
|
|
||||||
frame[0U] = ++m_n;
|
|
||||||
}
|
|
||||||
|
|
||||||
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
|
|
||||||
} else if (m_state == DMRRXS_DATA) {
|
|
||||||
if (m_type != 0x00U) {
|
|
||||||
frame[0U] = CONTROL_DATA | m_type;
|
|
||||||
writeRSSIData(frame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// End of this slot, reset some items for the next slot.
|
|
||||||
m_control = CONTROL_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_dataPtr++;
|
m_dataPtr++;
|
||||||
|
|
||||||
if (m_dataPtr >= DMR_BUFFER_LENGTH_BITS)
|
if (m_dataPtr >= DMR_BUFFER_LENGTH_BITS)
|
||||||
m_dataPtr = 0U;
|
m_dataPtr = 0U;
|
||||||
|
|
||||||
return m_state != DMRRXS_NONE;
|
return (m_state1 != DMRRXS_NONE) || (m_state2 != DMRRXS_NONE);;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDMRSlotRX::procSlot1()
|
||||||
|
{
|
||||||
|
if (m_dataPtr == m_endPtr1) {
|
||||||
|
frame1[0U] = m_control1;
|
||||||
|
|
||||||
|
bitsToBytes(m_startPtr1, DMR_FRAME_LENGTH_BYTES, frame1 + 1U);
|
||||||
|
|
||||||
|
if (m_control1 == CONTROL_DATA) {
|
||||||
|
// Data sync
|
||||||
|
uint8_t colorCode;
|
||||||
|
uint8_t dataType;
|
||||||
|
CDMRSlotType slotType;
|
||||||
|
slotType.decode(frame1 + 1U, colorCode, dataType);
|
||||||
|
|
||||||
|
if (colorCode == m_colorCode) {
|
||||||
|
m_syncCount1 = 0U;
|
||||||
|
m_n1 = 0U;
|
||||||
|
|
||||||
|
frame1[0U] |= dataType;
|
||||||
|
|
||||||
|
switch (dataType) {
|
||||||
|
case DT_DATA_HEADER:
|
||||||
|
DEBUG2("DMRSlot1RX: data header found pos", m_syncPtr1);
|
||||||
|
writeRSSIData1();
|
||||||
|
m_state1 = DMRRXS_DATA;
|
||||||
|
m_type1 = 0x00U;
|
||||||
|
break;
|
||||||
|
case DT_RATE_12_DATA:
|
||||||
|
case DT_RATE_34_DATA:
|
||||||
|
case DT_RATE_1_DATA:
|
||||||
|
if (m_state1 == DMRRXS_DATA) {
|
||||||
|
DEBUG2("DMRSlot1RX: data payload found pos", m_syncPtr1);
|
||||||
|
writeRSSIData1();
|
||||||
|
m_type1 = dataType;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DT_VOICE_LC_HEADER:
|
||||||
|
DEBUG2("DMRSlot1RX: voice header found pos", m_syncPtr1);
|
||||||
|
writeRSSIData1();
|
||||||
|
m_state1 = DMRRXS_VOICE;
|
||||||
|
break;
|
||||||
|
case DT_VOICE_PI_HEADER:
|
||||||
|
if (m_state1 == DMRRXS_VOICE) {
|
||||||
|
DEBUG2("DMRSlot1RX: voice pi header found pos", m_syncPtr1);
|
||||||
|
writeRSSIData1();
|
||||||
|
}
|
||||||
|
m_state1 = DMRRXS_VOICE;
|
||||||
|
break;
|
||||||
|
case DT_TERMINATOR_WITH_LC:
|
||||||
|
if (m_state1 == DMRRXS_VOICE) {
|
||||||
|
DEBUG2("DMRSlot1RX: voice terminator found pos", m_syncPtr1);
|
||||||
|
writeRSSIData1();
|
||||||
|
m_state1 = DMRRXS_NONE;
|
||||||
|
m_endPtr1 = NOENDPTR;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: // DT_CSBK
|
||||||
|
DEBUG2("DMRSlot1RX: csbk found pos", m_syncPtr1);
|
||||||
|
writeRSSIData1();
|
||||||
|
m_state1 = DMRRXS_NONE;
|
||||||
|
m_endPtr1 = NOENDPTR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (m_control1 == CONTROL_VOICE) {
|
||||||
|
// Voice sync
|
||||||
|
DEBUG2("DMRSlot1RX: voice sync found pos", m_syncPtr1);
|
||||||
|
writeRSSIData1();
|
||||||
|
m_state1 = DMRRXS_VOICE;
|
||||||
|
m_syncCount1 = 0U;
|
||||||
|
m_n1 = 0U;
|
||||||
|
} else {
|
||||||
|
if (m_state1 != DMRRXS_NONE) {
|
||||||
|
m_syncCount1++;
|
||||||
|
if (m_syncCount1 >= MAX_SYNC_LOST_FRAMES) {
|
||||||
|
serial.writeDMRLost(0U);
|
||||||
|
reset1();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_state1 == DMRRXS_VOICE) {
|
||||||
|
if (m_n1 >= 5U) {
|
||||||
|
frame1[0U] = CONTROL_VOICE;
|
||||||
|
m_n1 = 0U;
|
||||||
|
} else {
|
||||||
|
frame1[0U] = ++m_n1;
|
||||||
|
}
|
||||||
|
|
||||||
|
serial.writeDMRData(0U, frame1, DMR_FRAME_LENGTH_BYTES + 1U);
|
||||||
|
} else if (m_state1 == DMRRXS_DATA) {
|
||||||
|
if (m_type1 != 0x00U) {
|
||||||
|
frame1[0U] = CONTROL_DATA | m_type1;
|
||||||
|
writeRSSIData1();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// End of this slot, reset some items for the next slot.
|
||||||
|
m_control1 = CONTROL_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDMRSlotRX::procSlot2()
|
||||||
|
{
|
||||||
|
if (m_dataPtr == m_endPtr2) {
|
||||||
|
frame2[0U] = m_control2;
|
||||||
|
|
||||||
|
bitsToBytes(m_startPtr2, DMR_FRAME_LENGTH_BYTES, frame2 + 1U);
|
||||||
|
|
||||||
|
if (m_control2 == CONTROL_DATA) {
|
||||||
|
// Data sync
|
||||||
|
uint8_t colorCode;
|
||||||
|
uint8_t dataType;
|
||||||
|
CDMRSlotType slotType;
|
||||||
|
slotType.decode(frame2 + 1U, colorCode, dataType);
|
||||||
|
|
||||||
|
if (colorCode == m_colorCode) {
|
||||||
|
m_syncCount2 = 0U;
|
||||||
|
m_n2 = 0U;
|
||||||
|
|
||||||
|
frame2[0U] |= dataType;
|
||||||
|
|
||||||
|
switch (dataType) {
|
||||||
|
case DT_DATA_HEADER:
|
||||||
|
DEBUG2("DMRSlot2RX: data header found pos", m_syncPtr2);
|
||||||
|
writeRSSIData2();
|
||||||
|
m_state2 = DMRRXS_DATA;
|
||||||
|
m_type2 = 0x00U;
|
||||||
|
break;
|
||||||
|
case DT_RATE_12_DATA:
|
||||||
|
case DT_RATE_34_DATA:
|
||||||
|
case DT_RATE_1_DATA:
|
||||||
|
if (m_state2 == DMRRXS_DATA) {
|
||||||
|
DEBUG2("DMRSlot2RX: data payload found pos", m_syncPtr2);
|
||||||
|
writeRSSIData2();
|
||||||
|
m_type2 = dataType;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DT_VOICE_LC_HEADER:
|
||||||
|
DEBUG2("DMRSlot2RX: voice header found pos", m_syncPtr2);
|
||||||
|
writeRSSIData2();
|
||||||
|
m_state2 = DMRRXS_VOICE;
|
||||||
|
break;
|
||||||
|
case DT_VOICE_PI_HEADER:
|
||||||
|
if (m_state2 == DMRRXS_VOICE) {
|
||||||
|
DEBUG2("DMRSlot2RX: voice pi header found pos", m_syncPtr2);
|
||||||
|
writeRSSIData2();
|
||||||
|
}
|
||||||
|
m_state2 = DMRRXS_VOICE;
|
||||||
|
break;
|
||||||
|
case DT_TERMINATOR_WITH_LC:
|
||||||
|
if (m_state2 == DMRRXS_VOICE) {
|
||||||
|
DEBUG2("DMRSlot2RX: voice terminator found pos", m_syncPtr2);
|
||||||
|
writeRSSIData2();
|
||||||
|
m_state2 = DMRRXS_NONE;
|
||||||
|
m_endPtr2 = NOENDPTR;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: // DT_CSBK
|
||||||
|
DEBUG2("DMRSlot2RX: csbk found pos", m_syncPtr2);
|
||||||
|
writeRSSIData2();
|
||||||
|
m_state2 = DMRRXS_NONE;
|
||||||
|
m_endPtr2 = NOENDPTR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (m_control2 == CONTROL_VOICE) {
|
||||||
|
// Voice sync
|
||||||
|
DEBUG2("DMRSlot2RX: voice sync found pos", m_syncPtr2);
|
||||||
|
writeRSSIData2();
|
||||||
|
m_state2 = DMRRXS_VOICE;
|
||||||
|
m_syncCount2 = 0U;
|
||||||
|
m_n2 = 0U;
|
||||||
|
} else {
|
||||||
|
if (m_state2 != DMRRXS_NONE) {
|
||||||
|
m_syncCount2++;
|
||||||
|
if (m_syncCount2 >= MAX_SYNC_LOST_FRAMES) {
|
||||||
|
serial.writeDMRLost(1U);
|
||||||
|
reset2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_state2 == DMRRXS_VOICE) {
|
||||||
|
if (m_n2 >= 5U) {
|
||||||
|
frame2[0U] = CONTROL_VOICE;
|
||||||
|
m_n2 = 0U;
|
||||||
|
} else {
|
||||||
|
frame2[0U] = ++m_n2;
|
||||||
|
}
|
||||||
|
|
||||||
|
serial.writeDMRData(1U, frame2, DMR_FRAME_LENGTH_BYTES + 1U);
|
||||||
|
} else if (m_state2 == DMRRXS_DATA) {
|
||||||
|
if (m_type2 != 0x00U) {
|
||||||
|
frame2[0U] = CONTROL_DATA | m_type2;
|
||||||
|
writeRSSIData2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// End of this slot, reset some items for the next slot.
|
||||||
|
m_control2 = CONTROL_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDMRSlotRX::correlateSync()
|
void CDMRSlotRX::correlateSync()
|
||||||
{
|
{
|
||||||
|
uint16_t syncPtr;
|
||||||
|
uint16_t startPtr;
|
||||||
|
uint16_t endPtr;
|
||||||
|
uint8_t control;
|
||||||
|
|
||||||
if (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_DATA_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) {
|
if (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_DATA_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) {
|
||||||
|
control = CONTROL_DATA;
|
||||||
|
syncPtr = m_dataPtr;
|
||||||
|
|
||||||
m_control = CONTROL_DATA;
|
startPtr = m_dataPtr + DMR_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1;
|
||||||
m_syncPtr = m_dataPtr;
|
if (startPtr >= DMR_BUFFER_LENGTH_BITS)
|
||||||
|
startPtr -= DMR_BUFFER_LENGTH_BITS;
|
||||||
|
|
||||||
m_startPtr = m_dataPtr + DMR_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1;
|
endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U;
|
||||||
if (m_startPtr >= DMR_BUFFER_LENGTH_BITS)
|
if (endPtr >= DMR_BUFFER_LENGTH_BITS)
|
||||||
m_startPtr -= DMR_BUFFER_LENGTH_BITS;
|
endPtr -= DMR_BUFFER_LENGTH_BITS;
|
||||||
|
|
||||||
m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U;
|
if(m_slot) {
|
||||||
if (m_endPtr >= DMR_BUFFER_LENGTH_BITS)
|
m_syncPtr2 = syncPtr;
|
||||||
m_endPtr -= DMR_BUFFER_LENGTH_BITS;
|
m_startPtr2 = startPtr;
|
||||||
|
m_endPtr2 = endPtr;
|
||||||
//DEBUG4("SYNC corr MS Data found pos/start/end:", m_dataPtr, m_startPtr, m_endPtr);
|
m_control2 = control;
|
||||||
|
} else {
|
||||||
|
m_syncPtr1 = syncPtr;
|
||||||
|
m_startPtr1 = startPtr;
|
||||||
|
m_endPtr1 = endPtr;
|
||||||
|
m_control1 = control;
|
||||||
|
}
|
||||||
|
DEBUG5("SYNC corr MS Data found slot/pos/start/end:", m_slot ? 2U : 1U, m_dataPtr, startPtr, endPtr);
|
||||||
} else if (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_VOICE_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) {
|
} else if (countBits64((m_patternBuffer & DMR_SYNC_BITS_MASK) ^ DMR_MS_VOICE_SYNC_BITS) <= MAX_SYNC_BYTES_ERRS) {
|
||||||
|
control = CONTROL_VOICE;
|
||||||
|
syncPtr = m_dataPtr;
|
||||||
|
|
||||||
m_control = CONTROL_VOICE;
|
startPtr = m_dataPtr + DMR_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1;
|
||||||
m_syncPtr = m_dataPtr;
|
if (startPtr >= DMR_BUFFER_LENGTH_BITS)
|
||||||
m_startPtr = m_dataPtr + DMR_BUFFER_LENGTH_BITS - DMR_SLOT_TYPE_LENGTH_BITS / 2U - DMR_INFO_LENGTH_BITS / 2U - DMR_SYNC_LENGTH_BITS + 1;
|
startPtr -= DMR_BUFFER_LENGTH_BITS;
|
||||||
if (m_startPtr >= DMR_BUFFER_LENGTH_BITS)
|
|
||||||
m_startPtr -= DMR_BUFFER_LENGTH_BITS;
|
endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U;
|
||||||
|
if (endPtr >= DMR_BUFFER_LENGTH_BITS)
|
||||||
m_endPtr = m_dataPtr + DMR_SLOT_TYPE_LENGTH_BITS / 2U + DMR_INFO_LENGTH_BITS / 2U;
|
endPtr -= DMR_BUFFER_LENGTH_BITS;
|
||||||
if (m_endPtr >= DMR_BUFFER_LENGTH_BITS)
|
|
||||||
m_endPtr -= DMR_BUFFER_LENGTH_BITS;
|
if(m_slot) {
|
||||||
|
m_syncPtr2 = syncPtr;
|
||||||
//DEBUG4("SYNC corr MS Voice found pos/start/end: ", m_dataPtr, m_startPtr, m_endPtr);
|
m_startPtr2 = startPtr;
|
||||||
|
m_endPtr2 = endPtr;
|
||||||
|
m_control2 = control;
|
||||||
|
} else {
|
||||||
|
m_syncPtr1 = syncPtr;
|
||||||
|
m_startPtr1 = startPtr;
|
||||||
|
m_endPtr1 = endPtr;
|
||||||
|
m_control1 = control;
|
||||||
|
}
|
||||||
|
DEBUG5("SYNC corr MS Voice found slot/pos/start/end: ", m_slot ? 2U : 1U, m_dataPtr, startPtr, endPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -252,28 +426,36 @@ void CDMRSlotRX::bitsToBytes(uint16_t start, uint8_t count, uint8_t* buffer)
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0U; i < count; i++) {
|
for (uint8_t i = 0U; i < count; i++) {
|
||||||
buffer[i] = 0U;
|
buffer[i] = 0U;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 7);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 7;
|
||||||
|
start++;
|
||||||
if (start >= DMR_BUFFER_LENGTH_BITS)
|
if (start >= DMR_BUFFER_LENGTH_BITS)
|
||||||
start -= DMR_BUFFER_LENGTH_BITS;
|
start -= DMR_BUFFER_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 6);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 6;
|
||||||
|
start++;
|
||||||
if (start >= DMR_BUFFER_LENGTH_BITS)
|
if (start >= DMR_BUFFER_LENGTH_BITS)
|
||||||
start -= DMR_BUFFER_LENGTH_BITS;
|
start -= DMR_BUFFER_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 5);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 5;
|
||||||
|
start++;
|
||||||
if (start >= DMR_BUFFER_LENGTH_BITS)
|
if (start >= DMR_BUFFER_LENGTH_BITS)
|
||||||
start -= DMR_BUFFER_LENGTH_BITS;
|
start -= DMR_BUFFER_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 4);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 4;
|
||||||
|
start++;
|
||||||
if (start >= DMR_BUFFER_LENGTH_BITS)
|
if (start >= DMR_BUFFER_LENGTH_BITS)
|
||||||
start -= DMR_BUFFER_LENGTH_BITS;
|
start -= DMR_BUFFER_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 3);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 3;
|
||||||
|
start++;
|
||||||
if (start >= DMR_BUFFER_LENGTH_BITS)
|
if (start >= DMR_BUFFER_LENGTH_BITS)
|
||||||
start -= DMR_BUFFER_LENGTH_BITS;
|
start -= DMR_BUFFER_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 2);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 2;
|
||||||
|
start++;
|
||||||
if (start >= DMR_BUFFER_LENGTH_BITS)
|
if (start >= DMR_BUFFER_LENGTH_BITS)
|
||||||
start -= DMR_BUFFER_LENGTH_BITS;
|
start -= DMR_BUFFER_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 1);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 1;
|
||||||
|
start++;
|
||||||
if (start >= DMR_BUFFER_LENGTH_BITS)
|
if (start >= DMR_BUFFER_LENGTH_BITS)
|
||||||
start -= DMR_BUFFER_LENGTH_BITS;
|
start -= DMR_BUFFER_LENGTH_BITS;
|
||||||
buffer[i] |= ((m_buffer[start++] & 0x01) << 0);
|
buffer[i] |= READ_BIT1(m_buffer, start) << 0;
|
||||||
|
start++;
|
||||||
if (start >= DMR_BUFFER_LENGTH_BITS)
|
if (start >= DMR_BUFFER_LENGTH_BITS)
|
||||||
start -= DMR_BUFFER_LENGTH_BITS;
|
start -= DMR_BUFFER_LENGTH_BITS;
|
||||||
}
|
}
|
||||||
|
|
@ -289,17 +471,31 @@ void CDMRSlotRX::setDelay(uint8_t delay)
|
||||||
m_delay = delay / 5;
|
m_delay = delay / 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDMRSlotRX::writeRSSIData(uint8_t* frame)
|
void CDMRSlotRX::writeRSSIData1()
|
||||||
{
|
{
|
||||||
#if defined(SEND_RSSI_DATA)
|
#if defined(SEND_RSSI_DATA)
|
||||||
uint16_t rssi = io.readRSSI();
|
uint16_t rssi = io.readRSSI();
|
||||||
|
|
||||||
frame[34U] = (rssi >> 8) & 0xFFU;
|
frame1[34U] = (rssi >> 8) & 0xFFU;
|
||||||
frame[35U] = (rssi >> 0) & 0xFFU;
|
frame1[35U] = (rssi >> 0) & 0xFFU;
|
||||||
|
|
||||||
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 3U);
|
serial.writeDMRData(0U, frame1, DMR_FRAME_LENGTH_BYTES + 3U);
|
||||||
#else
|
#else
|
||||||
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
|
serial.writeDMRData(0U, frame1, DMR_FRAME_LENGTH_BYTES + 1U);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDMRSlotRX::writeRSSIData2()
|
||||||
|
{
|
||||||
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
uint16_t rssi = io.readRSSI();
|
||||||
|
|
||||||
|
frame2[34U] = (rssi >> 8) & 0xFFU;
|
||||||
|
frame2[35U] = (rssi >> 0) & 0xFFU;
|
||||||
|
|
||||||
|
serial.writeDMRData(1U, frame2, DMR_FRAME_LENGTH_BYTES + 3U);
|
||||||
|
#else
|
||||||
|
serial.writeDMRData(1U, frame2, DMR_FRAME_LENGTH_BYTES + 1U);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
41
DMRSlotRX.h
41
DMRSlotRX.h
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2017,2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -50,24 +50,41 @@ public:
|
||||||
private:
|
private:
|
||||||
bool m_slot;
|
bool m_slot;
|
||||||
uint64_t m_patternBuffer;
|
uint64_t m_patternBuffer;
|
||||||
uint8_t m_buffer[DMR_BUFFER_LENGTH_BITS];
|
uint8_t m_buffer[DMR_BUFFER_LENGTH_BITS / 8U]; // 72 bytes
|
||||||
uint8_t frame[DMR_FRAME_LENGTH_BYTES + 3U];
|
|
||||||
uint16_t m_dataPtr;
|
uint16_t m_dataPtr;
|
||||||
uint16_t m_syncPtr;
|
|
||||||
uint16_t m_startPtr;
|
uint8_t frame1[DMR_FRAME_LENGTH_BYTES + 3U];
|
||||||
uint16_t m_endPtr;
|
uint16_t m_syncPtr1;
|
||||||
|
uint16_t m_startPtr1;
|
||||||
|
uint16_t m_endPtr1;
|
||||||
|
uint8_t m_control1;
|
||||||
|
uint8_t m_syncCount1;
|
||||||
|
DMRRX_STATE m_state1;
|
||||||
|
uint8_t m_n1;
|
||||||
|
uint8_t m_type1;
|
||||||
|
|
||||||
|
uint8_t frame2[DMR_FRAME_LENGTH_BYTES + 3U];
|
||||||
|
uint16_t m_syncPtr2;
|
||||||
|
uint16_t m_startPtr2;
|
||||||
|
uint16_t m_endPtr2;
|
||||||
|
uint8_t m_control2;
|
||||||
|
uint8_t m_syncCount2;
|
||||||
|
DMRRX_STATE m_state2;
|
||||||
|
uint8_t m_n2;
|
||||||
|
uint8_t m_type2;
|
||||||
|
|
||||||
uint16_t m_delayPtr;
|
uint16_t m_delayPtr;
|
||||||
uint8_t m_control;
|
|
||||||
uint8_t m_syncCount;
|
|
||||||
uint8_t m_colorCode;
|
uint8_t m_colorCode;
|
||||||
uint16_t m_delay;
|
uint16_t m_delay;
|
||||||
DMRRX_STATE m_state;
|
|
||||||
uint8_t m_n;
|
|
||||||
uint8_t m_type;
|
|
||||||
|
|
||||||
|
void procSlot1();
|
||||||
|
void procSlot2();
|
||||||
void correlateSync();
|
void correlateSync();
|
||||||
void bitsToBytes(uint16_t start, uint8_t count, uint8_t* buffer);
|
void bitsToBytes(uint16_t start, uint8_t count, uint8_t* buffer);
|
||||||
void writeRSSIData(uint8_t* frame);
|
void writeRSSIData1();
|
||||||
|
void writeRSSIData2();
|
||||||
|
void reset1();
|
||||||
|
void reset2();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
30
DMRTX.cpp
30
DMRTX.cpp
|
|
@ -59,7 +59,8 @@ m_poBuffer(),
|
||||||
m_poLen(0U),
|
m_poLen(0U),
|
||||||
m_poPtr(0U),
|
m_poPtr(0U),
|
||||||
m_frameCount(0U),
|
m_frameCount(0U),
|
||||||
m_abort()
|
m_abort(),
|
||||||
|
m_control_old(0U)
|
||||||
{
|
{
|
||||||
::memcpy(m_newShortLC, EMPTY_SHORT_LC, 12U);
|
::memcpy(m_newShortLC, EMPTY_SHORT_LC, 12U);
|
||||||
::memcpy(m_shortLC, EMPTY_SHORT_LC, 12U);
|
::memcpy(m_shortLC, EMPTY_SHORT_LC, 12U);
|
||||||
|
|
@ -218,21 +219,24 @@ void CDMRTX::writeByte(uint8_t c, uint8_t control)
|
||||||
{
|
{
|
||||||
uint8_t bit;
|
uint8_t bit;
|
||||||
uint8_t mask = 0x80U;
|
uint8_t mask = 0x80U;
|
||||||
uint8_t control_tmp;
|
uint8_t control_tmp = m_control_old;
|
||||||
|
|
||||||
for (uint8_t i = 0U; i < 8U; i++, c <<= 1) {
|
for (uint8_t i = 0U; i < 8U; i++, c <<= 1) {
|
||||||
if ((c & mask) == mask)
|
if ((c & mask) == mask)
|
||||||
bit = 1U;
|
bit = 1U;
|
||||||
else
|
else
|
||||||
bit = 0U;
|
bit = 0U;
|
||||||
|
|
||||||
control_tmp = MARK_NONE;
|
|
||||||
|
|
||||||
if( i == 7U || i == 6U)
|
if(i == 7U) {
|
||||||
control_tmp = control;
|
if (control == MARK_SLOT2)
|
||||||
|
control_tmp = true;
|
||||||
|
else if (control == MARK_SLOT1)
|
||||||
|
control_tmp = false;
|
||||||
|
|
||||||
|
m_control_old = control_tmp;
|
||||||
|
}
|
||||||
|
|
||||||
io.write(&bit, 1, &control_tmp);
|
io.write(&bit, 1, &control_tmp);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -251,14 +255,20 @@ void CDMRTX::createData(uint8_t slotIndex)
|
||||||
if (m_fifo[slotIndex].getData() > 0U && m_frameCount >= STARTUP_COUNT) {
|
if (m_fifo[slotIndex].getData() > 0U && m_frameCount >= STARTUP_COUNT) {
|
||||||
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) {
|
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) {
|
||||||
m_poBuffer[i] = m_fifo[slotIndex].get();
|
m_poBuffer[i] = m_fifo[slotIndex].get();
|
||||||
m_markBuffer[i] = MARK_NONE;
|
if (i == 8U)
|
||||||
|
m_markBuffer[i] = slotIndex == 0U ? MARK_SLOT1 : MARK_SLOT2;
|
||||||
|
else
|
||||||
|
m_markBuffer[i] = MARK_NONE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_abort[slotIndex] = false;
|
m_abort[slotIndex] = false;
|
||||||
// Transmit an idle message
|
// Transmit an idle message
|
||||||
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) {
|
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) {
|
||||||
m_poBuffer[i] = m_idle[i];
|
m_poBuffer[i] = m_idle[i];
|
||||||
m_markBuffer[i] = MARK_NONE;
|
if (i == 8U)
|
||||||
|
m_markBuffer[i] = slotIndex == 0U ? MARK_SLOT1 : MARK_SLOT2;
|
||||||
|
else
|
||||||
|
m_markBuffer[i] = MARK_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -283,7 +293,7 @@ void CDMRTX::createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex)
|
||||||
::memcpy(m_poBuffer, m_shortLC + m_cachPtr, 3U);
|
::memcpy(m_poBuffer, m_shortLC + m_cachPtr, 3U);
|
||||||
m_markBuffer[0U] = MARK_NONE;
|
m_markBuffer[0U] = MARK_NONE;
|
||||||
m_markBuffer[1U] = MARK_NONE;
|
m_markBuffer[1U] = MARK_NONE;
|
||||||
m_markBuffer[2U] = rxSlotIndex == 1U ? MARK_SLOT1 : MARK_SLOT2;
|
m_markBuffer[2U] = MARK_NONE;
|
||||||
|
|
||||||
bool at = false;
|
bool at = false;
|
||||||
if (m_frameCount >= STARTUP_COUNT)
|
if (m_frameCount >= STARTUP_COUNT)
|
||||||
|
|
|
||||||
1
DMRTX.h
1
DMRTX.h
|
|
@ -70,6 +70,7 @@ private:
|
||||||
uint16_t m_poPtr;
|
uint16_t m_poPtr;
|
||||||
uint32_t m_frameCount;
|
uint32_t m_frameCount;
|
||||||
bool m_abort[2U];
|
bool m_abort[2U];
|
||||||
|
uint8_t m_control_old;
|
||||||
|
|
||||||
void createData(uint8_t slotIndex);
|
void createData(uint8_t slotIndex);
|
||||||
void createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex);
|
void createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex);
|
||||||
|
|
|
||||||
101
DStarRX.cpp
101
DStarRX.cpp
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2009-2016,2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -22,31 +22,27 @@
|
||||||
#include "DStarRX.h"
|
#include "DStarRX.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
const unsigned int MAX_SYNC_BITS = 50U * DSTAR_DATA_LENGTH_BITS;
|
const unsigned int MAX_SYNC_BITS = 100U * DSTAR_DATA_LENGTH_BITS;
|
||||||
|
|
||||||
const unsigned int SYNC_POS = 21U * DSTAR_DATA_LENGTH_BITS;
|
|
||||||
const unsigned int SYNC_SCAN_START = SYNC_POS - 3U;
|
|
||||||
const unsigned int SYNC_SCAN_END = SYNC_POS + 3U;
|
|
||||||
|
|
||||||
// D-Star preamble sequence (only 32 bits of 101010...)
|
// D-Star preamble sequence (only 32 bits of 101010...)
|
||||||
const uint32_t PREAMBLE_MASK = 0xFFFFFFFFU;
|
const uint64_t PREAMBLE_MASK = 0x00000000FFFFFFFFU;
|
||||||
const uint32_t PREAMBLE_DATA = 0xAAAAAAAAU;
|
const uint64_t PREAMBLE_DATA = 0x00000000AAAAAAAAU;
|
||||||
const uint8_t PREAMBLE_ERRS = 2U;
|
const uint8_t PREAMBLE_ERRS = 2U;
|
||||||
|
|
||||||
// D-Star bit order version of 0x55 0x55 0x6E 0x0A
|
// D-Star bit order version of 0x55 0x55 0x6E 0x0A
|
||||||
const uint32_t FRAME_SYNC_DATA = 0x00557650U;
|
const uint64_t FRAME_SYNC_DATA = 0x0000000000557650U;
|
||||||
const uint32_t FRAME_SYNC_MASK = 0x00FFFFFFU;
|
const uint64_t FRAME_SYNC_MASK = 0x0000000000FFFFFFU;
|
||||||
const uint8_t FRAME_SYNC_ERRS = 2U;
|
const uint8_t FRAME_SYNC_ERRS = 2U;
|
||||||
|
|
||||||
// D-Star bit order version of 0x55 0x2D 0x16
|
// D-Star bit order version of 0x55 0x2D 0x16
|
||||||
const uint32_t DATA_SYNC_DATA = 0x00AAB468U;
|
const uint64_t DATA_SYNC_DATA = 0x0000000000AAB468U;
|
||||||
const uint32_t DATA_SYNC_MASK = 0x00FFFFFFU;
|
const uint64_t DATA_SYNC_MASK = 0x0000000000FFFFFFU;
|
||||||
const uint8_t DATA_SYNC_ERRS = 2U;
|
const uint8_t DATA_SYNC_ERRS = 3U;
|
||||||
|
|
||||||
// D-Star bit order version of 0x55 0x55 0xC8 0x7A
|
// D-Star bit order version of 0x55 0x55 0xC8 0x7A
|
||||||
const uint32_t END_SYNC_DATA = 0xAAAA135EU;
|
const uint64_t END_SYNC_DATA = 0x0000AAAAAAAA135EU;
|
||||||
const uint32_t END_SYNC_MASK = 0xFFFFFFFFU;
|
const uint64_t END_SYNC_MASK = 0x0000FFFFFFFFFFFFU;
|
||||||
const uint8_t END_SYNC_ERRS = 3U;
|
const uint8_t END_SYNC_ERRS = 1U;
|
||||||
|
|
||||||
const uint8_t BIT_MASK_TABLE0[] = {0x7FU, 0xBFU, 0xDFU, 0xEFU, 0xF7U, 0xFBU, 0xFDU, 0xFEU};
|
const uint8_t BIT_MASK_TABLE0[] = {0x7FU, 0xBFU, 0xDFU, 0xEFU, 0xF7U, 0xFBU, 0xFDU, 0xFEU};
|
||||||
const uint8_t BIT_MASK_TABLE1[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
const uint8_t BIT_MASK_TABLE1[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
||||||
|
|
@ -288,7 +284,7 @@ void CDStarRX::processNone(bool bit)
|
||||||
m_patternBuffer |= 0x01U;
|
m_patternBuffer |= 0x01U;
|
||||||
|
|
||||||
// Fuzzy matching of the preamble sync sequence
|
// Fuzzy matching of the preamble sync sequence
|
||||||
if (countBits32((m_patternBuffer & PREAMBLE_MASK) ^ PREAMBLE_DATA) <= PREAMBLE_ERRS) {
|
if (countBits64((m_patternBuffer & PREAMBLE_MASK) ^ PREAMBLE_DATA) <= PREAMBLE_ERRS) {
|
||||||
|
|
||||||
// Extend scan period in D-Star, once preamble is detected
|
// Extend scan period in D-Star, once preamble is detected
|
||||||
m_modeTimerCnt = 0;
|
m_modeTimerCnt = 0;
|
||||||
|
|
@ -299,7 +295,7 @@ void CDStarRX::processNone(bool bit)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fuzzy matching of the frame sync sequence
|
// Fuzzy matching of the frame sync sequence
|
||||||
if (countBits32((m_patternBuffer & FRAME_SYNC_MASK) ^ FRAME_SYNC_DATA) <= FRAME_SYNC_ERRS) {
|
if (countBits64((m_patternBuffer & FRAME_SYNC_MASK) ^ FRAME_SYNC_DATA) <= FRAME_SYNC_ERRS) {
|
||||||
DEBUG1("DStarRX: found frame sync in None, fuzzy");
|
DEBUG1("DStarRX: found frame sync in None, fuzzy");
|
||||||
|
|
||||||
::memset(m_rxBuffer, 0x00U, DSTAR_FEC_SECTION_LENGTH_BYTES);
|
::memset(m_rxBuffer, 0x00U, DSTAR_FEC_SECTION_LENGTH_BYTES);
|
||||||
|
|
@ -310,9 +306,9 @@ void CDStarRX::processNone(bool bit)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exact matching of the data sync bit sequence
|
// Exact matching of the data sync bit sequence
|
||||||
if (countBits32((m_patternBuffer & DATA_SYNC_MASK) ^ DATA_SYNC_DATA) == 0U) {
|
if (countBits64((m_patternBuffer & DATA_SYNC_MASK) ^ DATA_SYNC_DATA) == 0U) {
|
||||||
DEBUG1("DStarRX: found data sync in None, exact");
|
DEBUG1("DStarRX: found data sync in None, exact");
|
||||||
|
|
||||||
io.setDecode(true);
|
io.setDecode(true);
|
||||||
|
|
||||||
::memcpy(m_rxBuffer, DSTAR_DATA_SYNC_BYTES, DSTAR_DATA_LENGTH_BYTES);
|
::memcpy(m_rxBuffer, DSTAR_DATA_SYNC_BYTES, DSTAR_DATA_LENGTH_BYTES);
|
||||||
|
|
@ -321,7 +317,7 @@ void CDStarRX::processNone(bool bit)
|
||||||
::memset(m_rxBuffer, 0x00U, DSTAR_DATA_LENGTH_BYTES + 2U);
|
::memset(m_rxBuffer, 0x00U, DSTAR_DATA_LENGTH_BYTES + 2U);
|
||||||
m_rxBufferBits = 0U;
|
m_rxBufferBits = 0U;
|
||||||
|
|
||||||
m_dataBits = 0U;
|
m_dataBits = MAX_SYNC_BITS;
|
||||||
m_rxState = DSRXS_DATA;
|
m_rxState = DSRXS_DATA;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -334,7 +330,10 @@ void CDStarRX::processHeader(bool bit)
|
||||||
m_patternBuffer |= 0x01U;
|
m_patternBuffer |= 0x01U;
|
||||||
|
|
||||||
WRITE_BIT2(m_rxBuffer, m_rxBufferBits, bit);
|
WRITE_BIT2(m_rxBuffer, m_rxBufferBits, bit);
|
||||||
|
|
||||||
m_rxBufferBits++;
|
m_rxBufferBits++;
|
||||||
|
if (m_rxBufferBits > DSTAR_BUFFER_LENGTH_BITS)
|
||||||
|
reset();
|
||||||
|
|
||||||
// A full FEC header
|
// A full FEC header
|
||||||
if (m_rxBufferBits == DSTAR_FEC_SECTION_LENGTH_BITS) {
|
if (m_rxBufferBits == DSTAR_FEC_SECTION_LENGTH_BITS) {
|
||||||
|
|
@ -343,14 +342,14 @@ void CDStarRX::processHeader(bool bit)
|
||||||
bool ok = rxHeader(m_rxBuffer, header);
|
bool ok = rxHeader(m_rxBuffer, header);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
io.setDecode(true);
|
io.setDecode(true);
|
||||||
|
|
||||||
serial.writeDStarHeader(header, DSTAR_HEADER_LENGTH_BYTES);
|
writeRSSIHeader(header);
|
||||||
|
|
||||||
::memset(m_rxBuffer, 0x00U, DSTAR_DATA_LENGTH_BYTES + 2U);
|
::memset(m_rxBuffer, 0x00U, DSTAR_DATA_LENGTH_BYTES + 2U);
|
||||||
m_rxBufferBits = 0U;
|
m_rxBufferBits = 0U;
|
||||||
|
|
||||||
m_rxState = DSRXS_DATA;
|
m_rxState = DSRXS_DATA;
|
||||||
m_dataBits = SYNC_POS - DSTAR_DATA_LENGTH_BITS + 1U;
|
m_dataBits = MAX_SYNC_BITS;
|
||||||
} else {
|
} else {
|
||||||
// The checksum failed, return to looking for syncs
|
// The checksum failed, return to looking for syncs
|
||||||
m_rxState = DSRXS_NONE;
|
m_rxState = DSRXS_NONE;
|
||||||
|
|
@ -365,13 +364,16 @@ void CDStarRX::processData(bool bit)
|
||||||
m_patternBuffer |= 0x01U;
|
m_patternBuffer |= 0x01U;
|
||||||
|
|
||||||
WRITE_BIT2(m_rxBuffer, m_rxBufferBits, bit);
|
WRITE_BIT2(m_rxBuffer, m_rxBufferBits, bit);
|
||||||
|
|
||||||
m_rxBufferBits++;
|
m_rxBufferBits++;
|
||||||
|
if (m_rxBufferBits > DSTAR_BUFFER_LENGTH_BITS)
|
||||||
|
reset();
|
||||||
|
|
||||||
// Fuzzy matching of the end frame sequences
|
// Fuzzy matching of the end frame sequences
|
||||||
if (countBits32((m_patternBuffer & END_SYNC_MASK) ^ END_SYNC_DATA) <= END_SYNC_ERRS) {
|
if (countBits64((m_patternBuffer & END_SYNC_MASK) ^ END_SYNC_DATA) <= END_SYNC_ERRS) {
|
||||||
DEBUG1("DStarRX: Found end sync in Data");
|
DEBUG1("DStarRX: Found end sync in Data");
|
||||||
io.setDecode(false);
|
io.setDecode(false);
|
||||||
|
|
||||||
serial.writeDStarEOT();
|
serial.writeDStarEOT();
|
||||||
|
|
||||||
m_rxState = DSRXS_NONE;
|
m_rxState = DSRXS_NONE;
|
||||||
|
|
@ -380,40 +382,33 @@ void CDStarRX::processData(bool bit)
|
||||||
|
|
||||||
// Fuzzy matching of the data sync bit sequence
|
// Fuzzy matching of the data sync bit sequence
|
||||||
bool syncSeen = false;
|
bool syncSeen = false;
|
||||||
if (m_dataBits >= SYNC_SCAN_START && m_dataBits <= (SYNC_POS + 1U)) {
|
if (m_rxBufferBits >= (DSTAR_DATA_LENGTH_BITS - 3U)) {
|
||||||
if (countBits32((m_patternBuffer & DATA_SYNC_MASK) ^ DATA_SYNC_DATA) <= DATA_SYNC_ERRS) {
|
if (countBits64((m_patternBuffer & DATA_SYNC_MASK) ^ DATA_SYNC_DATA) <= DATA_SYNC_ERRS) {
|
||||||
if (m_dataBits < SYNC_POS)
|
|
||||||
DEBUG2("DStarRX: found data sync in Data, early", SYNC_POS - m_dataBits);
|
|
||||||
else
|
|
||||||
DEBUG1("DStarRX: found data sync in Data");
|
|
||||||
|
|
||||||
m_rxBufferBits = DSTAR_DATA_LENGTH_BITS;
|
m_rxBufferBits = DSTAR_DATA_LENGTH_BITS;
|
||||||
m_dataBits = 0U;
|
m_dataBits = MAX_SYNC_BITS;
|
||||||
syncSeen = true;
|
syncSeen = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see if the sync is arriving late
|
// Check to see if the sync is arriving late
|
||||||
if (m_dataBits == SYNC_POS) {
|
if (m_rxBufferBits == DSTAR_DATA_LENGTH_BITS && !syncSeen) {
|
||||||
for (uint8_t i = 1U; i <= 3U; i++) {
|
for (uint8_t i = 1U; i <= 3U; i++) {
|
||||||
uint32_t syncMask = DATA_SYNC_MASK >> i;
|
uint64_t syncMask = DATA_SYNC_MASK >> i;
|
||||||
uint32_t syncData = DATA_SYNC_DATA >> i;
|
uint64_t syncData = DATA_SYNC_DATA >> i;
|
||||||
if (countBits32((m_patternBuffer & syncMask) ^ syncData) <= DATA_SYNC_ERRS) {
|
if (countBits64((m_patternBuffer & syncMask) ^ syncData) <= DATA_SYNC_ERRS) {
|
||||||
DEBUG2("DStarRX: found data sync in Data, late", i);
|
|
||||||
m_rxBufferBits -= i;
|
m_rxBufferBits -= i;
|
||||||
m_dataBits -= i;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dataBits++;
|
m_dataBits--;
|
||||||
|
|
||||||
// We've not seen a data sync for too long, signal RXLOST and change to RX_NONE
|
// We've not seen a data sync for too long, signal RXLOST and change to RX_NONE
|
||||||
if (m_dataBits >= MAX_SYNC_BITS) {
|
if (m_dataBits == 0U) {
|
||||||
DEBUG1("DStarRX: data sync timed out, lost lock");
|
DEBUG1("DStarRX: data sync timed out, lost lock");
|
||||||
io.setDecode(false);
|
io.setDecode(false);
|
||||||
|
|
||||||
serial.writeDStarLost();
|
serial.writeDStarLost();
|
||||||
|
|
||||||
m_rxState = DSRXS_NONE;
|
m_rxState = DSRXS_NONE;
|
||||||
|
|
@ -429,7 +424,7 @@ void CDStarRX::processData(bool bit)
|
||||||
writeRSSIData(m_rxBuffer);
|
writeRSSIData(m_rxBuffer);
|
||||||
} else
|
} else
|
||||||
serial.writeDStarData(m_rxBuffer, DSTAR_DATA_LENGTH_BYTES);
|
serial.writeDStarData(m_rxBuffer, DSTAR_DATA_LENGTH_BYTES);
|
||||||
|
|
||||||
io.setDecode(true);
|
io.setDecode(true);
|
||||||
|
|
||||||
// Start the next frame
|
// Start the next frame
|
||||||
|
|
@ -654,6 +649,20 @@ bool CDStarRX::checksum(const uint8_t* header) const
|
||||||
return crc8[0U] == header[DSTAR_HEADER_LENGTH_BYTES - 2U] && crc8[1U] == header[DSTAR_HEADER_LENGTH_BYTES - 1U];
|
return crc8[0U] == header[DSTAR_HEADER_LENGTH_BYTES - 2U] && crc8[1U] == header[DSTAR_HEADER_LENGTH_BYTES - 1U];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDStarRX::writeRSSIHeader(unsigned char* header)
|
||||||
|
{
|
||||||
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
uint16_t rssi = io.readRSSI();
|
||||||
|
|
||||||
|
header[41U] = (rssi >> 8) & 0xFFU;
|
||||||
|
header[42U] = (rssi >> 0) & 0xFFU;
|
||||||
|
|
||||||
|
serial.writeDStarHeader(header, DSTAR_HEADER_LENGTH_BYTES + 2U);
|
||||||
|
#else
|
||||||
|
serial.writeDStarHeader(header, DSTAR_HEADER_LENGTH_BYTES + 0U);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void CDStarRX::writeRSSIData(unsigned char* data)
|
void CDStarRX::writeRSSIData(unsigned char* data)
|
||||||
{
|
{
|
||||||
#if defined(SEND_RSSI_DATA)
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
|
|
||||||
11
DStarRX.h
11
DStarRX.h
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include "DStarDefines.h"
|
#include "DStarDefines.h"
|
||||||
|
|
||||||
|
const uint16_t DSTAR_BUFFER_LENGTH_BITS = 800U;
|
||||||
|
|
||||||
enum DSRX_STATE {
|
enum DSRX_STATE {
|
||||||
DSRXS_NONE,
|
DSRXS_NONE,
|
||||||
DSRXS_HEADER,
|
DSRXS_HEADER,
|
||||||
|
|
@ -38,8 +40,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DSRX_STATE m_rxState;
|
DSRX_STATE m_rxState;
|
||||||
uint32_t m_patternBuffer;
|
uint64_t m_patternBuffer;
|
||||||
uint8_t m_rxBuffer[100U];
|
uint8_t m_rxBuffer[DSTAR_BUFFER_LENGTH_BITS / 8U];
|
||||||
unsigned int m_rxBufferBits;
|
unsigned int m_rxBufferBits;
|
||||||
unsigned int m_dataBits;
|
unsigned int m_dataBits;
|
||||||
unsigned int m_mar;
|
unsigned int m_mar;
|
||||||
|
|
@ -58,6 +60,7 @@ private:
|
||||||
void viterbiDecode(int* data);
|
void viterbiDecode(int* data);
|
||||||
void traceBack();
|
void traceBack();
|
||||||
bool checksum(const uint8_t* header) const;
|
bool checksum(const uint8_t* header) const;
|
||||||
|
void writeRSSIHeader(unsigned char* header);
|
||||||
void writeRSSIData(unsigned char* data);
|
void writeRSSIData(unsigned char* data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
10
DStarTX.cpp
10
DStarTX.cpp
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -186,9 +186,8 @@ m_poBuffer(),
|
||||||
m_poLen(0U),
|
m_poLen(0U),
|
||||||
m_poPtr(0U),
|
m_poPtr(0U),
|
||||||
m_txDelay(60U), // 100ms
|
m_txDelay(60U), // 100ms
|
||||||
m_count(0U)
|
m_delay(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDStarTX::process()
|
void CDStarTX::process()
|
||||||
|
|
@ -201,7 +200,6 @@ void CDStarTX::process()
|
||||||
if (type == DSTAR_HEADER && m_poLen == 0U) {
|
if (type == DSTAR_HEADER && m_poLen == 0U) {
|
||||||
if (!m_tx) {
|
if (!m_tx) {
|
||||||
m_delay = true;
|
m_delay = true;
|
||||||
m_count = 0U;
|
|
||||||
m_poLen = m_txDelay;
|
m_poLen = m_txDelay;
|
||||||
} else {
|
} else {
|
||||||
m_delay = false;
|
m_delay = false;
|
||||||
|
|
@ -228,8 +226,6 @@ void CDStarTX::process()
|
||||||
|
|
||||||
if (type == DSTAR_DATA && m_poLen == 0U) {
|
if (type == DSTAR_DATA && m_poLen == 0U) {
|
||||||
m_delay = false;
|
m_delay = false;
|
||||||
if (!m_tx)
|
|
||||||
m_count = 0U;
|
|
||||||
|
|
||||||
// Pop the type byte off
|
// Pop the type byte off
|
||||||
m_buffer.get();
|
m_buffer.get();
|
||||||
|
|
@ -387,7 +383,7 @@ void CDStarTX::txHeader(const uint8_t* in, uint8_t* out) const
|
||||||
if (i < 660U) {
|
if (i < 660U) {
|
||||||
if (d & 0x08U)
|
if (d & 0x08U)
|
||||||
out[INTERLEAVE_TABLE_TX[i * 2U]] |= (0x01U << INTERLEAVE_TABLE_TX[i * 2U + 1U]);
|
out[INTERLEAVE_TABLE_TX[i * 2U]] |= (0x01U << INTERLEAVE_TABLE_TX[i * 2U + 1U]);
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (d & 0x04U)
|
if (d & 0x04U)
|
||||||
out[INTERLEAVE_TABLE_TX[i * 2U]] |= (0x01U << INTERLEAVE_TABLE_TX[i * 2U + 1U]);
|
out[INTERLEAVE_TABLE_TX[i * 2U]] |= (0x01U << INTERLEAVE_TABLE_TX[i * 2U + 1U]);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -42,7 +42,6 @@ private:
|
||||||
uint16_t m_poLen;
|
uint16_t m_poLen;
|
||||||
uint16_t m_poPtr;
|
uint16_t m_poPtr;
|
||||||
uint16_t m_txDelay; // In bytes
|
uint16_t m_txDelay; // In bytes
|
||||||
uint32_t m_count;
|
|
||||||
bool m_delay;
|
bool m_delay;
|
||||||
|
|
||||||
void txHeader(const uint8_t* in, uint8_t* out) const;
|
void txHeader(const uint8_t* in, uint8_t* out) const;
|
||||||
|
|
|
||||||
14
Debug.h
14
Debug.h
|
|
@ -19,8 +19,11 @@
|
||||||
#if !defined(DEBUG_H)
|
#if !defined(DEBUG_H)
|
||||||
#define DEBUG_H
|
#define DEBUG_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
|
|
||||||
#define DEBUG1(a) serial.writeDebug((a))
|
#define DEBUG1(a) serial.writeDebug((a))
|
||||||
#define DEBUG2(a,b) serial.writeDebug((a),(b))
|
#define DEBUG2(a,b) serial.writeDebug((a),(b))
|
||||||
#define DEBUG2I(a,b) serial.writeDebugI((a),(b))
|
#define DEBUG2I(a,b) serial.writeDebugI((a),(b))
|
||||||
|
|
@ -28,5 +31,16 @@
|
||||||
#define DEBUG4(a,b,c,d) serial.writeDebug((a),(b),(c),(d))
|
#define DEBUG4(a,b,c,d) serial.writeDebug((a),(b),(c),(d))
|
||||||
#define DEBUG5(a,b,c,d,e) serial.writeDebug((a),(b),(c),(d),(e))
|
#define DEBUG5(a,b,c,d,e) serial.writeDebug((a),(b),(c),(d),(e))
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define DEBUG1(a)
|
||||||
|
#define DEBUG2(a,b)
|
||||||
|
#define DEBUG2I(a,b)
|
||||||
|
#define DEBUG3(a,b,c) serial.writeDebug((a),(b),(c))
|
||||||
|
#define DEBUG4(a,b,c,d)
|
||||||
|
#define DEBUG5(a,b,c,d,e)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
66
Globals.h
66
Globals.h
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU
|
||||||
|
* Copyright (C) 2019 by Florian Wolters DF2ET
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -23,6 +24,12 @@
|
||||||
#if defined(STM32F10X_MD)
|
#if defined(STM32F10X_MD)
|
||||||
#include <stm32f10x.h>
|
#include <stm32f10x.h>
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
#elif defined(STM32F4XX)
|
||||||
|
#include "stm32f4xx.h"
|
||||||
|
#include "string.h"
|
||||||
|
#elif defined(STM32F7XX)
|
||||||
|
#include "stm32f7xx.h"
|
||||||
|
#include "string.h"
|
||||||
#else
|
#else
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -32,7 +39,19 @@ enum MMDVM_STATE {
|
||||||
STATE_DSTAR = 1,
|
STATE_DSTAR = 1,
|
||||||
STATE_DMR = 2,
|
STATE_DMR = 2,
|
||||||
STATE_YSF = 3,
|
STATE_YSF = 3,
|
||||||
STATE_P25 = 4
|
STATE_P25 = 4,
|
||||||
|
STATE_NXDN = 5,
|
||||||
|
STATE_POCSAG = 6,
|
||||||
|
STATE_M17 = 7,
|
||||||
|
|
||||||
|
// Dummy states start at 90
|
||||||
|
STATE_DMRDMO1K = 92,
|
||||||
|
STATE_RSSICAL = 96,
|
||||||
|
STATE_CWID = 97,
|
||||||
|
STATE_DMRCAL = 98,
|
||||||
|
STATE_DSTARCAL = 99,
|
||||||
|
STATE_INTCAL = 100,
|
||||||
|
STATE_POCSAGCAL = 101
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t MARK_SLOT1 = 0x08U;
|
const uint8_t MARK_SLOT1 = 0x08U;
|
||||||
|
|
@ -59,21 +78,36 @@ const uint8_t MARK_NONE = 0x00U;
|
||||||
#include "YSFTX.h"
|
#include "YSFTX.h"
|
||||||
#include "P25RX.h"
|
#include "P25RX.h"
|
||||||
#include "P25TX.h"
|
#include "P25TX.h"
|
||||||
|
#include "M17RX.h"
|
||||||
|
#include "M17TX.h"
|
||||||
|
#include "NXDNRX.h"
|
||||||
|
#include "NXDNTX.h"
|
||||||
|
#include "POCSAGTX.h"
|
||||||
|
#include "CWIdTX.h"
|
||||||
|
#include "CalRSSI.h"
|
||||||
|
#include "CalDMR.h"
|
||||||
#include "Debug.h"
|
#include "Debug.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
#include "I2CHost.h"
|
||||||
const uint16_t TX_RINGBUFFER_SIZE = 1024U;
|
|
||||||
const uint16_t RX_RINGBUFFER_SIZE = 1024U;
|
|
||||||
|
|
||||||
extern MMDVM_STATE m_modemState;
|
extern MMDVM_STATE m_modemState;
|
||||||
|
extern MMDVM_STATE m_calState;
|
||||||
extern MMDVM_STATE m_modemState_prev;
|
extern MMDVM_STATE m_modemState_prev;
|
||||||
|
|
||||||
|
extern bool m_cwid_state;
|
||||||
|
extern bool m_pocsag_state;
|
||||||
|
|
||||||
|
extern uint8_t m_cwIdTXLevel;
|
||||||
|
|
||||||
extern uint32_t m_modeTimerCnt;
|
extern uint32_t m_modeTimerCnt;
|
||||||
|
|
||||||
extern bool m_dstarEnable;
|
extern bool m_dstarEnable;
|
||||||
extern bool m_dmrEnable;
|
extern bool m_dmrEnable;
|
||||||
extern bool m_ysfEnable;
|
extern bool m_ysfEnable;
|
||||||
extern bool m_p25Enable;
|
extern bool m_p25Enable;
|
||||||
|
extern bool m_nxdnEnable;
|
||||||
|
extern bool m_m17Enable;
|
||||||
|
extern bool m_pocsagEnable;
|
||||||
|
|
||||||
extern bool m_duplex;
|
extern bool m_duplex;
|
||||||
|
|
||||||
|
|
@ -103,5 +137,25 @@ extern CYSFTX ysfTX;
|
||||||
extern CP25RX p25RX;
|
extern CP25RX p25RX;
|
||||||
extern CP25TX p25TX;
|
extern CP25TX p25TX;
|
||||||
|
|
||||||
|
extern CM17RX m17RX;
|
||||||
|
extern CM17TX m17TX;
|
||||||
|
|
||||||
|
extern CNXDNRX nxdnRX;
|
||||||
|
extern CNXDNTX nxdnTX;
|
||||||
|
|
||||||
|
extern CPOCSAGTX pocsagTX;
|
||||||
|
|
||||||
|
extern CCalDMR calDMR;
|
||||||
|
|
||||||
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
extern CCalRSSI calRSSI;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern CCWIdTX cwIdTX;
|
||||||
|
|
||||||
|
#if defined(STM32_I2C_HOST)
|
||||||
|
extern CI2CHost i2c;
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
201
I2CHost.cpp
Normal file
201
I2CHost.cpp
Normal file
|
|
@ -0,0 +1,201 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
#if defined(STM32_I2C_HOST)
|
||||||
|
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "I2CHost.h"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
void I2C2_EV_IRQHandler(void) {
|
||||||
|
i2c.I2C_EVHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
void I2C2_ER_IRQHandler(void) {
|
||||||
|
if (I2C_GetITStatus(I2C2, I2C_IT_AF)) {
|
||||||
|
I2C_ClearITPendingBit(I2C2, I2C_IT_AF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CI2CHost::CI2CHost()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CI2CHost::Init(void)
|
||||||
|
{
|
||||||
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
I2C_InitTypeDef I2C_InitStructure;
|
||||||
|
|
||||||
|
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C2, ENABLE);
|
||||||
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
|
||||||
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
|
||||||
|
|
||||||
|
// Configure I2C GPIOs
|
||||||
|
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11;
|
||||||
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
|
||||||
|
GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||||
|
|
||||||
|
// Configure the I2C event interrupt
|
||||||
|
NVIC_InitStructure.NVIC_IRQChannel = I2C2_EV_IRQn;
|
||||||
|
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 15;
|
||||||
|
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15;
|
||||||
|
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
||||||
|
NVIC_Init(&NVIC_InitStructure);
|
||||||
|
|
||||||
|
// Configure the I2C error interrupt
|
||||||
|
NVIC_InitStructure.NVIC_IRQChannel = I2C2_ER_IRQn;
|
||||||
|
NVIC_Init(&NVIC_InitStructure);
|
||||||
|
|
||||||
|
// I2C configuration
|
||||||
|
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
|
||||||
|
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
|
||||||
|
I2C_InitStructure.I2C_OwnAddress1 = I2C_ADDR << 1;
|
||||||
|
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
|
||||||
|
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
|
||||||
|
I2C_InitStructure.I2C_ClockSpeed = I2C_CLK_FREQ;
|
||||||
|
|
||||||
|
// Enable I2C
|
||||||
|
I2C_Cmd(I2C2, ENABLE);
|
||||||
|
// Apply I2C configuration
|
||||||
|
I2C_Init(I2C2, &I2C_InitStructure);
|
||||||
|
|
||||||
|
I2C_ITConfig(I2C2, I2C_IT_EVT, ENABLE);
|
||||||
|
I2C_ITConfig(I2C2, I2C_IT_BUF, ENABLE);
|
||||||
|
I2C_ITConfig(I2C2, I2C_IT_ERR, ENABLE);
|
||||||
|
|
||||||
|
// Initialize the FIFOs
|
||||||
|
txFIFO_head = 0U;
|
||||||
|
txFIFO_tail = 0U;
|
||||||
|
rxFIFO_head = 0U;
|
||||||
|
rxFIFO_tail = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CI2CHost::I2C_EVHandler(void) {
|
||||||
|
uint32_t event = I2C_GetLastEvent(I2C2);
|
||||||
|
|
||||||
|
switch (event) {
|
||||||
|
case I2C_EVENT_SLAVE_RECEIVER_ADDRESS_MATCHED:
|
||||||
|
break;
|
||||||
|
case I2C_EVENT_SLAVE_BYTE_RECEIVED:
|
||||||
|
if (rxFIFO_level() < I2C_RX_FIFO_SIZE) {
|
||||||
|
rxFIFO[rxFIFO_head] = I2C_ReceiveData(I2C2);
|
||||||
|
rxFIFO_head++;
|
||||||
|
if (rxFIFO_head >= I2C_RX_FIFO_SIZE)
|
||||||
|
rxFIFO_head = 0U;
|
||||||
|
} else
|
||||||
|
I2C_ReceiveData(I2C2);
|
||||||
|
break;
|
||||||
|
case I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED:
|
||||||
|
case I2C_EVENT_SLAVE_BYTE_TRANSMITTED:
|
||||||
|
if (txFIFO_level() > 0) {
|
||||||
|
I2C_SendData(I2C2, txFIFO[txFIFO_tail]);
|
||||||
|
txFIFO_tail++;
|
||||||
|
if (txFIFO_tail >= I2C_TX_FIFO_SIZE)
|
||||||
|
txFIFO_tail = 0U;
|
||||||
|
} else
|
||||||
|
I2C_SendData(I2C2, 0U);
|
||||||
|
break;
|
||||||
|
case I2C_EVENT_SLAVE_STOP_DETECTED:
|
||||||
|
I2C2_ClearFlag();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CI2CHost::I2C2_ClearFlag(void) {
|
||||||
|
// Clear ADDR flag
|
||||||
|
while((I2C2->SR1 & I2C_SR1_ADDR) == I2C_SR1_ADDR) {
|
||||||
|
I2C2->SR1;
|
||||||
|
I2C2->SR2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear STOPF flag
|
||||||
|
while((I2C2->SR1 & I2C_SR1_STOPF) == I2C_SR1_STOPF) {
|
||||||
|
I2C2->SR1;
|
||||||
|
I2C2->CR1 |= 0x1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t CI2CHost::txFIFO_level(void)
|
||||||
|
{
|
||||||
|
uint32_t tail = txFIFO_tail;
|
||||||
|
uint32_t head = txFIFO_head;
|
||||||
|
|
||||||
|
if (tail > head)
|
||||||
|
return I2C_TX_FIFO_SIZE + head - tail;
|
||||||
|
else
|
||||||
|
return head - tail;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t CI2CHost::rxFIFO_level(void)
|
||||||
|
{
|
||||||
|
uint32_t tail = rxFIFO_tail;
|
||||||
|
uint32_t head = rxFIFO_head;
|
||||||
|
|
||||||
|
if (tail > head)
|
||||||
|
return I2C_RX_FIFO_SIZE + head - tail;
|
||||||
|
else
|
||||||
|
return head - tail;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t CI2CHost::txFIFO_put(uint8_t next)
|
||||||
|
{
|
||||||
|
if (txFIFO_level() < I2C_TX_FIFO_SIZE) {
|
||||||
|
txFIFO[txFIFO_head] = next;
|
||||||
|
|
||||||
|
txFIFO_head++;
|
||||||
|
if (txFIFO_head >= I2C_TX_FIFO_SIZE)
|
||||||
|
txFIFO_head = 0U;
|
||||||
|
return 1U;
|
||||||
|
} else {
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CI2CHost::AvailI2C(void)
|
||||||
|
{
|
||||||
|
if (rxFIFO_level() > 0U)
|
||||||
|
return 1U;
|
||||||
|
else
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t CI2CHost::ReadI2C(void)
|
||||||
|
{
|
||||||
|
uint8_t data_c = rxFIFO[rxFIFO_tail];
|
||||||
|
|
||||||
|
rxFIFO_tail++;
|
||||||
|
if (rxFIFO_tail >= I2C_RX_FIFO_SIZE)
|
||||||
|
rxFIFO_tail = 0U;
|
||||||
|
|
||||||
|
return data_c;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CI2CHost::WriteI2C(const uint8_t* data, uint16_t length)
|
||||||
|
{
|
||||||
|
for (uint16_t i = 0U; i < length; i++)
|
||||||
|
txFIFO_put(data[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
55
I2CHost.h
Normal file
55
I2CHost.h
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(I2CHost_H)
|
||||||
|
#define I2CHost_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
#if defined(STM32_I2C_HOST)
|
||||||
|
|
||||||
|
#define I2C_CLK_FREQ 100000U
|
||||||
|
#define I2C_TX_FIFO_SIZE 512U
|
||||||
|
#define I2C_RX_FIFO_SIZE 512U
|
||||||
|
|
||||||
|
class CI2CHost {
|
||||||
|
public:
|
||||||
|
CI2CHost();
|
||||||
|
|
||||||
|
void Init(void);
|
||||||
|
void I2C_EVHandler(void);
|
||||||
|
uint8_t AvailI2C(void);
|
||||||
|
uint8_t ReadI2C(void);
|
||||||
|
void WriteI2C(const uint8_t* data, uint16_t length);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void I2C2_ClearFlag(void);
|
||||||
|
uint16_t txFIFO_level(void);
|
||||||
|
uint16_t rxFIFO_level(void);
|
||||||
|
uint8_t txFIFO_put(uint8_t next);
|
||||||
|
|
||||||
|
volatile uint8_t txFIFO[I2C_TX_FIFO_SIZE];
|
||||||
|
volatile uint8_t rxFIFO[I2C_RX_FIFO_SIZE];
|
||||||
|
volatile uint16_t txFIFO_head, txFIFO_tail;
|
||||||
|
volatile uint16_t rxFIFO_head, rxFIFO_tail;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
259
IO.cpp
259
IO.cpp
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015, 2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
* Copyright (C) 2017 by Danilo DB4PLE
|
* Copyright (C) 2017 by Danilo DB4PLE
|
||||||
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
|
@ -17,29 +17,32 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "IO.h"
|
#include "IO.h"
|
||||||
|
|
||||||
uint32_t m_frequency_rx;
|
uint32_t m_frequency_rx;
|
||||||
uint32_t m_frequency_tx;
|
uint32_t m_frequency_tx;
|
||||||
|
uint32_t m_pocsag_freq_tx;
|
||||||
uint8_t m_power;
|
uint8_t m_power;
|
||||||
|
|
||||||
CIO::CIO():
|
CIO::CIO():
|
||||||
m_started(false),
|
m_started(false),
|
||||||
m_rxBuffer(RX_RINGBUFFER_SIZE),
|
m_rxBuffer(1024U),
|
||||||
m_txBuffer(TX_RINGBUFFER_SIZE),
|
m_txBuffer(1024U),
|
||||||
m_LoDevYSF(false),
|
m_LoDevYSF(false),
|
||||||
m_ledCount(0U),
|
m_ledCount(0U),
|
||||||
m_scanEnable(false),
|
m_scanEnable(false),
|
||||||
m_scanPauseCnt(0U),
|
m_scanPauseCnt(0U),
|
||||||
m_scanPos(0U),
|
m_scanPos(0U),
|
||||||
m_ledValue(true),
|
m_ledValue(true),
|
||||||
m_watchdog(0U)
|
m_watchdog(0U),
|
||||||
|
m_int1counter(0U),
|
||||||
|
m_int2counter(0U)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
CE_pin(HIGH);
|
CE_pin(HIGH);
|
||||||
LED_pin(HIGH);
|
LED_pin(HIGH);
|
||||||
PTT_pin(LOW);
|
PTT_pin(LOW);
|
||||||
|
|
@ -47,6 +50,9 @@ m_watchdog(0U)
|
||||||
DMR_pin(LOW);
|
DMR_pin(LOW);
|
||||||
YSF_pin(LOW);
|
YSF_pin(LOW);
|
||||||
P25_pin(LOW);
|
P25_pin(LOW);
|
||||||
|
NXDN_pin(LOW);
|
||||||
|
M17_pin(LOW);
|
||||||
|
POCSAG_pin(LOW);
|
||||||
COS_pin(LOW);
|
COS_pin(LOW);
|
||||||
DEB_pin(LOW);
|
DEB_pin(LOW);
|
||||||
|
|
||||||
|
|
@ -60,18 +66,18 @@ m_watchdog(0U)
|
||||||
|
|
||||||
selfTest();
|
selfTest();
|
||||||
|
|
||||||
m_modeTimerCnt = 0;
|
m_modeTimerCnt = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::selfTest()
|
void CIO::selfTest()
|
||||||
{
|
{
|
||||||
bool ledValue = false;
|
bool ledValue = false;
|
||||||
uint32_t ledCount = 0;
|
uint32_t ledCount = 0U;
|
||||||
uint32_t blinks = 0;
|
uint32_t blinks = 0U;
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
ledCount++;
|
ledCount++;
|
||||||
delay_us(1000);
|
delay_us(1000U);
|
||||||
|
|
||||||
if(ledCount >= 125U) {
|
if(ledCount >= 125U) {
|
||||||
ledCount = 0U;
|
ledCount = 0U;
|
||||||
|
|
@ -83,11 +89,14 @@ void CIO::selfTest()
|
||||||
DMR_pin(ledValue);
|
DMR_pin(ledValue);
|
||||||
YSF_pin(ledValue);
|
YSF_pin(ledValue);
|
||||||
P25_pin(ledValue);
|
P25_pin(ledValue);
|
||||||
|
NXDN_pin(ledValue);
|
||||||
|
M17_pin(ledValue);
|
||||||
|
POCSAG_pin(ledValue);
|
||||||
COS_pin(ledValue);
|
COS_pin(ledValue);
|
||||||
|
|
||||||
blinks++;
|
blinks++;
|
||||||
|
|
||||||
if(blinks > 5)
|
if(blinks > 5U)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -98,13 +107,13 @@ void CIO::process()
|
||||||
uint8_t bit;
|
uint8_t bit;
|
||||||
uint32_t scantime;
|
uint32_t scantime;
|
||||||
uint8_t control;
|
uint8_t control;
|
||||||
|
|
||||||
m_ledCount++;
|
m_ledCount++;
|
||||||
|
|
||||||
if (m_started) {
|
if (m_started) {
|
||||||
// Two seconds timeout
|
// Two seconds timeout
|
||||||
if (m_watchdog >= 19200U) {
|
if (m_watchdog >= 19200U) {
|
||||||
if (m_modemState == STATE_DSTAR || m_modemState == STATE_DMR || m_modemState == STATE_YSF || m_modemState == STATE_P25) {
|
if (m_modemState == STATE_DSTAR || m_modemState == STATE_DMR || m_modemState == STATE_YSF || m_modemState == STATE_P25 || m_modemState == STATE_NXDN || m_modemState == STATE_M17) {
|
||||||
m_modemState = STATE_IDLE;
|
m_modemState = STATE_IDLE;
|
||||||
setMode(m_modemState);
|
setMode(m_modemState);
|
||||||
}
|
}
|
||||||
|
|
@ -112,11 +121,29 @@ void CIO::process()
|
||||||
m_watchdog = 0U;
|
m_watchdog = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONSTANT_SRV_LED)
|
||||||
|
LED_pin(HIGH);
|
||||||
|
#elif defined(CONSTANT_SRV_LED_INVERTED)
|
||||||
|
LED_pin(LOW);
|
||||||
|
#elif defined(DISCREET_SRV_LED)
|
||||||
|
if (m_ledCount == 10000U) LED_pin(LOW);
|
||||||
|
if (m_ledCount >= 480000U) {
|
||||||
|
m_ledCount = 0U;
|
||||||
|
LED_pin(HIGH);
|
||||||
|
};
|
||||||
|
#elif defined(DISCREET_SRV_LED_INVERTED)
|
||||||
|
if (m_ledCount == 10000U) LED_pin(HIGH);
|
||||||
|
if (m_ledCount >= 480000U) {
|
||||||
|
m_ledCount = 0U;
|
||||||
|
LED_pin(LOW);
|
||||||
|
};
|
||||||
|
#else
|
||||||
if (m_ledCount >= 24000U) {
|
if (m_ledCount >= 24000U) {
|
||||||
m_ledCount = 0U;
|
m_ledCount = 0U;
|
||||||
m_ledValue = !m_ledValue;
|
m_ledValue = !m_ledValue;
|
||||||
LED_pin(m_ledValue);
|
LED_pin(m_ledValue);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (m_ledCount >= 240000U) {
|
if (m_ledCount >= 240000U) {
|
||||||
m_ledCount = 0U;
|
m_ledCount = 0U;
|
||||||
|
|
@ -127,24 +154,41 @@ void CIO::process()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch off the transmitter if needed
|
// Switch off the transmitter if needed
|
||||||
if (m_txBuffer.getData() == 0U && m_tx)
|
if (m_txBuffer.getData() == 0U && m_tx) {
|
||||||
|
if(m_cwid_state) { // check for CW ID end of transmission
|
||||||
|
m_cwid_state = false;
|
||||||
|
// Restoring previous mode
|
||||||
|
if (m_TotalModes)
|
||||||
|
io.ifConf(m_modemState_prev, true);
|
||||||
|
}
|
||||||
|
if(m_pocsag_state) { // check for POCSAG end of transmission
|
||||||
|
m_pocsag_state = false;
|
||||||
|
// Restoring previous mode
|
||||||
|
if (m_TotalModes)
|
||||||
|
io.ifConf(m_modemState_prev, true);
|
||||||
|
}
|
||||||
setRX(false);
|
setRX(false);
|
||||||
|
}
|
||||||
|
|
||||||
if(m_modemState_prev == STATE_DSTAR)
|
if(m_modemState_prev == STATE_DSTAR)
|
||||||
scantime = SCAN_TIME;
|
scantime = SCAN_TIME;
|
||||||
else if(m_modemState_prev == STATE_DMR)
|
else if(m_modemState_prev == STATE_DMR)
|
||||||
scantime = SCAN_TIME*2;
|
scantime = SCAN_TIME * 2U;
|
||||||
else if(m_modemState_prev == STATE_YSF)
|
else if(m_modemState_prev == STATE_YSF)
|
||||||
scantime = SCAN_TIME;
|
scantime = SCAN_TIME;
|
||||||
else if(m_modemState_prev == STATE_P25)
|
else if(m_modemState_prev == STATE_P25)
|
||||||
scantime = SCAN_TIME;
|
scantime = SCAN_TIME;
|
||||||
|
else if(m_modemState_prev == STATE_NXDN)
|
||||||
|
scantime = SCAN_TIME;
|
||||||
|
else if(m_modemState_prev == STATE_M17)
|
||||||
|
scantime = SCAN_TIME;
|
||||||
else
|
else
|
||||||
scantime = SCAN_TIME;
|
scantime = SCAN_TIME;
|
||||||
|
|
||||||
if(m_modeTimerCnt >= scantime) {
|
if(m_modeTimerCnt >= scantime) {
|
||||||
m_modeTimerCnt = 0;
|
m_modeTimerCnt = 0U;
|
||||||
if( (m_modemState == STATE_IDLE) && (m_scanPauseCnt == 0) && m_scanEnable) {
|
if( (m_modemState == STATE_IDLE) && (m_scanPauseCnt == 0U) && m_scanEnable && !m_cwid_state && !m_pocsag_state) {
|
||||||
m_scanPos = (m_scanPos + 1) % m_TotalModes;
|
m_scanPos = (m_scanPos + 1U) % m_TotalModes;
|
||||||
#if !defined(QUIET_MODE_LEDS)
|
#if !defined(QUIET_MODE_LEDS)
|
||||||
setMode(m_Modes[m_scanPos]);
|
setMode(m_Modes[m_scanPos]);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -154,7 +198,7 @@ void CIO::process()
|
||||||
|
|
||||||
if (m_rxBuffer.getData() >= 1U) {
|
if (m_rxBuffer.getData() >= 1U) {
|
||||||
m_rxBuffer.get(bit, control);
|
m_rxBuffer.get(bit, control);
|
||||||
|
|
||||||
switch (m_modemState_prev) {
|
switch (m_modemState_prev) {
|
||||||
case STATE_DSTAR:
|
case STATE_DSTAR:
|
||||||
dstarRX.databit(bit);
|
dstarRX.databit(bit);
|
||||||
|
|
@ -178,6 +222,12 @@ void CIO::process()
|
||||||
case STATE_P25:
|
case STATE_P25:
|
||||||
p25RX.databit(bit);
|
p25RX.databit(bit);
|
||||||
break;
|
break;
|
||||||
|
case STATE_NXDN:
|
||||||
|
nxdnRX.databit(bit);
|
||||||
|
break;
|
||||||
|
case STATE_M17:
|
||||||
|
m17RX.databit(bit);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -186,9 +236,9 @@ void CIO::process()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::start()
|
void CIO::start()
|
||||||
{
|
{
|
||||||
m_TotalModes = 0;
|
m_TotalModes = 0U;
|
||||||
|
|
||||||
if(m_dstarEnable) {
|
if(m_dstarEnable) {
|
||||||
m_Modes[m_TotalModes] = STATE_DSTAR;
|
m_Modes[m_TotalModes] = STATE_DSTAR;
|
||||||
m_TotalModes++;
|
m_TotalModes++;
|
||||||
|
|
@ -205,9 +255,17 @@ void CIO::start()
|
||||||
m_Modes[m_TotalModes] = STATE_P25;
|
m_Modes[m_TotalModes] = STATE_P25;
|
||||||
m_TotalModes++;
|
m_TotalModes++;
|
||||||
}
|
}
|
||||||
|
if(m_nxdnEnable) {
|
||||||
|
m_Modes[m_TotalModes] = STATE_NXDN;
|
||||||
|
m_TotalModes++;
|
||||||
|
}
|
||||||
|
if(m_m17Enable) {
|
||||||
|
m_Modes[m_TotalModes] = STATE_M17;
|
||||||
|
m_TotalModes++;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_SCAN_MODE)
|
#if defined(ENABLE_SCAN_MODE)
|
||||||
if(m_TotalModes > 1)
|
if(m_TotalModes > 1U)
|
||||||
m_scanEnable = true;
|
m_scanEnable = true;
|
||||||
else {
|
else {
|
||||||
m_scanEnable = false;
|
m_scanEnable = false;
|
||||||
|
|
@ -220,9 +278,9 @@ void CIO::start()
|
||||||
|
|
||||||
if (m_started)
|
if (m_started)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
startInt();
|
startInt();
|
||||||
|
|
||||||
m_started = true;
|
m_started = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -237,7 +295,7 @@ void CIO::write(uint8_t* data, uint16_t length, const uint8_t* control)
|
||||||
else
|
else
|
||||||
m_txBuffer.put(data[i], control[i]);
|
m_txBuffer.put(data[i], control[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch the transmitter on if needed
|
// Switch the transmitter on if needed
|
||||||
if (!m_tx) {
|
if (!m_tx) {
|
||||||
setTX();
|
setTX();
|
||||||
|
|
@ -260,35 +318,146 @@ bool CIO::hasRXOverflow()
|
||||||
return m_rxBuffer.hasOverflowed();
|
return m_rxBuffer.hasOverflowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx)
|
#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS)
|
||||||
{
|
void CIO::checkBand(uint32_t frequency_rx, uint32_t frequency_tx) {
|
||||||
// power level
|
if (!(io.hasSingleADF7021())) {
|
||||||
m_power = 0xFF;
|
// There are two ADF7021s on the board
|
||||||
|
if (io.isDualBand()) {
|
||||||
|
// Dual band
|
||||||
|
if ((frequency_tx <= VHF2_MAX) && (frequency_rx <= VHF2_MAX)) {
|
||||||
|
// Turn on VHF side
|
||||||
|
io.setBandVHF(true);
|
||||||
|
} else if ((frequency_tx >= UHF1_MIN) && (frequency_rx >= UHF1_MIN)) {
|
||||||
|
// Turn on UHF side
|
||||||
|
io.setBandVHF(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CIO::checkZUMspot(uint32_t frequency_rx, uint32_t frequency_tx) {
|
||||||
|
if (!(io.hasSingleADF7021())) {
|
||||||
|
// There are two ADF7021s on the board
|
||||||
|
if (io.isDualBand()) {
|
||||||
|
// Dual band
|
||||||
|
if ((frequency_tx <= VHF2_MAX) && (frequency_rx <= VHF2_MAX)) {
|
||||||
|
// Turn on VHF side
|
||||||
|
io.setBandVHF(true);
|
||||||
|
} else if ((frequency_tx >= UHF1_MIN) && (frequency_rx >= UHF1_MIN)) {
|
||||||
|
// Turn on UHF side
|
||||||
|
io.setBandVHF(false);
|
||||||
|
}
|
||||||
|
} else if (!io.isDualBand()) {
|
||||||
|
// Duplex board
|
||||||
|
if ((frequency_tx < UHF1_MIN) || (frequency_rx < UHF1_MIN)) {
|
||||||
|
// Reject VHF frequencies
|
||||||
|
return 4U;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint8_t CIO::setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_power, uint32_t pocsag_freq_tx)
|
||||||
|
{
|
||||||
|
// Configure power level
|
||||||
|
setPower(rf_power);
|
||||||
|
|
||||||
|
#if !defined(DISABLE_FREQ_CHECK)
|
||||||
|
// Check frequency ranges
|
||||||
if( !( ((frequency_rx >= VHF1_MIN)&&(frequency_rx < VHF1_MAX)) || ((frequency_tx >= VHF1_MIN)&&(frequency_tx < VHF1_MAX)) || \
|
if( !( ((frequency_rx >= VHF1_MIN)&&(frequency_rx < VHF1_MAX)) || ((frequency_tx >= VHF1_MIN)&&(frequency_tx < VHF1_MAX)) || \
|
||||||
((frequency_rx >= UHF1_MIN)&&(frequency_rx < UHF1_MAX)) || ((frequency_tx >= UHF1_MIN)&&(frequency_tx < UHF1_MAX)) || \
|
((frequency_rx >= UHF1_MIN)&&(frequency_rx < UHF1_MAX)) || ((frequency_tx >= UHF1_MIN)&&(frequency_tx < UHF1_MAX)) || \
|
||||||
((frequency_rx >= VHF2_MIN)&&(frequency_rx < VHF2_MAX)) || ((frequency_tx >= VHF2_MIN)&&(frequency_tx < VHF2_MAX)) || \
|
((frequency_rx >= VHF2_MIN)&&(frequency_rx < VHF2_MAX)) || ((frequency_tx >= VHF2_MIN)&&(frequency_tx < VHF2_MAX)) || \
|
||||||
((frequency_rx >= UHF2_MIN)&&(frequency_rx < UHF2_MAX)) || ((frequency_tx >= UHF2_MIN)&&(frequency_tx < UHF2_MAX)) ) )
|
((frequency_rx >= UHF2_MIN)&&(frequency_rx < UHF2_MAX)) || ((frequency_tx >= UHF2_MIN)&&(frequency_tx < UHF2_MAX)) ) )
|
||||||
return 4U;
|
return 4U;
|
||||||
|
|
||||||
|
if( !( ((pocsag_freq_tx >= VHF1_MIN)&&(pocsag_freq_tx < VHF1_MAX)) || \
|
||||||
|
((pocsag_freq_tx >= UHF1_MIN)&&(pocsag_freq_tx < UHF1_MAX)) || \
|
||||||
|
((pocsag_freq_tx >= VHF2_MIN)&&(pocsag_freq_tx < VHF2_MAX)) || \
|
||||||
|
((pocsag_freq_tx >= UHF2_MIN)&&(pocsag_freq_tx < UHF2_MAX)) ) )
|
||||||
|
return 4U;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(DISABLE_FREQ_BAN)
|
||||||
|
// Check banned frequency ranges
|
||||||
|
if( ((frequency_rx >= BAN1_MIN)&&(frequency_rx <= BAN1_MAX)) || ((frequency_tx >= BAN1_MIN)&&(frequency_tx <= BAN1_MAX)) || \
|
||||||
|
((frequency_rx >= BAN2_MIN)&&(frequency_rx <= BAN2_MAX)) || ((frequency_tx >= BAN2_MIN)&&(frequency_tx <= BAN2_MAX)) )
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
if( ((pocsag_freq_tx >= BAN1_MIN)&&(pocsag_freq_tx <= BAN1_MAX)) || \
|
||||||
|
((pocsag_freq_tx >= BAN2_MIN)&&(pocsag_freq_tx <= BAN2_MAX)) )
|
||||||
|
return 4U;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Check if we have a single, dualband or duplex board
|
||||||
|
#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS)
|
||||||
|
if (checkZUMspot(frequency_rx, frequency_tx) > 0) {
|
||||||
|
return 4U;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Configure frequency
|
||||||
m_frequency_rx = frequency_rx;
|
m_frequency_rx = frequency_rx;
|
||||||
m_frequency_tx = frequency_tx;
|
m_frequency_tx = frequency_tx;
|
||||||
|
m_pocsag_freq_tx = pocsag_freq_tx;
|
||||||
|
|
||||||
return 0U;
|
return 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::setMode(MMDVM_STATE modemState)
|
void CIO::setMode(MMDVM_STATE modemState)
|
||||||
{
|
{
|
||||||
DSTAR_pin(modemState == STATE_DSTAR);
|
#if defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||||
DMR_pin(modemState == STATE_DMR);
|
if (modemState != STATE_POCSAG) {
|
||||||
YSF_pin(modemState == STATE_YSF);
|
#endif
|
||||||
P25_pin(modemState == STATE_P25);
|
DSTAR_pin(modemState == STATE_DSTAR);
|
||||||
|
DMR_pin(modemState == STATE_DMR);
|
||||||
|
#if defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(USE_ALTERNATE_NXDN_LEDS)
|
||||||
|
if (modemState != STATE_NXDN) {
|
||||||
|
#endif
|
||||||
|
YSF_pin(modemState == STATE_YSF);
|
||||||
|
P25_pin(modemState == STATE_P25);
|
||||||
|
#if defined(USE_ALTERNATE_NXDN_LEDS)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(USE_ALTERNATE_M17_LEDS)
|
||||||
|
if (modemState != STATE_M17) {
|
||||||
|
#endif
|
||||||
|
YSF_pin(modemState == STATE_YSF);
|
||||||
|
P25_pin(modemState == STATE_P25);
|
||||||
|
#if defined(USE_ALTERNATE_M17_LEDS)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(USE_ALTERNATE_NXDN_LEDS)
|
||||||
|
if (modemState != STATE_YSF && modemState != STATE_P25) {
|
||||||
|
#endif
|
||||||
|
NXDN_pin(modemState == STATE_NXDN);
|
||||||
|
#if defined(USE_ALTERNATE_NXDN_LEDS)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||||
|
if (modemState != STATE_DSTAR && modemState != STATE_DMR) {
|
||||||
|
#endif
|
||||||
|
POCSAG_pin(modemState == STATE_POCSAG);
|
||||||
|
#if defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(USE_ALTERNATE_M17_LEDS)
|
||||||
|
if (modemState != STATE_DSTAR && modemState != STATE_P25) {
|
||||||
|
#endif
|
||||||
|
M17_pin(modemState == STATE_M17);
|
||||||
|
#if defined(USE_ALTERNATE_M17_LEDS)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::setDecode(bool dcd)
|
void CIO::setDecode(bool dcd)
|
||||||
{
|
{
|
||||||
if (dcd != m_dcd) {
|
if (dcd != m_dcd) {
|
||||||
m_scanPauseCnt = 1;
|
m_scanPauseCnt = 1U;
|
||||||
COS_pin(dcd ? true : false);
|
COS_pin(dcd ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -309,3 +478,11 @@ uint32_t CIO::getWatchdog()
|
||||||
{
|
{
|
||||||
return m_watchdog;
|
return m_watchdog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CIO::getIntCounter(uint16_t &int1, uint16_t &int2)
|
||||||
|
{
|
||||||
|
int1 = m_int1counter;
|
||||||
|
int2 = m_int2counter;
|
||||||
|
m_int1counter = 0U;
|
||||||
|
m_int2counter = 0U;
|
||||||
|
}
|
||||||
|
|
|
||||||
69
IO.h
69
IO.h
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015, 2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
* Copyright (C) 2017 by Danilo DB4PLE
|
* Copyright (C) 2017 by Danilo DB4PLE
|
||||||
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#define LOW 0
|
#define LOW 0
|
||||||
#define HIGH 1
|
#define HIGH 1
|
||||||
|
|
||||||
|
// HS frequency ranges
|
||||||
#define VHF1_MIN 144000000
|
#define VHF1_MIN 144000000
|
||||||
#define VHF1_MAX 148000000
|
#define VHF1_MAX 148000000
|
||||||
#define VHF2_MIN 219000000
|
#define VHF2_MIN 219000000
|
||||||
|
|
@ -37,11 +38,32 @@
|
||||||
#define UHF2_MIN 842000000
|
#define UHF2_MIN 842000000
|
||||||
#define UHF2_MAX 950000000
|
#define UHF2_MAX 950000000
|
||||||
|
|
||||||
|
// Banned amateur frequency ranges (satellite only, ISS, etc)
|
||||||
|
#define BAN1_MIN 145800000
|
||||||
|
#define BAN1_MAX 146000000
|
||||||
|
#define BAN2_MIN 435000000
|
||||||
|
#define BAN2_MAX 438000000
|
||||||
|
|
||||||
#define SCAN_TIME 1920
|
#define SCAN_TIME 1920
|
||||||
#define SCAN_PAUSE 20000
|
#define SCAN_PAUSE 20000
|
||||||
|
|
||||||
|
#if defined(DUPLEX)
|
||||||
|
#if defined(STM32_USB_HOST)
|
||||||
|
#define CAL_DLY_LOOP 98950U
|
||||||
|
#else
|
||||||
|
#define CAL_DLY_LOOP 96100U
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if defined(STM32_USB_HOST)
|
||||||
|
#define CAL_DLY_LOOP 110850U
|
||||||
|
#else
|
||||||
|
#define CAL_DLY_LOOP 104600U
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
extern uint32_t m_frequency_rx;
|
extern uint32_t m_frequency_rx;
|
||||||
extern uint32_t m_frequency_tx;
|
extern uint32_t m_frequency_tx;
|
||||||
|
extern uint32_t m_pocsag_freq_tx;
|
||||||
extern uint8_t m_power;
|
extern uint8_t m_power;
|
||||||
|
|
||||||
class CIO {
|
class CIO {
|
||||||
|
|
@ -62,7 +84,7 @@ public:
|
||||||
void CE_pin(bool on);
|
void CE_pin(bool on);
|
||||||
bool RXD_pin(void);
|
bool RXD_pin(void);
|
||||||
bool CLK_pin(void);
|
bool CLK_pin(void);
|
||||||
|
|
||||||
#if defined(BIDIR_DATA_PIN)
|
#if defined(BIDIR_DATA_PIN)
|
||||||
void RXD_pin_write(bool on);
|
void RXD_pin_write(bool on);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -75,12 +97,15 @@ public:
|
||||||
void DMR_pin(bool on);
|
void DMR_pin(bool on);
|
||||||
void YSF_pin(bool on);
|
void YSF_pin(bool on);
|
||||||
void P25_pin(bool on);
|
void P25_pin(bool on);
|
||||||
|
void NXDN_pin(bool on);
|
||||||
|
void M17_pin(bool on);
|
||||||
|
void POCSAG_pin(bool on);
|
||||||
void COS_pin(bool on);
|
void COS_pin(bool on);
|
||||||
void interrupt(void);
|
void interrupt(void);
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
void interrupt2(void);
|
void interrupt2(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BIDIR_DATA_PIN)
|
#if defined(BIDIR_DATA_PIN)
|
||||||
void Data_dir_out(bool dir);
|
void Data_dir_out(bool dir);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -91,13 +116,22 @@ public:
|
||||||
void process(void);
|
void process(void);
|
||||||
bool hasTXOverflow(void);
|
bool hasTXOverflow(void);
|
||||||
bool hasRXOverflow(void);
|
bool hasRXOverflow(void);
|
||||||
uint8_t setFreq(uint32_t frequency_rx, uint32_t frequency_tx);
|
uint8_t setFreq(uint32_t frequency_rx, uint32_t frequency_tx, uint8_t rf_power, uint32_t pocsag_freq_tx);
|
||||||
|
void setPower(uint8_t power);
|
||||||
void setMode(MMDVM_STATE modemState);
|
void setMode(MMDVM_STATE modemState);
|
||||||
void setDecode(bool dcd);
|
void setDecode(bool dcd);
|
||||||
void setLoDevYSF(bool ysfLoDev);
|
void setLoDevYSF(bool ysfLoDev);
|
||||||
void resetWatchdog(void);
|
void resetWatchdog(void);
|
||||||
uint32_t getWatchdog(void);
|
uint32_t getWatchdog(void);
|
||||||
|
void getIntCounter(uint16_t &int1, uint16_t &int2);
|
||||||
void selfTest(void);
|
void selfTest(void);
|
||||||
|
#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS)
|
||||||
|
void checkBand(uint32_t frequency_rx, uint32_t frequency_tx);
|
||||||
|
uint8_t checkZUMspot(uint32_t frequency_rx, uint32_t frequency_tx);
|
||||||
|
void setBandVHF(bool vhf_on);
|
||||||
|
bool hasSingleADF7021(void);
|
||||||
|
bool isDualBand(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
// RF interface API
|
// RF interface API
|
||||||
void setTX(void);
|
void setTX(void);
|
||||||
|
|
@ -108,7 +142,9 @@ public:
|
||||||
#endif
|
#endif
|
||||||
void start(void);
|
void start(void);
|
||||||
void startInt(void);
|
void startInt(void);
|
||||||
|
void setDeviations(uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel, uint8_t p25TXLevel, uint8_t nxdnTXLevel, uint8_t m17TXLevel, uint8_t pocsagTXLevel, bool ysfLoDev);
|
||||||
|
void updateCal(void);
|
||||||
|
|
||||||
#if defined(SEND_RSSI_DATA)
|
#if defined(SEND_RSSI_DATA)
|
||||||
uint16_t readRSSI(void);
|
uint16_t readRSSI(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -118,21 +154,26 @@ public:
|
||||||
void delay_IFcal(void);
|
void delay_IFcal(void);
|
||||||
void delay_reset(void);
|
void delay_reset(void);
|
||||||
void delay_us(uint32_t us);
|
void delay_us(uint32_t us);
|
||||||
|
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
uint32_t RXfreq(void);
|
uint32_t RXfreq(void);
|
||||||
uint32_t TXfreq(void);
|
uint32_t TXfreq(void);
|
||||||
uint16_t devDSTAR(void);
|
uint16_t devDSTAR(void);
|
||||||
uint16_t devDMR(void);
|
uint16_t devDMR(void);
|
||||||
uint16_t devYSF_H(void);
|
uint16_t devYSF(void);
|
||||||
uint16_t devYSF_L(void);
|
|
||||||
uint16_t devP25(void);
|
uint16_t devP25(void);
|
||||||
|
uint16_t devNXDN(void);
|
||||||
|
uint16_t devM17(void);
|
||||||
|
uint16_t devPOCSAG(void);
|
||||||
void printConf();
|
void printConf();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t m_RX_N_divider;
|
uint8_t m_RX_N_divider;
|
||||||
uint16_t m_RX_F_divider;
|
uint16_t m_RX_F_divider;
|
||||||
uint8_t m_TX_N_divider;
|
uint8_t m_TX_N_divider;
|
||||||
uint16_t m_TX_F_divider;
|
uint16_t m_TX_F_divider;
|
||||||
|
|
||||||
bool m_started;
|
bool m_started;
|
||||||
CBitRB m_rxBuffer;
|
CBitRB m_rxBuffer;
|
||||||
CBitRB m_txBuffer;
|
CBitRB m_txBuffer;
|
||||||
|
|
@ -142,9 +183,11 @@ private:
|
||||||
uint32_t m_scanPauseCnt;
|
uint32_t m_scanPauseCnt;
|
||||||
uint8_t m_scanPos;
|
uint8_t m_scanPos;
|
||||||
uint8_t m_TotalModes;
|
uint8_t m_TotalModes;
|
||||||
MMDVM_STATE m_Modes[4];
|
MMDVM_STATE m_Modes[6];
|
||||||
bool m_ledValue;
|
bool m_ledValue;
|
||||||
volatile uint32_t m_watchdog;
|
volatile uint32_t m_watchdog;
|
||||||
|
volatile uint16_t m_int1counter;
|
||||||
|
volatile uint16_t m_int2counter;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
121
IOArduino.cpp
121
IOArduino.cpp
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015, 2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
* Copyright (C) 2017 by Danilo DB4PLE
|
* Copyright (C) 2017 by Danilo DB4PLE
|
||||||
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
// STM32F1 pin definitions, using STM32duino
|
// STM32F1 pin definitions, using STM32duino
|
||||||
|
|
||||||
#if defined(PI_HAT_7021_REV_03)
|
#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS)
|
||||||
|
|
||||||
#define PIN_SCLK PB5
|
#define PIN_SCLK PB5
|
||||||
#define PIN_SREAD PB6
|
#define PIN_SREAD PB6
|
||||||
|
|
@ -37,9 +37,9 @@
|
||||||
#define PIN_SLE2 PA6
|
#define PIN_SLE2 PA6
|
||||||
#define PIN_CE PC14
|
#define PIN_CE PC14
|
||||||
#define PIN_RXD PB4
|
#define PIN_RXD PB4
|
||||||
#define PIN_RXD2 PA4
|
#define PIN_RXD2 PA11
|
||||||
#define PIN_TXD PB3
|
#define PIN_TXD PB3
|
||||||
#define PIN_TXD2 PA5
|
#define PIN_TXD2 PA8
|
||||||
#define PIN_CLKOUT PA15
|
#define PIN_CLKOUT PA15
|
||||||
#define PIN_LED PC13
|
#define PIN_LED PC13
|
||||||
#define PIN_DEB PB9
|
#define PIN_DEB PB9
|
||||||
|
|
@ -47,10 +47,16 @@
|
||||||
#define PIN_DMR_LED PB13
|
#define PIN_DMR_LED PB13
|
||||||
#define PIN_YSF_LED PB1
|
#define PIN_YSF_LED PB1
|
||||||
#define PIN_P25_LED PB0
|
#define PIN_P25_LED PB0
|
||||||
|
#if defined(STM32_USB_HOST)
|
||||||
|
#define PIN_NXDN_LED PA1
|
||||||
|
#else
|
||||||
|
#define PIN_NXDN_LED PA7
|
||||||
|
#endif
|
||||||
|
#define PIN_POCSAG_LED PA5
|
||||||
#define PIN_PTT_LED PB14
|
#define PIN_PTT_LED PB14
|
||||||
#define PIN_COS_LED PB15
|
#define PIN_COS_LED PB15
|
||||||
|
|
||||||
#elif defined(ADF7021_CARRIER_BOARD) || defined(MMDVM_HS_HAT_REV12)
|
#elif defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10)
|
||||||
|
|
||||||
#define PIN_SCLK PB5
|
#define PIN_SCLK PB5
|
||||||
#define PIN_SREAD PB7
|
#define PIN_SREAD PB7
|
||||||
|
|
@ -69,52 +75,58 @@
|
||||||
#define PIN_DMR_LED PB13
|
#define PIN_DMR_LED PB13
|
||||||
#define PIN_YSF_LED PB1
|
#define PIN_YSF_LED PB1
|
||||||
#define PIN_P25_LED PB0
|
#define PIN_P25_LED PB0
|
||||||
|
#define PIN_NXDN_LED PA8
|
||||||
|
#define PIN_POCSAG_LED PA7
|
||||||
#define PIN_PTT_LED PB14
|
#define PIN_PTT_LED PB14
|
||||||
#define PIN_COS_LED PB15
|
#define PIN_COS_LED PB15
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error "Either PI_HAT_7021_REV_03 or ADF7021_CARRIER_BOARD or MMDVM_HS_HAT_REV12 need to be defined"
|
#error "Either ZUMSPOT_ADF7021, LONESTAR_USB, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT, NANO_DV_REV10 or SKYBRIDGE_HS need to be defined"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
#elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||||
|
|
||||||
// Teensy pin definitions
|
// Teensy pin definitions
|
||||||
#define PIN_SCLK 2
|
#define PIN_SCLK 2
|
||||||
#define PIN_SDATA 3
|
#define PIN_SDATA 3
|
||||||
#define PIN_SREAD 4
|
#define PIN_SREAD 4
|
||||||
#define PIN_SLE 5
|
#define PIN_SLE 5
|
||||||
#define PIN_CE 6
|
#define PIN_CE 6
|
||||||
#define PIN_RXD 7
|
#define PIN_RXD 7
|
||||||
#define PIN_TXD 8
|
#define PIN_TXD 8
|
||||||
#define PIN_CLKOUT 22
|
#define PIN_CLKOUT 22
|
||||||
#define PIN_LED 13
|
#define PIN_LED 13
|
||||||
#define PIN_DEB 23
|
#define PIN_DEB 23
|
||||||
#define PIN_DSTAR_LED 16
|
#define PIN_DSTAR_LED 16
|
||||||
#define PIN_DMR_LED 17
|
#define PIN_DMR_LED 17
|
||||||
#define PIN_YSF_LED 18
|
#define PIN_YSF_LED 18
|
||||||
#define PIN_P25_LED 19
|
#define PIN_P25_LED 19
|
||||||
#define PIN_PTT_LED 14
|
#define PIN_NXDN_LED 20
|
||||||
#define PIN_COS_LED 15
|
#define PIN_POCSAG_LED 21
|
||||||
|
#define PIN_PTT_LED 14
|
||||||
|
#define PIN_COS_LED 15
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Arduino pin definitions (Due and Zero)
|
// Arduino pin definitions (Due and Zero)
|
||||||
#define PIN_SCLK 3
|
#define PIN_SCLK 3
|
||||||
#define PIN_SDATA 4 // 2 in Arduino Zero Pro
|
#define PIN_SDATA 4 // 2 in Arduino Zero Pro
|
||||||
#define PIN_SREAD 5
|
#define PIN_SREAD 5
|
||||||
#define PIN_SLE 6
|
#define PIN_SLE 6
|
||||||
#define PIN_CE 12
|
#define PIN_CE 12
|
||||||
#define PIN_RXD 7
|
#define PIN_RXD 7
|
||||||
#define PIN_TXD 8
|
#define PIN_TXD 8
|
||||||
#define PIN_CLKOUT 2 // 4 in Arduino Zero Pro
|
#define PIN_CLKOUT 2 // 4 in Arduino Zero Pro
|
||||||
#define PIN_LED 13
|
#define PIN_LED 13
|
||||||
#define PIN_DEB 11
|
#define PIN_DEB 11
|
||||||
#define PIN_DSTAR_LED 14
|
#define PIN_DSTAR_LED 14
|
||||||
#define PIN_DMR_LED 15
|
#define PIN_DMR_LED 15
|
||||||
#define PIN_YSF_LED 16
|
#define PIN_YSF_LED 16
|
||||||
#define PIN_P25_LED 17
|
#define PIN_P25_LED 17
|
||||||
#define PIN_PTT_LED 9
|
#define PIN_NXDN_LED 18
|
||||||
#define PIN_COS_LED 10
|
#define PIN_POCSAG_LED 19
|
||||||
|
#define PIN_PTT_LED 9
|
||||||
|
#define PIN_COS_LED 10
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -144,12 +156,12 @@ void CIO::Init()
|
||||||
{
|
{
|
||||||
#if defined (__STM32F1__)
|
#if defined (__STM32F1__)
|
||||||
|
|
||||||
#if defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(MMDVM_HS_HAT_REV12)
|
#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV10) || defined(SKYBRIDGE_HS)
|
||||||
afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY);
|
afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pinMode(PIN_SCLK, OUTPUT);
|
pinMode(PIN_SCLK, OUTPUT);
|
||||||
pinMode(PIN_SDATA, OUTPUT);
|
pinMode(PIN_SDATA, OUTPUT);
|
||||||
pinMode(PIN_SREAD, INPUT);
|
pinMode(PIN_SREAD, INPUT);
|
||||||
|
|
@ -163,21 +175,22 @@ void CIO::Init()
|
||||||
pinMode(PIN_DMR_LED, OUTPUT);
|
pinMode(PIN_DMR_LED, OUTPUT);
|
||||||
pinMode(PIN_YSF_LED, OUTPUT);
|
pinMode(PIN_YSF_LED, OUTPUT);
|
||||||
pinMode(PIN_P25_LED, OUTPUT);
|
pinMode(PIN_P25_LED, OUTPUT);
|
||||||
|
pinMode(PIN_NXDN_LED, OUTPUT);
|
||||||
|
pinMode(PIN_POCSAG_LED, OUTPUT);
|
||||||
pinMode(PIN_PTT_LED, OUTPUT);
|
pinMode(PIN_PTT_LED, OUTPUT);
|
||||||
pinMode(PIN_COS_LED, OUTPUT);
|
pinMode(PIN_COS_LED, OUTPUT);
|
||||||
|
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
pinMode(PIN_SLE2, OUTPUT);
|
pinMode(PIN_SLE2, OUTPUT);
|
||||||
pinMode(PIN_RXD2, INPUT);
|
pinMode(PIN_RXD2, INPUT);
|
||||||
pinMode(PIN_TXD2, INPUT);
|
pinMode(PIN_TXD2, INPUT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BIDIR_DATA_PIN)
|
#if defined(BIDIR_DATA_PIN)
|
||||||
pinMode(PIN_TXD, INPUT);
|
pinMode(PIN_TXD, INPUT);
|
||||||
#else
|
#else
|
||||||
pinMode(PIN_TXD, OUTPUT);
|
pinMode(PIN_TXD, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::startInt()
|
void CIO::startInt()
|
||||||
|
|
@ -306,6 +319,26 @@ void CIO::P25_pin(bool on)
|
||||||
digitalWrite(PIN_P25_LED, on ? HIGH : LOW);
|
digitalWrite(PIN_P25_LED, on ? HIGH : LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CIO::NXDN_pin(bool on)
|
||||||
|
{
|
||||||
|
#if defined(USE_ALTERNATE_NXDN_LEDS)
|
||||||
|
digitalWrite(PIN_YSF_LED, on ? HIGH : LOW);
|
||||||
|
digitalWrite(PIN_P25_LED, on ? HIGH : LOW);
|
||||||
|
#else
|
||||||
|
digitalWrite(PIN_NXDN_LED, on ? HIGH : LOW);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CIO::POCSAG_pin(bool on)
|
||||||
|
{
|
||||||
|
#if defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||||
|
digitalWrite(PIN_DSTAR_LED, on ? HIGH : LOW);
|
||||||
|
digitalWrite(PIN_DMR_LED, on ? HIGH : LOW);
|
||||||
|
#else
|
||||||
|
digitalWrite(PIN_POCSAG_LED, on ? HIGH : LOW);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void CIO::PTT_pin(bool on)
|
void CIO::PTT_pin(bool on)
|
||||||
{
|
{
|
||||||
digitalWrite(PIN_PTT_LED, on ? HIGH : LOW);
|
digitalWrite(PIN_PTT_LED, on ? HIGH : LOW);
|
||||||
|
|
|
||||||
237
IOSTM.cpp
237
IOSTM.cpp
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016 by Jim McLaughlin KI6ZUM
|
* Copyright (C) 2016 by Jim McLaughlin KI6ZUM
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
* Copyright (C) 2017 by Danilo DB4PLE
|
* Copyright (C) 2017 by Danilo DB4PLE
|
||||||
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
|
@ -80,13 +81,23 @@
|
||||||
#define PIN_P25_LED GPIO_Pin_12
|
#define PIN_P25_LED GPIO_Pin_12
|
||||||
#define PORT_P25_LED GPIOA
|
#define PORT_P25_LED GPIOA
|
||||||
|
|
||||||
|
#define PIN_NXDN_LED GPIO_Pin_8
|
||||||
|
#define PORT_NXDN_LED GPIOA
|
||||||
|
|
||||||
|
// XXX FIXME
|
||||||
|
#define PIN_M17_LED GPIO_Pin_8
|
||||||
|
#define PORT_M17_LED GPIOA
|
||||||
|
|
||||||
|
#define PIN_POCSAG_LED GPIO_Pin_5
|
||||||
|
#define PORT_POCSAG_LED GPIOA
|
||||||
|
|
||||||
#define PIN_PTT_LED GPIO_Pin_12
|
#define PIN_PTT_LED GPIO_Pin_12
|
||||||
#define PORT_PTT_LED GPIOB
|
#define PORT_PTT_LED GPIOB
|
||||||
|
|
||||||
#define PIN_COS_LED GPIO_Pin_13
|
#define PIN_COS_LED GPIO_Pin_13
|
||||||
#define PORT_COS_LED GPIOB
|
#define PORT_COS_LED GPIOB
|
||||||
|
|
||||||
#elif defined(PI_HAT_7021_REV_03)
|
#elif defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS) || defined(LONESTAR_USB)
|
||||||
|
|
||||||
#define PIN_SCLK GPIO_Pin_5
|
#define PIN_SCLK GPIO_Pin_5
|
||||||
#define PORT_SCLK GPIOB
|
#define PORT_SCLK GPIOB
|
||||||
|
|
@ -109,6 +120,15 @@
|
||||||
#define PIN_RXD GPIO_Pin_4
|
#define PIN_RXD GPIO_Pin_4
|
||||||
#define PORT_RXD GPIOB
|
#define PORT_RXD GPIOB
|
||||||
|
|
||||||
|
#define PIN_SGL_DBL GPIO_Pin_12
|
||||||
|
#define PORT_SGL_DBL GPIOA
|
||||||
|
|
||||||
|
#define PIN_DL_DPX GPIO_Pin_15
|
||||||
|
#define PORT_DL_DPX GPIOC
|
||||||
|
|
||||||
|
#define PIN_SET_BAND GPIO_Pin_15
|
||||||
|
#define PORT_SET_BAND GPIOA
|
||||||
|
|
||||||
// TXD used in SPI Data mode of ADF7021
|
// TXD used in SPI Data mode of ADF7021
|
||||||
// TXD is TxRxCLK of ADF7021, standard TX/RX data interface
|
// TXD is TxRxCLK of ADF7021, standard TX/RX data interface
|
||||||
#define PIN_TXD GPIO_Pin_3
|
#define PIN_TXD GPIO_Pin_3
|
||||||
|
|
@ -116,6 +136,17 @@
|
||||||
#define PIN_TXD_INT GPIO_PinSource3
|
#define PIN_TXD_INT GPIO_PinSource3
|
||||||
#define PORT_TXD_INT GPIO_PortSourceGPIOB
|
#define PORT_TXD_INT GPIO_PortSourceGPIOB
|
||||||
|
|
||||||
|
#if defined(DUPLEX)
|
||||||
|
#define PIN_RXD2 GPIO_Pin_11
|
||||||
|
#define PORT_RXD2 GPIOA
|
||||||
|
|
||||||
|
// TXD2 is TxRxCLK of the second ADF7021, standard TX/RX data interface
|
||||||
|
#define PIN_TXD2 GPIO_Pin_8
|
||||||
|
#define PORT_TXD2 GPIOA
|
||||||
|
#define PIN_TXD2_INT GPIO_PinSource8
|
||||||
|
#define PORT_TXD2_INT GPIO_PortSourceGPIOA
|
||||||
|
#endif
|
||||||
|
|
||||||
// CLKOUT used in SPI Data mode of ADF7021
|
// CLKOUT used in SPI Data mode of ADF7021
|
||||||
#define PIN_CLKOUT GPIO_Pin_15
|
#define PIN_CLKOUT GPIO_Pin_15
|
||||||
#define PORT_CLKOUT GPIOA
|
#define PORT_CLKOUT GPIOA
|
||||||
|
|
@ -140,13 +171,31 @@
|
||||||
#define PIN_P25_LED GPIO_Pin_0
|
#define PIN_P25_LED GPIO_Pin_0
|
||||||
#define PORT_P25_LED GPIOB
|
#define PORT_P25_LED GPIOB
|
||||||
|
|
||||||
|
#if defined(STM32_USB_HOST)
|
||||||
|
#define PIN_NXDN_LED GPIO_Pin_1
|
||||||
|
#else
|
||||||
|
#define PIN_NXDN_LED GPIO_Pin_7
|
||||||
|
#endif
|
||||||
|
#define PORT_NXDN_LED GPIOA
|
||||||
|
|
||||||
|
// XXX FIXME
|
||||||
|
#if defined(STM32_USB_HOST)
|
||||||
|
#define PIN_M17_LED GPIO_Pin_1
|
||||||
|
#else
|
||||||
|
#define PIN_M17_LED GPIO_Pin_7
|
||||||
|
#endif
|
||||||
|
#define PORT_M17_LED GPIOA
|
||||||
|
|
||||||
|
#define PIN_POCSAG_LED GPIO_Pin_5
|
||||||
|
#define PORT_POCSAG_LED GPIOA
|
||||||
|
|
||||||
#define PIN_PTT_LED GPIO_Pin_14
|
#define PIN_PTT_LED GPIO_Pin_14
|
||||||
#define PORT_PTT_LED GPIOB
|
#define PORT_PTT_LED GPIOB
|
||||||
|
|
||||||
#define PIN_COS_LED GPIO_Pin_15
|
#define PIN_COS_LED GPIO_Pin_15
|
||||||
#define PORT_COS_LED GPIOB
|
#define PORT_COS_LED GPIOB
|
||||||
|
|
||||||
#elif defined(ADF7021_CARRIER_BOARD) || defined(MMDVM_HS_HAT_REV12)
|
#elif defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS)
|
||||||
|
|
||||||
#define PIN_SCLK GPIO_Pin_5
|
#define PIN_SCLK GPIO_Pin_5
|
||||||
#define PORT_SCLK GPIOB
|
#define PORT_SCLK GPIOB
|
||||||
|
|
@ -209,6 +258,16 @@
|
||||||
#define PIN_P25_LED GPIO_Pin_0
|
#define PIN_P25_LED GPIO_Pin_0
|
||||||
#define PORT_P25_LED GPIOB
|
#define PORT_P25_LED GPIOB
|
||||||
|
|
||||||
|
#define PIN_NXDN_LED GPIO_Pin_8
|
||||||
|
#define PORT_NXDN_LED GPIOA
|
||||||
|
|
||||||
|
// XXX FIXME
|
||||||
|
#define PIN_M17_LED GPIO_Pin_8
|
||||||
|
#define PORT_M17_LED GPIOA
|
||||||
|
|
||||||
|
#define PIN_POCSAG_LED GPIO_Pin_7
|
||||||
|
#define PORT_POCSAG_LED GPIOA
|
||||||
|
|
||||||
#define PIN_PTT_LED GPIO_Pin_14
|
#define PIN_PTT_LED GPIO_Pin_14
|
||||||
#define PORT_PTT_LED GPIOB
|
#define PORT_PTT_LED GPIOB
|
||||||
|
|
||||||
|
|
@ -216,7 +275,7 @@
|
||||||
#define PORT_COS_LED GPIOB
|
#define PORT_COS_LED GPIOB
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error "Either PI_HAT_7021_REV_02, PI_HAT_7021_REV_03,ADF7021_CARRIER_BOARD or MMDVM_HS_HAT_REV12 need to be defined"
|
#error "Either PI_HAT_7021_REV_02, ZUMSPOT_ADF7021, LONESTAR_USB, LIBRE_KIT_ADF7021, MMDVM_HS_HAT_REV12, MMDVM_HS_DUAL_HAT_REV10, NANO_HOTSPOT, NANO_DV_REV11, D2RG_MMDVM_HS or SKYBRIDGE_HS need to be defined"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
@ -238,7 +297,7 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(MMDVM_HS_HAT_REV12)
|
#elif defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS)
|
||||||
|
|
||||||
#if defined(BIDIR_DATA_PIN)
|
#if defined(BIDIR_DATA_PIN)
|
||||||
void EXTI3_IRQHandler(void) {
|
void EXTI3_IRQHandler(void) {
|
||||||
|
|
@ -258,10 +317,17 @@ extern "C" {
|
||||||
|
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
void EXTI9_5_IRQHandler(void) {
|
void EXTI9_5_IRQHandler(void) {
|
||||||
|
#if defined(ZUMSPOT_ADF7021) || defined(SKYBRIDGE_HS)
|
||||||
|
if(EXTI_GetITStatus(EXTI_Line8)!=RESET) {
|
||||||
|
io.interrupt2();
|
||||||
|
EXTI_ClearITPendingBit(EXTI_Line8);
|
||||||
|
}
|
||||||
|
#else
|
||||||
if(EXTI_GetITStatus(EXTI_Line5)!=RESET) {
|
if(EXTI_GetITStatus(EXTI_Line5)!=RESET) {
|
||||||
io.interrupt2();
|
io.interrupt2();
|
||||||
EXTI_ClearITPendingBit(EXTI_Line5);
|
EXTI_ClearITPendingBit(EXTI_Line5);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -269,42 +335,73 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::Init()
|
void CIO::Init()
|
||||||
{
|
{
|
||||||
// USB Conf IO:
|
GPIO_InitTypeDef GPIO_InitStruct;
|
||||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO, ENABLE);
|
GPIO_StructInit(&GPIO_InitStruct);
|
||||||
|
|
||||||
#if defined(PI_HAT_7021_REV_02)
|
|
||||||
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);
|
|
||||||
#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(MMDVM_HS_HAT_REV12)
|
|
||||||
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_1Div5);
|
|
||||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE);
|
|
||||||
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
|
|
||||||
|
|
||||||
EXTI_InitTypeDef EXTI_InitStructure;
|
EXTI_InitTypeDef EXTI_InitStructure;
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
EXTI_InitTypeDef EXTI_InitStructure2;
|
EXTI_InitTypeDef EXTI_InitStructure2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GPIO_InitTypeDef GPIO_InitStruct;
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO, ENABLE);
|
||||||
GPIO_StructInit(&GPIO_InitStruct);
|
|
||||||
|
|
||||||
// Pin PA12 = LOW, USB Reset in generic boards
|
#if defined(PI_HAT_7021_REV_02)
|
||||||
|
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);
|
||||||
|
#elif defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS)
|
||||||
|
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS)
|
||||||
|
// Pin defines if the board has a single ADF7021 or double
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_12;
|
GPIO_InitStruct.GPIO_Pin = PIN_SGL_DBL;
|
||||||
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
|
||||||
|
GPIO_Init(PORT_SGL_DBL, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
// Pin defines if the board is dual band or duplex
|
||||||
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
|
GPIO_InitStruct.GPIO_Pin = PIN_DL_DPX;
|
||||||
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
|
||||||
|
GPIO_Init(PORT_DL_DPX, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
// Pin will set UHF or VHF
|
||||||
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
|
GPIO_InitStruct.GPIO_Pin = PIN_SET_BAND;
|
||||||
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
|
GPIO_Init(PORT_SET_BAND, &GPIO_InitStruct);
|
||||||
|
// TODO: Remove this line
|
||||||
|
// GPIO_WriteBit(PORT_SET_BAND, PIN_SET_BAND, Bit_RESET);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(STM32_USB_HOST)
|
||||||
|
// Pin PA11,PA12 = LOW, USB Reset
|
||||||
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
|
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12;
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
GPIO_Init(GPIOA, &GPIO_InitStruct);
|
GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
GPIO_WriteBit(GPIOA, GPIO_Pin_11, Bit_RESET);
|
||||||
GPIO_WriteBit(GPIOA, GPIO_Pin_12, Bit_RESET);
|
GPIO_WriteBit(GPIOA, GPIO_Pin_12, Bit_RESET);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LONG_USB_RESET)
|
||||||
|
// 10 ms delay
|
||||||
|
delay_us(10000U);
|
||||||
|
#else
|
||||||
volatile unsigned int delay;
|
volatile unsigned int delay;
|
||||||
for(delay = 0;delay<512;delay++);
|
for(delay = 0;delay<512;delay++);
|
||||||
|
#endif
|
||||||
|
|
||||||
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_12;
|
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12;
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||||
GPIO_Init(GPIOA, &GPIO_InitStruct);
|
GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_1Div5);
|
||||||
|
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE);
|
||||||
|
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
|
||||||
|
|
||||||
// Pin SCLK
|
// Pin SCLK
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_SCLK;
|
GPIO_InitStruct.GPIO_Pin = PIN_SCLK;
|
||||||
|
|
@ -316,7 +413,7 @@ void CIO::Init()
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_SDATA;
|
GPIO_InitStruct.GPIO_Pin = PIN_SDATA;
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
GPIO_Init(PORT_SDATA, &GPIO_InitStruct);
|
GPIO_Init(PORT_SDATA, &GPIO_InitStruct);
|
||||||
|
|
||||||
// Pin SREAD
|
// Pin SREAD
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_SREAD;
|
GPIO_InitStruct.GPIO_Pin = PIN_SREAD;
|
||||||
|
|
@ -328,14 +425,14 @@ void CIO::Init()
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_SLE;
|
GPIO_InitStruct.GPIO_Pin = PIN_SLE;
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
GPIO_Init(PORT_SLE, &GPIO_InitStruct);
|
GPIO_Init(PORT_SLE, &GPIO_InitStruct);
|
||||||
|
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
// Pin SLE2
|
// Pin SLE2
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_SLE2;
|
GPIO_InitStruct.GPIO_Pin = PIN_SLE2;
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
GPIO_Init(PORT_SLE2, &GPIO_InitStruct);
|
GPIO_Init(PORT_SLE2, &GPIO_InitStruct);
|
||||||
|
|
||||||
// Pin RXD2
|
// Pin RXD2
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_RXD2;
|
GPIO_InitStruct.GPIO_Pin = PIN_RXD2;
|
||||||
|
|
@ -366,6 +463,7 @@ void CIO::Init()
|
||||||
#endif
|
#endif
|
||||||
GPIO_Init(PORT_TXD, &GPIO_InitStruct);
|
GPIO_Init(PORT_TXD, &GPIO_InitStruct);
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
|
GPIO_InitStruct.GPIO_Pin = PIN_TXD2;
|
||||||
GPIO_Init(PORT_TXD2, &GPIO_InitStruct);
|
GPIO_Init(PORT_TXD2, &GPIO_InitStruct);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -376,7 +474,7 @@ void CIO::Init()
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||||
GPIO_Init(PORT_CLKOUT, &GPIO_InitStruct);
|
GPIO_Init(PORT_CLKOUT, &GPIO_InitStruct);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Pin LED
|
// Pin LED
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_LED;
|
GPIO_InitStruct.GPIO_Pin = PIN_LED;
|
||||||
|
|
@ -389,37 +487,49 @@ void CIO::Init()
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
GPIO_Init(PORT_DEB, &GPIO_InitStruct);
|
GPIO_Init(PORT_DEB, &GPIO_InitStruct);
|
||||||
|
|
||||||
// D-Star LED
|
// D-Star LED
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_DSTAR_LED;
|
GPIO_InitStruct.GPIO_Pin = PIN_DSTAR_LED;
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
GPIO_Init(PORT_DSTAR_LED, &GPIO_InitStruct);
|
GPIO_Init(PORT_DSTAR_LED, &GPIO_InitStruct);
|
||||||
|
|
||||||
// DMR LED
|
// DMR LED
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_DMR_LED;
|
GPIO_InitStruct.GPIO_Pin = PIN_DMR_LED;
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
GPIO_Init(PORT_DMR_LED, &GPIO_InitStruct);
|
GPIO_Init(PORT_DMR_LED, &GPIO_InitStruct);
|
||||||
|
|
||||||
// YSF LED
|
// YSF LED
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_YSF_LED;
|
GPIO_InitStruct.GPIO_Pin = PIN_YSF_LED;
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
GPIO_Init(PORT_YSF_LED, &GPIO_InitStruct);
|
GPIO_Init(PORT_YSF_LED, &GPIO_InitStruct);
|
||||||
|
|
||||||
// P25 LED
|
// P25 LED
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_P25_LED;
|
GPIO_InitStruct.GPIO_Pin = PIN_P25_LED;
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
GPIO_Init(PORT_P25_LED, &GPIO_InitStruct);
|
GPIO_Init(PORT_P25_LED, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
// NXDN LED
|
||||||
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
|
GPIO_InitStruct.GPIO_Pin = PIN_NXDN_LED;
|
||||||
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
|
GPIO_Init(PORT_NXDN_LED, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
// POCSAG LED
|
||||||
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
|
GPIO_InitStruct.GPIO_Pin = PIN_POCSAG_LED;
|
||||||
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
|
GPIO_Init(PORT_POCSAG_LED, &GPIO_InitStruct);
|
||||||
|
|
||||||
// PTT LED
|
// PTT LED
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_PTT_LED;
|
GPIO_InitStruct.GPIO_Pin = PIN_PTT_LED;
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
GPIO_Init(PORT_PTT_LED, &GPIO_InitStruct);
|
GPIO_Init(PORT_PTT_LED, &GPIO_InitStruct);
|
||||||
|
|
||||||
// COS LED
|
// COS LED
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_COS_LED;
|
GPIO_InitStruct.GPIO_Pin = PIN_COS_LED;
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
|
|
@ -439,7 +549,7 @@ void CIO::Init()
|
||||||
EXTI_InitStructure.EXTI_Line = EXTI_Line14;
|
EXTI_InitStructure.EXTI_Line = EXTI_Line14;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(MMDVM_HS_HAT_REV12)
|
#elif defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS)
|
||||||
|
|
||||||
#if defined(BIDIR_DATA_PIN)
|
#if defined(BIDIR_DATA_PIN)
|
||||||
// Connect EXTI3 Line
|
// Connect EXTI3 Line
|
||||||
|
|
@ -457,7 +567,11 @@ void CIO::Init()
|
||||||
// Connect EXTI5 Line
|
// Connect EXTI5 Line
|
||||||
GPIO_EXTILineConfig(PORT_TXD2_INT, PIN_TXD2_INT);
|
GPIO_EXTILineConfig(PORT_TXD2_INT, PIN_TXD2_INT);
|
||||||
// Configure EXT5 line
|
// Configure EXT5 line
|
||||||
|
#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS)
|
||||||
|
EXTI_InitStructure2.EXTI_Line = EXTI_Line8;
|
||||||
|
#else
|
||||||
EXTI_InitStructure2.EXTI_Line = EXTI_Line5;
|
EXTI_InitStructure2.EXTI_Line = EXTI_Line5;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -466,7 +580,7 @@ void CIO::Init()
|
||||||
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
|
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
|
||||||
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
|
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
|
||||||
EXTI_Init(&EXTI_InitStructure);
|
EXTI_Init(&EXTI_InitStructure);
|
||||||
|
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
EXTI_InitStructure2.EXTI_Mode = EXTI_Mode_Interrupt;
|
EXTI_InitStructure2.EXTI_Mode = EXTI_Mode_Interrupt;
|
||||||
EXTI_InitStructure2.EXTI_Trigger = EXTI_Trigger_Rising;
|
EXTI_InitStructure2.EXTI_Trigger = EXTI_Trigger_Rising;
|
||||||
|
|
@ -478,7 +592,7 @@ void CIO::Init()
|
||||||
void CIO::startInt()
|
void CIO::startInt()
|
||||||
{
|
{
|
||||||
NVIC_InitTypeDef NVIC_InitStructure;
|
NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
NVIC_InitTypeDef NVIC_InitStructure2;
|
NVIC_InitTypeDef NVIC_InitStructure2;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -487,7 +601,7 @@ void CIO::startInt()
|
||||||
|
|
||||||
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
|
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
|
||||||
|
|
||||||
#elif defined(PI_HAT_7021_REV_03) || defined(ADF7021_CARRIER_BOARD) || defined(MMDVM_HS_HAT_REV12)
|
#elif defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) || defined(D2RG_MMDVM_HS) || defined(SKYBRIDGE_HS)
|
||||||
|
|
||||||
#if defined(BIDIR_DATA_PIN)
|
#if defined(BIDIR_DATA_PIN)
|
||||||
// Enable and set EXTI3 Interrupt
|
// Enable and set EXTI3 Interrupt
|
||||||
|
|
@ -507,7 +621,7 @@ void CIO::startInt()
|
||||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15;
|
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
||||||
NVIC_Init(&NVIC_InitStructure);
|
NVIC_Init(&NVIC_InitStructure);
|
||||||
|
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
NVIC_InitStructure2.NVIC_IRQChannelPreemptionPriority = 1;
|
NVIC_InitStructure2.NVIC_IRQChannelPreemptionPriority = 1;
|
||||||
NVIC_InitStructure2.NVIC_IRQChannelSubPriority = 15;
|
NVIC_InitStructure2.NVIC_IRQChannelSubPriority = 15;
|
||||||
|
|
@ -518,18 +632,18 @@ void CIO::startInt()
|
||||||
|
|
||||||
#if defined(BIDIR_DATA_PIN)
|
#if defined(BIDIR_DATA_PIN)
|
||||||
// RXD pin is bidirectional in standard interfaces
|
// RXD pin is bidirectional in standard interfaces
|
||||||
void CIO::Data_dir_out(bool dir)
|
void CIO::Data_dir_out(bool dir)
|
||||||
{
|
{
|
||||||
GPIO_InitTypeDef GPIO_InitStruct;
|
GPIO_InitTypeDef GPIO_InitStruct;
|
||||||
|
|
||||||
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_InitStruct.GPIO_Pin = PIN_RXD;
|
GPIO_InitStruct.GPIO_Pin = PIN_RXD;
|
||||||
|
|
||||||
if(dir)
|
if(dir)
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||||
else
|
else
|
||||||
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||||
|
|
||||||
GPIO_Init(PORT_RXD, &GPIO_InitStruct);
|
GPIO_Init(PORT_RXD, &GPIO_InitStruct);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -627,6 +741,36 @@ void CIO::P25_pin(bool on)
|
||||||
GPIO_WriteBit(PORT_P25_LED, PIN_P25_LED, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_P25_LED, PIN_P25_LED, on ? Bit_SET : Bit_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CIO::NXDN_pin(bool on)
|
||||||
|
{
|
||||||
|
#if defined(USE_ALTERNATE_NXDN_LEDS)
|
||||||
|
GPIO_WriteBit(PORT_YSF_LED, PIN_YSF_LED, on ? Bit_SET : Bit_RESET);
|
||||||
|
GPIO_WriteBit(PORT_P25_LED, PIN_P25_LED, on ? Bit_SET : Bit_RESET);
|
||||||
|
#else
|
||||||
|
GPIO_WriteBit(PORT_NXDN_LED, PIN_NXDN_LED, on ? Bit_SET : Bit_RESET);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CIO::M17_pin(bool on)
|
||||||
|
{
|
||||||
|
#if defined(USE_ALTERNATE_M17_LEDS)
|
||||||
|
GPIO_WriteBit(PORT_DSTAR_LED, PIN_DSTAR_LED, on ? Bit_SET : Bit_RESET);
|
||||||
|
GPIO_WriteBit(PORT_P25_LED, PIN_P25_LED, on ? Bit_SET : Bit_RESET);
|
||||||
|
#else
|
||||||
|
GPIO_WriteBit(PORT_M17_LED, PIN_M17_LED, on ? Bit_SET : Bit_RESET);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CIO::POCSAG_pin(bool on)
|
||||||
|
{
|
||||||
|
#if defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||||
|
GPIO_WriteBit(PORT_DSTAR_LED, PIN_DSTAR_LED, on ? Bit_SET : Bit_RESET);
|
||||||
|
GPIO_WriteBit(PORT_DMR_LED, PIN_DMR_LED, on ? Bit_SET : Bit_RESET);
|
||||||
|
#else
|
||||||
|
GPIO_WriteBit(PORT_POCSAG_LED, PIN_POCSAG_LED, on ? Bit_SET : Bit_RESET);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void CIO::PTT_pin(bool on)
|
void CIO::PTT_pin(bool on)
|
||||||
{
|
{
|
||||||
GPIO_WriteBit(PORT_PTT_LED, PIN_PTT_LED, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_PTT_LED, PIN_PTT_LED, on ? Bit_SET : Bit_RESET);
|
||||||
|
|
@ -637,6 +781,19 @@ void CIO::COS_pin(bool on)
|
||||||
GPIO_WriteBit(PORT_COS_LED, PIN_COS_LED, on ? Bit_SET : Bit_RESET);
|
GPIO_WriteBit(PORT_COS_LED, PIN_COS_LED, on ? Bit_SET : Bit_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS)
|
||||||
|
void CIO::setBandVHF(bool vhf_on) {
|
||||||
|
GPIO_WriteBit(PORT_SET_BAND, PIN_SET_BAND, vhf_on ? Bit_SET : Bit_RESET);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CIO::hasSingleADF7021() {
|
||||||
|
return GPIO_ReadInputDataBit(PORT_SGL_DBL, PIN_SGL_DBL) == Bit_SET;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CIO::isDualBand() {
|
||||||
|
return GPIO_ReadInputDataBit(PORT_DL_DPX, PIN_DL_DPX) == Bit_SET;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function delay_us() from stm32duino project
|
* Function delay_us() from stm32duino project
|
||||||
|
|
|
||||||
41
M17Defines.h
Normal file
41
M17Defines.h
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016,2017,2018,2020,2021 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(M17DEFINES_H)
|
||||||
|
#define M17DEFINES_H
|
||||||
|
|
||||||
|
const unsigned int M17_RADIO_SYMBOL_LENGTH = 5U; // At 24 kHz sample rate
|
||||||
|
|
||||||
|
const unsigned int M17_FRAME_LENGTH_BITS = 384U;
|
||||||
|
const unsigned int M17_FRAME_LENGTH_BYTES = M17_FRAME_LENGTH_BITS / 8U;
|
||||||
|
|
||||||
|
const unsigned int M17_SYNC_LENGTH_BITS = 16U;
|
||||||
|
const unsigned int M17_SYNC_LENGTH_BYTES = M17_SYNC_LENGTH_BITS / 8U;
|
||||||
|
|
||||||
|
const uint8_t M17_LINK_SETUP_SYNC_BYTES[] = {0x55U, 0xF7U};
|
||||||
|
const uint8_t M17_STREAM_SYNC_BYTES[] = {0xFFU, 0x5DU};
|
||||||
|
const uint8_t M17_EOT_SYNC_BYTES[] = {0x55U, 0x5DU};
|
||||||
|
|
||||||
|
const uint8_t M17_SYNC_BYTES_LENGTH = 2U;
|
||||||
|
|
||||||
|
const uint16_t M17_LINK_SETUP_SYNC_BITS = 0x55F7U;
|
||||||
|
const uint16_t M17_STREAM_SYNC_BITS = 0xFF5DU;
|
||||||
|
const uint16_t M17_EOT_SYNC_BITS = 0x555DU;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
203
M17RX.cpp
Normal file
203
M17RX.cpp
Normal file
|
|
@ -0,0 +1,203 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2009-2018,2020,2021 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2016-2018 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "M17RX.h"
|
||||||
|
#include "Utils.h"
|
||||||
|
|
||||||
|
const uint8_t MAX_SYNC_BIT_START_ERRS = 0U;
|
||||||
|
const uint8_t MAX_SYNC_BIT_RUN_ERRS = 2U;
|
||||||
|
|
||||||
|
const unsigned int MAX_SYNC_FRAMES = 3U + 1U;
|
||||||
|
|
||||||
|
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
||||||
|
|
||||||
|
#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
|
||||||
|
|
||||||
|
CM17RX::CM17RX() :
|
||||||
|
m_state(M17RXS_NONE),
|
||||||
|
m_bitBuffer(0x00U),
|
||||||
|
m_outBuffer(),
|
||||||
|
m_buffer(NULL),
|
||||||
|
m_bufferPtr(0U),
|
||||||
|
m_lostCount(0U)
|
||||||
|
{
|
||||||
|
m_buffer = m_outBuffer + 1U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CM17RX::reset()
|
||||||
|
{
|
||||||
|
m_state = M17RXS_NONE;
|
||||||
|
m_bitBuffer = 0x00U;
|
||||||
|
m_bufferPtr = 0U;
|
||||||
|
m_lostCount = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CM17RX::databit(bool bit)
|
||||||
|
{
|
||||||
|
switch (m_state) {
|
||||||
|
case M17RXS_LINK_SETUP:
|
||||||
|
case M17RXS_STREAM:
|
||||||
|
processData(bit);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
processNone(bit);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CM17RX::processNone(bool bit)
|
||||||
|
{
|
||||||
|
m_bitBuffer <<= 1;
|
||||||
|
if (bit)
|
||||||
|
m_bitBuffer |= 0x01U;
|
||||||
|
|
||||||
|
// Exact matching of the link setup sync bit sequence
|
||||||
|
if (countBits16(m_bitBuffer ^ M17_LINK_SETUP_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) {
|
||||||
|
DEBUG1("M17RX: link setup sync found in None");
|
||||||
|
for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++)
|
||||||
|
m_buffer[i] = M17_LINK_SETUP_SYNC_BYTES[i];
|
||||||
|
|
||||||
|
m_lostCount = MAX_SYNC_FRAMES;
|
||||||
|
m_bufferPtr = M17_SYNC_LENGTH_BITS;
|
||||||
|
m_state = M17RXS_LINK_SETUP;
|
||||||
|
|
||||||
|
io.setDecode(true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exact matching of the stream sync bit sequence
|
||||||
|
if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_START_ERRS) {
|
||||||
|
DEBUG1("M17RX: stream sync found in None");
|
||||||
|
for (uint8_t i = 0U; i < M17_SYNC_BYTES_LENGTH; i++)
|
||||||
|
m_buffer[i] = M17_STREAM_SYNC_BYTES[i];
|
||||||
|
|
||||||
|
m_lostCount = MAX_SYNC_FRAMES;
|
||||||
|
m_bufferPtr = M17_SYNC_LENGTH_BITS;
|
||||||
|
m_state = M17RXS_STREAM;
|
||||||
|
|
||||||
|
io.setDecode(true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CM17RX::processData(bool bit)
|
||||||
|
{
|
||||||
|
m_bitBuffer <<= 1;
|
||||||
|
if (bit)
|
||||||
|
m_bitBuffer |= 0x01U;
|
||||||
|
|
||||||
|
WRITE_BIT1(m_buffer, m_bufferPtr, bit);
|
||||||
|
|
||||||
|
m_bufferPtr++;
|
||||||
|
if (m_bufferPtr > M17_FRAME_LENGTH_BITS)
|
||||||
|
reset();
|
||||||
|
|
||||||
|
// Only search for the syncs in the right place +-1 bit
|
||||||
|
if (m_bufferPtr >= (M17_SYNC_LENGTH_BITS - 1U) && m_bufferPtr <= (M17_SYNC_LENGTH_BITS + 1U)) {
|
||||||
|
// Fuzzy matching of the link setup sync bit sequence
|
||||||
|
if (countBits16(m_bitBuffer ^ M17_LINK_SETUP_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) {
|
||||||
|
DEBUG2("M17RX: found link setup sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS);
|
||||||
|
m_lostCount = MAX_SYNC_FRAMES;
|
||||||
|
m_bufferPtr = M17_SYNC_LENGTH_BITS;
|
||||||
|
m_state = M17RXS_LINK_SETUP;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fuzzy matching of the stream sync bit sequence
|
||||||
|
if (countBits16(m_bitBuffer ^ M17_STREAM_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) {
|
||||||
|
DEBUG2("M17RX: found stream sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS);
|
||||||
|
m_lostCount = MAX_SYNC_FRAMES;
|
||||||
|
m_bufferPtr = M17_SYNC_LENGTH_BITS;
|
||||||
|
m_state = M17RXS_STREAM;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fuzzy matching of the EOT sync bit sequence
|
||||||
|
if (countBits16(m_bitBuffer ^ M17_EOT_SYNC_BITS) <= MAX_SYNC_BIT_RUN_ERRS) {
|
||||||
|
DEBUG2("M17RX: found eot sync, pos", m_bufferPtr - M17_SYNC_LENGTH_BITS);
|
||||||
|
io.setDecode(false);
|
||||||
|
serial.writeM17EOT();
|
||||||
|
reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send a frame to the host if the required number of bits have been received
|
||||||
|
if (m_bufferPtr == M17_FRAME_LENGTH_BITS) {
|
||||||
|
// We've not seen a sync for too long, signal RXLOST and change to RX_NONE
|
||||||
|
m_lostCount--;
|
||||||
|
if (m_lostCount == 0U) {
|
||||||
|
DEBUG1("M17RX: sync timed out, lost lock");
|
||||||
|
io.setDecode(false);
|
||||||
|
serial.writeM17Lost();
|
||||||
|
reset();
|
||||||
|
} else {
|
||||||
|
// Write data to host
|
||||||
|
m_outBuffer[0U] = m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U;
|
||||||
|
|
||||||
|
switch (m_state) {
|
||||||
|
case M17RXS_LINK_SETUP:
|
||||||
|
writeRSSILinkSetup(m_outBuffer);
|
||||||
|
break;
|
||||||
|
case M17RXS_STREAM:
|
||||||
|
writeRSSIStream(m_outBuffer);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start the next frame
|
||||||
|
::memset(m_outBuffer, 0x00U, M17_FRAME_LENGTH_BYTES + 3U);
|
||||||
|
m_bufferPtr = 0U;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CM17RX::writeRSSILinkSetup(uint8_t* data)
|
||||||
|
{
|
||||||
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
uint16_t rssi = io.readRSSI();
|
||||||
|
|
||||||
|
data[49U] = (rssi >> 8) & 0xFFU;
|
||||||
|
data[50U] = (rssi >> 0) & 0xFFU;
|
||||||
|
|
||||||
|
serial.writeM17LinkSetup(data, M17_FRAME_LENGTH_BYTES + 3U);
|
||||||
|
#else
|
||||||
|
serial.writeM17LinkSetup(data, M17_FRAME_LENGTH_BYTES + 1U);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CM17RX::writeRSSIStream(uint8_t* data)
|
||||||
|
{
|
||||||
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
uint16_t rssi = io.readRSSI();
|
||||||
|
|
||||||
|
data[49U] = (rssi >> 8) & 0xFFU;
|
||||||
|
data[50U] = (rssi >> 0) & 0xFFU;
|
||||||
|
|
||||||
|
serial.writeM17Stream(data, M17_FRAME_LENGTH_BYTES + 3U);
|
||||||
|
#else
|
||||||
|
serial.writeM17Stream(data, M17_FRAME_LENGTH_BYTES + 1U);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
54
M17RX.h
Normal file
54
M17RX.h
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015-2018,2020,2021 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2016-2018 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(M17RX_H)
|
||||||
|
#define M17RX_H
|
||||||
|
|
||||||
|
#include "M17Defines.h"
|
||||||
|
|
||||||
|
enum M17RX_STATE {
|
||||||
|
M17RXS_NONE,
|
||||||
|
M17RXS_LINK_SETUP,
|
||||||
|
M17RXS_STREAM
|
||||||
|
};
|
||||||
|
|
||||||
|
class CM17RX {
|
||||||
|
public:
|
||||||
|
CM17RX();
|
||||||
|
|
||||||
|
void databit(bool bit);
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
private:
|
||||||
|
M17RX_STATE m_state;
|
||||||
|
uint16_t m_bitBuffer;
|
||||||
|
uint8_t m_outBuffer[M17_FRAME_LENGTH_BYTES + 3U];
|
||||||
|
uint8_t* m_buffer;
|
||||||
|
uint16_t m_bufferPtr;
|
||||||
|
uint16_t m_lostCount;
|
||||||
|
|
||||||
|
void processNone(bool bit);
|
||||||
|
void processData(bool bit);
|
||||||
|
void writeRSSILinkSetup(uint8_t* data);
|
||||||
|
void writeRSSIStream(uint8_t* data);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
124
M17TX.cpp
Normal file
124
M17TX.cpp
Normal file
|
|
@ -0,0 +1,124 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2009-2018,2020,2021 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "M17TX.h"
|
||||||
|
|
||||||
|
#include "M17Defines.h"
|
||||||
|
|
||||||
|
const uint8_t M17_SYNC = 0x77U;
|
||||||
|
const uint8_t M17_PREAMBLE = 0x77U;
|
||||||
|
|
||||||
|
CM17TX::CM17TX() :
|
||||||
|
m_buffer(1500U),
|
||||||
|
m_poBuffer(),
|
||||||
|
m_poLen(0U),
|
||||||
|
m_poPtr(0U),
|
||||||
|
m_txDelay(240U), // 200ms
|
||||||
|
m_delay(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CM17TX::process()
|
||||||
|
{
|
||||||
|
if (m_buffer.getData() == 0U && m_poLen == 0U)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_poLen == 0U) {
|
||||||
|
if (!m_tx) {
|
||||||
|
m_delay = true;
|
||||||
|
m_poLen = m_txDelay;
|
||||||
|
} else {
|
||||||
|
m_delay = false;
|
||||||
|
for (uint8_t i = 0U; i < M17_FRAME_LENGTH_BYTES; i++)
|
||||||
|
m_poBuffer[m_poLen++] = m_buffer.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_poPtr = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_poLen > 0U) {
|
||||||
|
uint16_t space = io.getSpace();
|
||||||
|
|
||||||
|
while (space > 8U) {
|
||||||
|
if (m_delay) {
|
||||||
|
writeByte(M17_SYNC);
|
||||||
|
m_poPtr++;
|
||||||
|
} else
|
||||||
|
writeByte(m_poBuffer[m_poPtr++]);
|
||||||
|
|
||||||
|
space -= 8U;
|
||||||
|
|
||||||
|
if (m_poPtr >= m_poLen) {
|
||||||
|
if (m_delay) {
|
||||||
|
m_delay = false;
|
||||||
|
m_poPtr = 0U;
|
||||||
|
m_poLen = 3U;
|
||||||
|
} else {
|
||||||
|
m_poPtr = 0U;
|
||||||
|
m_poLen = 0U;
|
||||||
|
m_delay = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CM17TX::writeData(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (length != (M17_FRAME_LENGTH_BYTES + 1U))
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
uint16_t space = m_buffer.getSpace();
|
||||||
|
if (space < M17_FRAME_LENGTH_BYTES)
|
||||||
|
return 5U;
|
||||||
|
|
||||||
|
for (uint8_t i = 0U; i < M17_FRAME_LENGTH_BYTES; i++)
|
||||||
|
m_buffer.put(data[i + 1U]);
|
||||||
|
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CM17TX::writeByte(uint8_t c)
|
||||||
|
{
|
||||||
|
uint8_t bit;
|
||||||
|
uint8_t mask = 0x80U;
|
||||||
|
|
||||||
|
for (uint8_t i = 0U; i < 8U; i++, c <<= 1) {
|
||||||
|
if ((c & mask) == mask)
|
||||||
|
bit = 1U;
|
||||||
|
else
|
||||||
|
bit = 0U;
|
||||||
|
|
||||||
|
io.write(&bit, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CM17TX::setTXDelay(uint8_t delay)
|
||||||
|
{
|
||||||
|
m_txDelay = 600U + uint16_t(delay) * 12U; // 500ms + tx delay
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CM17TX::getSpace() const
|
||||||
|
{
|
||||||
|
return m_buffer.getSpace() / M17_FRAME_LENGTH_BYTES;
|
||||||
|
}
|
||||||
|
|
||||||
50
M17TX.h
Normal file
50
M17TX.h
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015,2016,2017,2020,2021 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(M17TX_H)
|
||||||
|
#define M17TX_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
#include "SerialRB.h"
|
||||||
|
|
||||||
|
class CM17TX {
|
||||||
|
public:
|
||||||
|
CM17TX();
|
||||||
|
|
||||||
|
uint8_t writeData(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
|
void process();
|
||||||
|
|
||||||
|
void setTXDelay(uint8_t delay);
|
||||||
|
|
||||||
|
uint8_t getSpace() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CSerialRB m_buffer;
|
||||||
|
uint8_t m_poBuffer[1200U];
|
||||||
|
uint16_t m_poLen;
|
||||||
|
uint16_t m_poPtr;
|
||||||
|
uint16_t m_txDelay;
|
||||||
|
bool m_delay;
|
||||||
|
|
||||||
|
void writeByte(uint8_t c);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
67
MMDVM_HS.cpp
67
MMDVM_HS.cpp
|
|
@ -1,8 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016 by Mathis Schmieder DB9MAT
|
* Copyright (C) 2016 by Mathis Schmieder DB9MAT
|
||||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU
|
||||||
|
* Copyright (C) 2019 by Florian Wolters DF2ET
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -21,20 +22,29 @@
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
|
||||||
#if defined(STM32F10X_MD)
|
#if defined(STM32F10X_MD) || defined(STM32F4XX) || defined(STM32F7XX)
|
||||||
|
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
MMDVM_STATE m_modemState = STATE_IDLE;
|
MMDVM_STATE m_modemState = STATE_IDLE;
|
||||||
|
MMDVM_STATE m_calState = STATE_IDLE;
|
||||||
MMDVM_STATE m_modemState_prev = STATE_IDLE;
|
MMDVM_STATE m_modemState_prev = STATE_IDLE;
|
||||||
|
|
||||||
|
bool m_cwid_state = false;
|
||||||
|
bool m_pocsag_state = false;
|
||||||
|
|
||||||
|
uint8_t m_cwIdTXLevel = 30;
|
||||||
|
|
||||||
uint32_t m_modeTimerCnt;
|
uint32_t m_modeTimerCnt;
|
||||||
|
|
||||||
bool m_dstarEnable = true;
|
bool m_dstarEnable = true;
|
||||||
bool m_dmrEnable = true;
|
bool m_dmrEnable = true;
|
||||||
bool m_ysfEnable = true;
|
bool m_ysfEnable = true;
|
||||||
bool m_p25Enable = true;
|
bool m_p25Enable = true;
|
||||||
|
bool m_nxdnEnable = true;
|
||||||
|
bool m_m17Enable = true;
|
||||||
|
bool m_pocsagEnable = true;
|
||||||
|
|
||||||
bool m_duplex = false;
|
bool m_duplex = false;
|
||||||
|
|
||||||
|
|
@ -61,9 +71,29 @@ CYSFTX ysfTX;
|
||||||
CP25RX p25RX;
|
CP25RX p25RX;
|
||||||
CP25TX p25TX;
|
CP25TX p25TX;
|
||||||
|
|
||||||
|
CM17RX m17RX;
|
||||||
|
CM17TX m17TX;
|
||||||
|
|
||||||
|
CNXDNRX nxdnRX;
|
||||||
|
CNXDNTX nxdnTX;
|
||||||
|
|
||||||
|
CPOCSAGTX pocsagTX;
|
||||||
|
|
||||||
|
CCalDMR calDMR;
|
||||||
|
|
||||||
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
CCalRSSI calRSSI;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CCWIdTX cwIdTX;
|
||||||
|
|
||||||
CSerialPort serial;
|
CSerialPort serial;
|
||||||
CIO io;
|
CIO io;
|
||||||
|
|
||||||
|
#if defined(STM32_I2C_HOST)
|
||||||
|
CI2CHost i2c;
|
||||||
|
#endif
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
serial.start();
|
serial.start();
|
||||||
|
|
@ -79,7 +109,7 @@ void loop()
|
||||||
if (m_dstarEnable && m_modemState == STATE_DSTAR)
|
if (m_dstarEnable && m_modemState == STATE_DSTAR)
|
||||||
dstarTX.process();
|
dstarTX.process();
|
||||||
|
|
||||||
if (m_dmrEnable && m_modemState == STATE_DMR) {
|
if (m_dmrEnable && m_modemState == STATE_DMR && m_calState == STATE_IDLE) {
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
if (m_duplex)
|
if (m_duplex)
|
||||||
dmrTX.process();
|
dmrTX.process();
|
||||||
|
|
@ -95,7 +125,26 @@ void loop()
|
||||||
|
|
||||||
if (m_p25Enable && m_modemState == STATE_P25)
|
if (m_p25Enable && m_modemState == STATE_P25)
|
||||||
p25TX.process();
|
p25TX.process();
|
||||||
|
|
||||||
|
if (m_nxdnEnable && m_modemState == STATE_NXDN)
|
||||||
|
nxdnTX.process();
|
||||||
|
|
||||||
|
if (m_m17Enable && m_modemState == STATE_M17)
|
||||||
|
m17TX.process();
|
||||||
|
|
||||||
|
if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy()))
|
||||||
|
pocsagTX.process();
|
||||||
|
|
||||||
|
if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K || m_calState == STATE_INTCAL)
|
||||||
|
calDMR.process();
|
||||||
|
|
||||||
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
if (m_calState == STATE_RSSICAL)
|
||||||
|
calRSSI.process();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (m_modemState == STATE_IDLE)
|
||||||
|
cwIdTX.process();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
|
||||||
58
MMDVM_HS.ino
58
MMDVM_HS.ino
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -23,14 +23,23 @@
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
MMDVM_STATE m_modemState = STATE_IDLE;
|
MMDVM_STATE m_modemState = STATE_IDLE;
|
||||||
|
MMDVM_STATE m_calState = STATE_IDLE;
|
||||||
MMDVM_STATE m_modemState_prev = STATE_IDLE;
|
MMDVM_STATE m_modemState_prev = STATE_IDLE;
|
||||||
|
|
||||||
|
bool m_cwid_state = false;
|
||||||
|
bool m_pocsag_state = false;
|
||||||
|
|
||||||
|
uint8_t m_cwIdTXLevel = 30;
|
||||||
|
|
||||||
uint32_t m_modeTimerCnt;
|
uint32_t m_modeTimerCnt;
|
||||||
|
|
||||||
bool m_dstarEnable = true;
|
bool m_dstarEnable = true;
|
||||||
bool m_dmrEnable = true;
|
bool m_dmrEnable = true;
|
||||||
bool m_ysfEnable = true;
|
bool m_ysfEnable = true;
|
||||||
bool m_p25Enable = true;
|
bool m_p25Enable = true;
|
||||||
|
bool m_nxdnEnable = true;
|
||||||
|
bool m_m17Enable = true;
|
||||||
|
bool m_pocsagEnable = true;
|
||||||
|
|
||||||
bool m_duplex = false;
|
bool m_duplex = false;
|
||||||
|
|
||||||
|
|
@ -57,6 +66,22 @@ CYSFTX ysfTX;
|
||||||
CP25RX p25RX;
|
CP25RX p25RX;
|
||||||
CP25TX p25TX;
|
CP25TX p25TX;
|
||||||
|
|
||||||
|
CM17RX m17RX;
|
||||||
|
CM17TX m17TX;
|
||||||
|
|
||||||
|
CNXDNRX nxdnRX;
|
||||||
|
CNXDNTX nxdnTX;
|
||||||
|
|
||||||
|
CPOCSAGTX pocsagTX;
|
||||||
|
|
||||||
|
CCalDMR calDMR;
|
||||||
|
|
||||||
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
CCalRSSI calRSSI;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CCWIdTX cwIdTX;
|
||||||
|
|
||||||
CSerialPort serial;
|
CSerialPort serial;
|
||||||
CIO io;
|
CIO io;
|
||||||
|
|
||||||
|
|
@ -74,7 +99,7 @@ void loop()
|
||||||
if (m_dstarEnable && m_modemState == STATE_DSTAR)
|
if (m_dstarEnable && m_modemState == STATE_DSTAR)
|
||||||
dstarTX.process();
|
dstarTX.process();
|
||||||
|
|
||||||
if (m_dmrEnable && m_modemState == STATE_DMR) {
|
if (m_dmrEnable && m_modemState == STATE_DMR && m_calState == STATE_IDLE) {
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
if (m_duplex)
|
if (m_duplex)
|
||||||
dmrTX.process();
|
dmrTX.process();
|
||||||
|
|
@ -91,4 +116,23 @@ void loop()
|
||||||
if (m_p25Enable && m_modemState == STATE_P25)
|
if (m_p25Enable && m_modemState == STATE_P25)
|
||||||
p25TX.process();
|
p25TX.process();
|
||||||
|
|
||||||
|
if (m_nxdnEnable && m_modemState == STATE_NXDN)
|
||||||
|
nxdnTX.process();
|
||||||
|
|
||||||
|
if (m_m17Enable && m_modemState == STATE_M17)
|
||||||
|
m17TX.process();
|
||||||
|
|
||||||
|
if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy()))
|
||||||
|
pocsagTX.process();
|
||||||
|
|
||||||
|
if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K || m_calState == STATE_INTCAL)
|
||||||
|
calDMR.process();
|
||||||
|
|
||||||
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
if (m_calState == STATE_RSSICAL)
|
||||||
|
calRSSI.process();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (m_modemState == STATE_IDLE)
|
||||||
|
cwIdTX.process();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
593
Makefile
593
Makefile
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (C) 2016 by Andy Uribe CA6JAU
|
# Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU
|
||||||
# Copyright (C) 2016 by Jim McLaughlin KI6ZUM
|
# Copyright (C) 2016 by Jim McLaughlin KI6ZUM
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
|
@ -15,6 +15,78 @@
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
# MMDVM source files
|
||||||
|
MMDVM_HS_PATH=.
|
||||||
|
|
||||||
|
# STM32 library paths
|
||||||
|
F1_LIB_PATH=./STM32F10X_Lib
|
||||||
|
F4_LIB_PATH=./STM32F4XX_Lib
|
||||||
|
F7_LIB_PATH=./STM32F7XX_Lib
|
||||||
|
|
||||||
|
# MCU external clock frequency (Hz)
|
||||||
|
CLK_PI_F4=12000000
|
||||||
|
CLK_DEF=8000000
|
||||||
|
|
||||||
|
# Directory Structure
|
||||||
|
BINDIR=bin
|
||||||
|
OBJDIR_F1=obj_f1
|
||||||
|
OBJDIR_F4=obj_f4
|
||||||
|
OBJDIR_F7=obj_f7
|
||||||
|
|
||||||
|
# Output files
|
||||||
|
BINELF_F1=mmdvm_f1.elf
|
||||||
|
BINHEX_F1=mmdvm_f1.hex
|
||||||
|
BINBIN_F1=mmdvm_f1.bin
|
||||||
|
BINELF_F1BL=mmdvm_f1bl.elf
|
||||||
|
BINHEX_F1BL=mmdvm_f1bl.hex
|
||||||
|
BINBIN_F1BL=mmdvm_f1bl.bin
|
||||||
|
BINELF_F1NOBL=mmdvm_f1nobl.elf
|
||||||
|
BINHEX_F1NOBL=mmdvm_f1nobl.hex
|
||||||
|
BINBIN_F1NOBL=mmdvm_f1nobl.bin
|
||||||
|
BINELF_F4=mmdvm_f4.elf
|
||||||
|
BINHEX_F4=mmdvm_f4.hex
|
||||||
|
BINBIN_F4=mmdvm_f4.bin
|
||||||
|
BINELF_F7=mmdvm_f7.elf
|
||||||
|
BINHEX_F7=mmdvm_f7.hex
|
||||||
|
BINBIN_F7=mmdvm_f7.bin
|
||||||
|
|
||||||
|
# Header directories
|
||||||
|
INC_F1= . $(F1_LIB_PATH)/CMSIS/ $(F1_LIB_PATH)/Device/ $(F1_LIB_PATH)/STM32F10x_StdPeriph_Driver/inc/ $(F1_LIB_PATH)/usb/inc/
|
||||||
|
INCLUDES_F1=$(INC_F1:%=-I%)
|
||||||
|
INC_F4= . $(F4_LIB_PATH)/CMSIS/Include/ $(F4_LIB_PATH)/Device/ $(F4_LIB_PATH)/STM32F4xx_StdPeriph_Driver/include/
|
||||||
|
INCLUDES_F4=$(INC_F4:%=-I%)
|
||||||
|
INC_F7= . $(F7_LIB_PATH)/CMSIS/Include/ $(F7_LIB_PATH)/Device/ $(F7_LIB_PATH)/STM32F7xx_StdPeriph_Driver/inc/
|
||||||
|
INCLUDES_F7=$(INC_F7:%=-I%)
|
||||||
|
|
||||||
|
# CMSIS libraries
|
||||||
|
INCLUDES_LIBS_F1=
|
||||||
|
INCLUDES_LIBS_F4=$(F4_LIB_PATH)/CMSIS/Lib/GCC/libarm_cortexM4lf_math.a
|
||||||
|
INCLUDES_LIBS_F7=$(F7_LIB_PATH)/CMSIS/Lib/GCC/libarm_cortexM7lfsp_math.a
|
||||||
|
|
||||||
|
# STM32F1 Standard Peripheral Libraries source path
|
||||||
|
STD_LIB_F1=$(F1_LIB_PATH)/STM32F10x_StdPeriph_Driver/src
|
||||||
|
|
||||||
|
# STM32F1 USB support source path
|
||||||
|
USB_F1=$(F1_LIB_PATH)/usb
|
||||||
|
|
||||||
|
# STM32F4 Standard Peripheral Libraries source path
|
||||||
|
STD_LIB_F4=$(F4_LIB_PATH)/STM32F4xx_StdPeriph_Driver/source
|
||||||
|
|
||||||
|
# STM32F7 Standard Peripheral Libraries source path
|
||||||
|
STD_LIB_F7=$(F7_LIB_PATH)/STM32F7xx_StdPeriph_Driver/src
|
||||||
|
|
||||||
|
# STM32F1 system source path
|
||||||
|
SYS_DIR_F1=$(F1_LIB_PATH)/Device
|
||||||
|
STARTUP_DIR_F1=$(F1_LIB_PATH)/Device/startup
|
||||||
|
|
||||||
|
# STM32F4 system source path
|
||||||
|
SYS_DIR_F4=$(F4_LIB_PATH)/Device
|
||||||
|
STARTUP_DIR_F4=$(F4_LIB_PATH)/Device/startup
|
||||||
|
|
||||||
|
# STM32F7 system source path
|
||||||
|
SYS_DIR_F7=$(F7_LIB_PATH)/Device
|
||||||
|
STARTUP_DIR_F7=$(F7_LIB_PATH)/Device/startup
|
||||||
|
|
||||||
# GNU ARM Embedded Toolchain
|
# GNU ARM Embedded Toolchain
|
||||||
CC=arm-none-eabi-gcc
|
CC=arm-none-eabi-gcc
|
||||||
CXX=arm-none-eabi-g++
|
CXX=arm-none-eabi-g++
|
||||||
|
|
@ -27,212 +99,476 @@ NM=arm-none-eabi-nm
|
||||||
SIZE=arm-none-eabi-size
|
SIZE=arm-none-eabi-size
|
||||||
A2L=arm-none-eabi-addr2line
|
A2L=arm-none-eabi-addr2line
|
||||||
|
|
||||||
# Directory Structure
|
|
||||||
BINDIR=bin
|
|
||||||
|
|
||||||
OPTFLAG=-Os
|
|
||||||
|
|
||||||
# Configure vars depending on OS
|
# Configure vars depending on OS
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
ASOURCES=$(shell dir /S /B *.s)
|
CLEANCMD=del /S *.o *.hex *.bin *.elf
|
||||||
CSOURCES=$(shell dir /S /B *.c)
|
MDDIRS=md $@
|
||||||
CXXSOURCES=$(shell dir /S /B *.cpp)
|
DFU_UTIL=./$(F1_LIB_PATH)/utils/win/dfu-util.exe
|
||||||
CLEANCMD=del /S *.o *.hex *.bin *.elf *.d
|
STM32FLASH=./$(F1_LIB_PATH)/utils/win/stm32flash.exe
|
||||||
MDBIN=md $@
|
|
||||||
DFU_UTIL=./STM32F10X_Lib/utils/win/dfu-util.exe
|
|
||||||
STM32FLASH=./STM32F10X_Lib/utils/win/stm32flash.exe
|
|
||||||
else
|
else
|
||||||
ASOURCES=$(shell find . -name '*.s')
|
CLEANCMD=rm -f $(OBJ_F1BL) $(OBJ_F4) $(OBJ_F7) $(BINDIR)/*.hex $(BINDIR)/mmdvm_f1.bin $(BINDIR)/mmdvm_f1bl.bin $(BINDIR)/mmdvm_f1nobl.bin $(BINDIR)/*.elf
|
||||||
CSOURCES=$(shell find . -name '*.c')
|
MDDIRS=mkdir $@
|
||||||
CXXSOURCES=$(shell find . -name '*.cpp')
|
|
||||||
CLEANCMD=rm -f $(OBJECTS) $(BINDIR)/$(BINELF) $(BINDIR)/$(BINHEX) $(BINDIR)/$(BINBIN) *.d
|
|
||||||
MDBIN=mkdir $@
|
|
||||||
|
|
||||||
ifeq ($(shell uname -s),Linux)
|
|
||||||
ifeq ($(shell uname -m),x86_64)
|
|
||||||
DFU_RST=./STM32F10X_Lib/utils/linux64/upload-reset
|
|
||||||
DFU_UTIL=./STM32F10X_Lib/utils/linux64/dfu-util
|
|
||||||
ST_FLASH=./STM32F10X_Lib/utils/linux64/st-flash
|
|
||||||
STM32FLASH=./STM32F10X_Lib/utils/linux64/stm32flash
|
|
||||||
else ifeq ($(shell uname -m),armv7l)
|
|
||||||
DFU_RST=./STM32F10X_Lib/utils/rpi32/upload-reset
|
|
||||||
DFU_UTIL=./STM32F10X_Lib/utils/rpi32/dfu-util
|
|
||||||
ST_FLASH=./STM32F10X_Lib/utils/rpi32/st-flash
|
|
||||||
STM32FLASH=./STM32F10X_Lib/utils/rpi32/stm32flash
|
|
||||||
else ifeq ($(shell uname -m),armv6l)
|
|
||||||
DFU_RST=./STM32F10X_Lib/utils/rpi32/upload-reset
|
|
||||||
DFU_UTIL=./STM32F10X_Lib/utils/rpi32/dfu-util
|
|
||||||
ST_FLASH=./STM32F10X_Lib/utils/rpi32/st-flash
|
|
||||||
STM32FLASH=./STM32F10X_Lib/utils/rpi32/stm32flash
|
|
||||||
else
|
|
||||||
DFU_RST=./STM32F10X_Lib/utils/linux/upload-reset
|
|
||||||
DFU_UTIL=./STM32F10X_Lib/utils/linux/dfu-util
|
|
||||||
ST_FLASH=./STM32F10X_Lib/utils/linux/st-flash
|
|
||||||
STM32FLASH=./STM32F10X_Lib/utils/linux/stm32flash
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(shell uname -s),Darwin)
|
ifeq ($(shell uname -s),Linux)
|
||||||
DFU_RST=./STM32F10X_Lib/utils/macosx/upload-reset
|
ST_FLASH_ON_PATH=$(shell which st-flash)
|
||||||
DFU_UTIL=./STM32F10X_Lib/utils/macosx/dfu-util
|
ST_FLASH_IS_ON_PATH=$(.SHELLSTATUS)
|
||||||
ST_FLASH=./STM32F10X_Lib/utils/macosx/st-flash
|
ifeq ($(shell uname -m),x86_64)
|
||||||
STM32FLASH=./STM32F10X_Lib/utils/macosx/stm32flash
|
DFU_RST=./$(F1_LIB_PATH)/utils/linux64/upload-reset
|
||||||
endif
|
DFU_UTIL=./$(F1_LIB_PATH)/utils/linux64/dfu-util
|
||||||
|
DFU_RST=./$(F1_LIB_PATH)/utils/linux64/upload-reset
|
||||||
|
DFU_UTIL=./$(F1_LIB_PATH)/utils/linux64/dfu-util
|
||||||
|
ifeq ($(ST_FLASH_IS_ON_PATH),0)
|
||||||
|
ST_FLASH=$(ST_FLASH_ON_PATH)
|
||||||
|
ST_FLASH_OPTS=--flash=128k
|
||||||
|
else
|
||||||
|
ST_FLASH=./$(F1_LIB_PATH)/utils/linux64/st-flash
|
||||||
|
ST_FLASH_OPTS=
|
||||||
|
endif
|
||||||
|
STM32FLASH=./$(F1_LIB_PATH)/utils/linux64/stm32flash
|
||||||
|
else ifeq ($(shell uname -m),armv7l)
|
||||||
|
DFU_RST=./$(F1_LIB_PATH)/utils/rpi32/upload-reset
|
||||||
|
DFU_UTIL=./$(F1_LIB_PATH)/utils/rpi32/dfu-util
|
||||||
|
ST_FLASH=./$(F1_LIB_PATH)/utils/rpi32/st-flash
|
||||||
|
STM32FLASH=./$(F1_LIB_PATH)/utils/rpi32/stm32flash
|
||||||
|
else ifeq ($(shell uname -m),armv6l)
|
||||||
|
DFU_RST=./$(F1_LIB_PATH)/utils/rpi32/upload-reset
|
||||||
|
DFU_UTIL=./$(F1_LIB_PATH)/utils/rpi32/dfu-util
|
||||||
|
ST_FLASH=./$(F1_LIB_PATH)/utils/rpi32/st-flash
|
||||||
|
STM32FLASH=./$(F1_LIB_PATH)/utils/rpi32/stm32flash
|
||||||
|
else
|
||||||
|
DFU_RST=./$(F1_LIB_PATH)/utils/linux/upload-reset
|
||||||
|
DFU_UTIL=./$(F1_LIB_PATH)/utils/linux/dfu-util
|
||||||
|
ifeq ($(ST_FLASH_IS_ON_PATH),0)
|
||||||
|
ST_FLASH=$(ST_FLASH_ON_PATH)
|
||||||
|
ST_FLASH_OPTS=--flash=128k
|
||||||
|
else
|
||||||
|
ST_FLASH=./$(F1_LIB_PATH)/utils/linux/st-flash
|
||||||
|
ST_FLASH_OPTS=
|
||||||
|
endif
|
||||||
|
STM32FLASH=./$(F1_LIB_PATH)/utils/linux/stm32flash
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(shell uname -s),Darwin)
|
||||||
|
DFU_RST=./$(F1_LIB_PATH)/utils/macosx/upload-reset
|
||||||
|
DFU_UTIL=./$(F1_LIB_PATH)/utils/macosx/dfu-util
|
||||||
|
ST_FLASH=./$(F1_LIB_PATH)/utils/macosx/st-flash
|
||||||
|
STM32FLASH=./$(F1_LIB_PATH)/utils/macosx/stm32flash
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Default reference oscillator frequencies
|
# Default reference oscillator frequencies
|
||||||
ifndef $(OSC)
|
ifndef $(OSC)
|
||||||
OSC=8000000
|
ifeq ($(MAKECMDGOALS),pi-f4)
|
||||||
|
OSC=$(CLK_PI_F4)
|
||||||
|
else
|
||||||
|
OSC=$(CLK_DEF)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Find header directories
|
# Build object lists
|
||||||
INC= . STM32F10X_Lib/CMSIS/ STM32F10X_Lib/Device/ STM32F10X_Lib/STM32F10x_StdPeriph_Driver/inc/ STM32F10X_Lib/usb/inc/
|
CXXSRC=$(wildcard $(MMDVM_HS_PATH)/*.cpp)
|
||||||
INCLUDES=$(INC:%=-I%)
|
CSRC_STD_F1=$(wildcard $(STD_LIB_F1)/*.c)
|
||||||
|
SYS_F1=$(wildcard $(SYS_DIR_F1)/*.c)
|
||||||
|
STARTUP_F1=$(wildcard $(STARTUP_DIR_F1)/*.c)
|
||||||
|
CXX_USB_F1=$(wildcard $(USB_F1)/*.cpp)
|
||||||
|
C_USB_F1=$(wildcard $(USB_F1)/*.c)
|
||||||
|
CSRC_STD_F4=$(wildcard $(STD_LIB_F4)/*.c)
|
||||||
|
SYS_F4=$(wildcard $(SYS_DIR_F4)/*.c)
|
||||||
|
STARTUP_F4=$(wildcard $(STARTUP_DIR_F4)/*.c)
|
||||||
|
CSRC_STD_F7=$(wildcard $(STD_LIB_F7)/*.c)
|
||||||
|
SYS_F7=$(wildcard $(SYS_DIR_F7)/*.c)
|
||||||
|
STARTUP_F7=$(wildcard $(STARTUP_DIR_F7)/*.c)
|
||||||
|
OBJ_F1=$(CXXSRC:$(MMDVM_HS_PATH)/%.cpp=$(OBJDIR_F1)/%.o) $(CSRC_STD_F1:$(STD_LIB_F1)/%.c=$(OBJDIR_F1)/%.o) $(SYS_F1:$(SYS_DIR_F1)/%.c=$(OBJDIR_F1)/%.o) $(STARTUP_F1:$(STARTUP_DIR_F1)/%.c=$(OBJDIR_F1)/%.o)
|
||||||
|
OBJ_F1BL=$(CXXSRC:$(MMDVM_HS_PATH)/%.cpp=$(OBJDIR_F1)/%.o) $(CSRC_STD_F1:$(STD_LIB_F1)/%.c=$(OBJDIR_F1)/%.o) $(SYS_F1:$(SYS_DIR_F1)/%.c=$(OBJDIR_F1)/%.o) $(STARTUP_F1:$(STARTUP_DIR_F1)/%.c=$(OBJDIR_F1)/%.o) $(CXX_USB_F1:$(USB_F1)/%.cpp=$(OBJDIR_F1)/%.o) $(C_USB_F1:$(USB_F1)/%.c=$(OBJDIR_F1)/%.o)
|
||||||
|
OBJ_F4=$(CXXSRC:$(MMDVM_HS_PATH)/%.cpp=$(OBJDIR_F4)/%.o) $(CSRC_STD_F4:$(STD_LIB_F4)/%.c=$(OBJDIR_F4)/%.o) $(SYS_F4:$(SYS_DIR_F4)/%.c=$(OBJDIR_F4)/%.o) $(STARTUP_F4:$(STARTUP_DIR_F4)/%.c=$(OBJDIR_F4)/%.o)
|
||||||
|
OBJ_F7=$(CXXSRC:$(MMDVM_HS_PATH)/%.cpp=$(OBJDIR_F7)/%.o) $(CSRC_STD_F7:$(STD_LIB_F7)/%.c=$(OBJDIR_F7)/%.o) $(SYS_F7:$(SYS_DIR_F7)/%.c=$(OBJDIR_F7)/%.o) $(STARTUP_F7:$(STARTUP_DIR_F7)/%.c=$(OBJDIR_F7)/%.o)
|
||||||
|
|
||||||
# Find libraries
|
# MCU flags
|
||||||
INCLUDES_LIBS=
|
MCFLAGS_F1=-mcpu=cortex-m3 -march=armv7-m -mthumb -Wall -Wextra
|
||||||
LINK_LIBS=
|
MCFLAGS_F4=-mcpu=cortex-m4 -mthumb -mlittle-endian -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb-interwork
|
||||||
|
MCFLAGS_F7=-mcpu=cortex-m7 -mthumb -mlittle-endian -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb-interwork
|
||||||
|
|
||||||
# Create object list
|
# Compile flags
|
||||||
OBJECTS=$(ASOURCES:%.s=%.o)
|
DEFS_F1_HS=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC) -DVECT_TAB_OFFSET=0x0 -DMADEBYMAKEFILE
|
||||||
OBJECTS+=$(CSOURCES:%.c=%.o)
|
DEFS_F1_HS_BL=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC) -DVECT_TAB_OFFSET=0x2000 -DMADEBYMAKEFILE
|
||||||
OBJECTS+=$(CXXSOURCES:%.cpp=%.o)
|
# STM32F446 Pi-Hat board:
|
||||||
|
DEFS_PI_F4=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DSTM32F4_PI -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
|
# STM32F4 Nucleo-64 F446RE board:
|
||||||
|
DEFS_F446=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F446xx -DSTM32F4_NUCLEO -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
|
# STM32F7 Nucleo-144 F767ZI board:
|
||||||
|
DEFS_F767=-DUSE_HAL_DRIVER -DSTM32F767xx -DSTM32F7XX -DSTM32F7_NUCLEO -DHSE_VALUE=$(OSC) -DMADEBYMAKEFILE
|
||||||
|
|
||||||
# Define output files ELF & IHEX
|
# Build compiler flags
|
||||||
BINELF=outp.elf
|
CFLAGS_F1=-c $(MCFLAGS_F1) $(INCLUDES_F1)
|
||||||
BINHEX=outp.hex
|
CXXFLAGS_F1=-c $(MCFLAGS_F1) $(INCLUDES_F1)
|
||||||
BINBIN=outp.bin
|
CFLAGS_F4=-c $(MCFLAGS_F4) $(INCLUDES_F4)
|
||||||
|
CXXFLAGS_F4=-c $(MCFLAGS_F4) $(INCLUDES_F4)
|
||||||
|
CFLAGS_F7=-c $(MCFLAGS_F7) $(INCLUDES_F7)
|
||||||
|
CXXFLAGS_F7=-c $(MCFLAGS_F7) $(INCLUDES_F7)
|
||||||
|
|
||||||
# MCU FLAGS
|
# Linker flags
|
||||||
MCFLAGS=-mcpu=cortex-m3 -march=armv7-m -mthumb -Wall -Wextra
|
LDFLAGS_F1_N =-T normal.ld $(MCFLAGS_F1) $(INCLUDES_LIBS_F1)
|
||||||
|
LDFLAGS_F1_BL =-T bootloader.ld $(MCFLAGS_F1) $(INCLUDES_LIBS_F1)
|
||||||
|
LDFLAGS_F4 =-T stm32f4xx_link.ld $(MCFLAGS_F4) $(INCLUDES_LIBS_F4)
|
||||||
|
LDFLAGS_F7 =-T stm32f7xx_link.ld $(MCFLAGS_F7) $(INCLUDES_LIBS_F7)
|
||||||
|
|
||||||
# COMPILE FLAGS
|
# Common flags
|
||||||
DEFS_HS=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC) -DVECT_TAB_OFFSET=0x0 -DMADEBYMAKEFILE
|
CFLAGS=-Os -ffunction-sections -fdata-sections -nostdlib -DCUSTOM_NEW -DNO_EXCEPTIONS -Wno-unused-parameter -nostdlib
|
||||||
DEFS_HS_BL=-DUSE_STDPERIPH_DRIVER -DSTM32F10X_MD -DHSE_VALUE=$(OSC) -DVECT_TAB_OFFSET=0x2000 -DMADEBYMAKEFILE
|
CXXFLAGS=-Os -fno-exceptions -ffunction-sections -fdata-sections -nostdlib -fno-rtti -DCUSTOM_NEW -DNO_EXCEPTIONS -Wno-unused-parameter
|
||||||
|
LDFLAGS=-Os --specs=nano.specs --specs=nosys.specs
|
||||||
CFLAGS=-c $(MCFLAGS) $(INCLUDES) -DCUSTOM_NEW -DNO_EXCEPTIONS -Wno-unused-parameter
|
|
||||||
CXXFLAGS=-c $(MCFLAGS) $(INCLUDES) -DCUSTOM_NEW -DNO_EXCEPTIONS -Wno-unused-parameter
|
|
||||||
|
|
||||||
# LINKER FLAGS
|
|
||||||
LDSCRIPT_N=normal.ld
|
|
||||||
LDSCRIPT_BL=bootloader.ld
|
|
||||||
LDFLAGS=$(MCFLAGS) --specs=nosys.specs $(INCLUDES_LIBS) $(LINK_LIBS)
|
|
||||||
|
|
||||||
# Build Rules
|
# Build Rules
|
||||||
.PHONY: all release hs bl debug clean
|
.PHONY: all release_f1 release_f4 release_f7 hs bl nobl pi-f4 f446 f767 clean
|
||||||
|
|
||||||
all: hs
|
all: hs
|
||||||
|
|
||||||
hs: CFLAGS+=$(DEFS_HS) $(OPTFLAG) -ffunction-sections -fdata-sections -nostdlib
|
pi-f4: CFLAGS+=$(CFLAGS_F4) $(DEFS_PI_F4)
|
||||||
hs: CXXFLAGS+=$(DEFS_HS) $(OPTFLAG) -fno-exceptions -ffunction-sections -fdata-sections -nostdlib -fno-rtti
|
pi-f4: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_PI_F4)
|
||||||
hs: LDFLAGS+=-T $(LDSCRIPT_N) $(OPTFLAG) --specs=nano.specs
|
pi-f4: LDFLAGS+=$(LDFLAGS_F4)
|
||||||
hs: release
|
pi-f4: release_f4
|
||||||
|
|
||||||
bl: CFLAGS+=$(DEFS_HS_BL) -Os -ffunction-sections -fdata-sections -nostdlib
|
f446: CFLAGS+=$(CFLAGS_F4) $(DEFS_F446)
|
||||||
bl: CXXFLAGS+=$(DEFS_HS_BL) -Os -fno-exceptions -ffunction-sections -fdata-sections -nostdlib -fno-rtti
|
f446: CXXFLAGS+=$(CXXFLAGS_F4) $(DEFS_F446)
|
||||||
bl: LDFLAGS+=-T $(LDSCRIPT_BL) -Os --specs=nano.specs
|
f446: LDFLAGS+=$(LDFLAGS_F4)
|
||||||
bl: release
|
f446: release_f4
|
||||||
|
|
||||||
debug: CFLAGS+=-g $(DEFS_HS)
|
f767: CFLAGS+=$(CFLAGS_F7) $(DEFS_F767)
|
||||||
debug: CXXFLAGS+=-g $(DEFS_HS)
|
f767: CXXFLAGS+=$(CXXFLAGS_F7) $(DEFS_F767)
|
||||||
debug: LDFLAGS+=-g
|
f767: LDFLAGS+=$(LDFLAGS_F7)
|
||||||
debug: release
|
f767: release_f7
|
||||||
|
|
||||||
release: GitVersion.h
|
hs: CFLAGS+=$(CFLAGS_F1) $(DEFS_F1_HS)
|
||||||
release: $(BINDIR)
|
hs: CXXFLAGS+=$(CXXFLAGS_F1) $(DEFS_F1_HS)
|
||||||
release: $(BINDIR)/$(BINHEX)
|
hs: LDFLAGS+=$(LDFLAGS_F1_N)
|
||||||
release: $(BINDIR)/$(BINBIN)
|
hs: release_f1
|
||||||
|
|
||||||
|
bl: CFLAGS+=$(CFLAGS_F1) $(DEFS_F1_HS_BL)
|
||||||
|
bl: CXXFLAGS+=$(CXXFLAGS_F1) $(DEFS_F1_HS_BL)
|
||||||
|
bl: LDFLAGS+=$(LDFLAGS_F1_BL)
|
||||||
|
bl: release_f1bl
|
||||||
|
|
||||||
|
nobl: CFLAGS+=$(CFLAGS_F1) $(DEFS_F1_HS)
|
||||||
|
nobl: CXXFLAGS+=$(CXXFLAGS_F1) $(DEFS_F1_HS)
|
||||||
|
nobl: LDFLAGS+=$(LDFLAGS_F1_N)
|
||||||
|
nobl: release_f1nobl
|
||||||
|
|
||||||
|
release_f1: GitVersion.h
|
||||||
|
release_f1: $(BINDIR)
|
||||||
|
release_f1: $(OBJDIR_F1)
|
||||||
|
release_f1: $(BINDIR)/$(BINHEX_F1)
|
||||||
|
release_f1: $(BINDIR)/$(BINBIN_F1)
|
||||||
|
|
||||||
|
release_f1bl: GitVersion.h
|
||||||
|
release_f1bl: $(BINDIR)
|
||||||
|
release_f1bl: $(OBJDIR_F1)
|
||||||
|
release_f1bl: $(BINDIR)/$(BINHEX_F1BL)
|
||||||
|
release_f1bl: $(BINDIR)/$(BINBIN_F1BL)
|
||||||
|
|
||||||
|
release_f1nobl: GitVersion.h
|
||||||
|
release_f1nobl: $(BINDIR)
|
||||||
|
release_f1nobl: $(OBJDIR_F1)
|
||||||
|
release_f1nobl: $(BINDIR)/$(BINHEX_F1NOBL)
|
||||||
|
release_f1nobl: $(BINDIR)/$(BINBIN_F1NOBL)
|
||||||
|
|
||||||
|
release_f4: GitVersion.h
|
||||||
|
release_f4: $(BINDIR)
|
||||||
|
release_f4: $(OBJDIR_F4)
|
||||||
|
release_f4: $(BINDIR)/$(BINHEX_F4)
|
||||||
|
release_f4: $(BINDIR)/$(BINBIN_F4)
|
||||||
|
|
||||||
|
release_f7: GitVersion.h
|
||||||
|
release_f7: $(BINDIR)
|
||||||
|
release_f7: $(OBJDIR_F7)
|
||||||
|
release_f7: $(BINDIR)/$(BINHEX_F7)
|
||||||
|
release_f7: $(BINDIR)/$(BINBIN_F7)
|
||||||
|
|
||||||
$(BINDIR):
|
$(BINDIR):
|
||||||
$(MDBIN)
|
$(MDDIRS)
|
||||||
|
|
||||||
$(BINDIR)/$(BINHEX): $(BINDIR)/$(BINELF)
|
$(OBJDIR_F1):
|
||||||
|
$(MDDIRS)
|
||||||
|
|
||||||
|
$(OBJDIR_F4):
|
||||||
|
$(MDDIRS)
|
||||||
|
|
||||||
|
$(OBJDIR_F7):
|
||||||
|
$(MDDIRS)
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINHEX_F1BL): $(BINDIR)/$(BINELF_F1BL)
|
||||||
$(CP) -O ihex $< $@
|
$(CP) -O ihex $< $@
|
||||||
@echo "Objcopy from ELF to IHEX complete!\n"
|
@echo "Objcopy from ELF to IHEX complete!\n"
|
||||||
|
|
||||||
$(BINDIR)/$(BINBIN): $(BINDIR)/$(BINELF)
|
$(BINDIR)/$(BINBIN_F1BL): $(BINDIR)/$(BINELF_F1BL)
|
||||||
$(CP) -O binary $< $@
|
$(CP) -O binary $< $@
|
||||||
@echo "Objcopy from ELF to BINARY complete!\n"
|
@echo "Objcopy from ELF to BINARY complete!\n"
|
||||||
|
|
||||||
$(BINDIR)/$(BINELF): $(OBJECTS)
|
$(BINDIR)/$(BINELF_F1BL): $(OBJ_F1BL)
|
||||||
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
|
$(CXX) $(OBJ_F1BL) $(LDFLAGS) -o $@
|
||||||
@echo "Linking complete!\n"
|
@echo "Linking complete!\n"
|
||||||
$(SIZE) $(BINDIR)/$(BINELF)
|
$(SIZE) $(BINDIR)/$(BINELF_F1BL)
|
||||||
|
|
||||||
%.o: %.cpp
|
$(BINDIR)/$(BINHEX_F1NOBL): $(BINDIR)/$(BINELF_F1NOBL)
|
||||||
|
$(CP) -O ihex $< $@
|
||||||
|
@echo "Objcopy from ELF to IHEX complete!\n"
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINBIN_F1NOBL): $(BINDIR)/$(BINELF_F1NOBL)
|
||||||
|
$(CP) -O binary $< $@
|
||||||
|
@echo "Objcopy from ELF to BINARY complete!\n"
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINELF_F1NOBL): $(OBJ_F1BL)
|
||||||
|
$(CXX) $(OBJ_F1BL) $(LDFLAGS) -o $@
|
||||||
|
@echo "Linking complete!\n"
|
||||||
|
$(SIZE) $(BINDIR)/$(BINELF_F1NOBL)
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINHEX_F1): $(BINDIR)/$(BINELF_F1)
|
||||||
|
$(CP) -O ihex $< $@
|
||||||
|
@echo "Objcopy from ELF to IHEX complete!\n"
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINBIN_F1): $(BINDIR)/$(BINELF_F1)
|
||||||
|
$(CP) -O binary $< $@
|
||||||
|
@echo "Objcopy from ELF to BINARY complete!\n"
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINELF_F1): $(OBJ_F1)
|
||||||
|
$(CXX) $(OBJ_F1) $(LDFLAGS) -o $@
|
||||||
|
@echo "Linking complete!\n"
|
||||||
|
$(SIZE) $(BINDIR)/$(BINELF_F1)
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINHEX_F4): $(BINDIR)/$(BINELF_F4)
|
||||||
|
$(CP) -O ihex $< $@
|
||||||
|
@echo "Objcopy from ELF to IHEX complete!\n"
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINBIN_F4): $(BINDIR)/$(BINELF_F4)
|
||||||
|
$(CP) -O binary $< $@
|
||||||
|
@echo "Objcopy from ELF to BINARY complete!\n"
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINELF_F4): $(OBJ_F4)
|
||||||
|
$(CXX) $(OBJ_F4) $(LDFLAGS) -o $@
|
||||||
|
@echo "Linking complete!\n"
|
||||||
|
$(SIZE) $(BINDIR)/$(BINELF_F4)
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINHEX_F7): $(BINDIR)/$(BINELF_F7)
|
||||||
|
$(CP) -O ihex $< $@
|
||||||
|
@echo "Objcopy from ELF to IHEX complete!\n"
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINBIN_F7): $(BINDIR)/$(BINELF_F7)
|
||||||
|
$(CP) -O binary $< $@
|
||||||
|
@echo "Objcopy from ELF to BINARY complete!\n"
|
||||||
|
|
||||||
|
$(BINDIR)/$(BINELF_F7): $(OBJ_F7)
|
||||||
|
$(CXX) $(OBJ_F7) $(LDFLAGS) -o $@
|
||||||
|
@echo "Linking complete!\n"
|
||||||
|
$(SIZE) $(BINDIR)/$(BINELF_F7)
|
||||||
|
|
||||||
|
$(OBJDIR_F1)/%.o: $(MMDVM_HS_PATH)/%.cpp
|
||||||
$(CXX) $(CXXFLAGS) $< -o $@
|
$(CXX) $(CXXFLAGS) $< -o $@
|
||||||
@echo "Compiled "$<"!\n"
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
%.o: %.c
|
$(OBJDIR_F4)/%.o: $(MMDVM_HS_PATH)/%.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F7)/%.o: $(MMDVM_HS_PATH)/%.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F1)/%.o: $(STD_LIB_F1)/%.c
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
@echo "Compiled "$<"!\n"
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
%.o: %.s
|
$(OBJDIR_F4)/%.o: $(STD_LIB_F4)/%.c
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
@echo "Assambled "$<"!\n"
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F7)/%.o: $(STD_LIB_F7)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F1)/%.o: $(SYS_DIR_F1)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F1)/%.o: $(STARTUP_DIR_F1)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F4)/%.o: $(SYS_DIR_F4)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F4)/%.o: $(STARTUP_DIR_F4)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F7)/%.o: $(SYS_DIR_F7)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F7)/%.o: $(STARTUP_DIR_F7)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F1)/%.o: $(USB_F1)/%.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
|
$(OBJDIR_F1)/%.o: $(USB_F1)/%.c
|
||||||
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
@echo "Compiled "$<"!\n"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(CLEANCMD)
|
$(CLEANCMD)
|
||||||
$(RM) GitVersion.h
|
$(RM) GitVersion.h
|
||||||
|
|
||||||
stlink:
|
stlink:
|
||||||
$(ST_FLASH) write bin/$(BINBIN) 0x8000000
|
$(ST_FLASH) $(ST_FLASH_OPTS) write bin/$(BINBIN_F1) 0x8000000
|
||||||
|
|
||||||
|
stlink-nobl:
|
||||||
|
$(ST_FLASH) $(ST_FLASH_OPTS) write bin/$(BINBIN_F1NOBL) 0x8000000
|
||||||
|
|
||||||
stlink-bl:
|
stlink-bl:
|
||||||
$(ST_FLASH) write STM32F10X_Lib/utils/bootloader/generic_boot20_pc13.bin 0x8000000
|
$(ST_FLASH) $(ST_FLASH_OPTS) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin 0x8000000
|
||||||
$(ST_FLASH) write bin/$(BINBIN) 0x8002000
|
sleep 3
|
||||||
|
$(ST_FLASH) $(ST_FLASH_OPTS) write bin/$(BINBIN_F1BL) 0x8002000
|
||||||
|
|
||||||
|
stlink-bl-old:
|
||||||
|
$(ST_FLASH) $(ST_FLASH_OPTS) write $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin 0x8000000
|
||||||
|
sleep 3
|
||||||
|
$(ST_FLASH) $(ST_FLASH_OPTS) write bin/$(BINBIN_F1BL) 0x8002000
|
||||||
|
|
||||||
serial:
|
serial:
|
||||||
$(STM32FLASH) -v -w bin/$(BINBIN) -g 0x0 $(devser)
|
$(STM32FLASH) -v -w bin/$(BINBIN_F1) -g 0x0 $(devser)
|
||||||
|
|
||||||
|
serial-nobl:
|
||||||
|
$(STM32FLASH) -v -w bin/$(BINBIN_F1NOBL) -g 0x0 $(devser)
|
||||||
|
|
||||||
serial-bl:
|
serial-bl:
|
||||||
$(STM32FLASH) -v -w STM32F10X_Lib/utils/bootloader/generic_boot20_pc13.bin -g 0x0 $(devser)
|
$(STM32FLASH) -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin -g 0x0 $(devser)
|
||||||
$(STM32FLASH) -v -w bin/$(BINBIN) -g 0x0 -S 0x08002000 $(devser)
|
sleep 3
|
||||||
|
$(STM32FLASH) -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser)
|
||||||
zumspot-pi:
|
|
||||||
|
serial-bl-old:
|
||||||
|
$(STM32FLASH) -v -w $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin -g 0x0 $(devser)
|
||||||
|
sleep 3
|
||||||
|
$(STM32FLASH) -v -w bin/$(BINBIN_F1BL) -g 0x0 -S 0x08002000 $(devser)
|
||||||
|
|
||||||
|
nano-hotspot:
|
||||||
ifneq ($(wildcard /usr/local/bin/stm32flash),)
|
ifneq ($(wildcard /usr/local/bin/stm32flash),)
|
||||||
/usr/local/bin/stm32flash -v -w bin/$(BINBIN) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0
|
/usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 200,-3,3:-200,3 /dev/ttyAMA0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(wildcard /usr/bin/stm32flash),)
|
ifneq ($(wildcard /usr/bin/stm32flash),)
|
||||||
/usr/bin/stm32flash -v -w bin/$(BINBIN) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0
|
/usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 200,-3,3:-200,3 /dev/ttyAMA0
|
||||||
|
endif
|
||||||
|
|
||||||
|
nano-dv:
|
||||||
|
ifneq ($(wildcard /usr/local/bin/stm32flash),)
|
||||||
|
/usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(wildcard /usr/bin/stm32flash),)
|
||||||
|
/usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 66,-67,67:-66,67 /dev/ttyAMA0
|
||||||
|
endif
|
||||||
|
|
||||||
|
d2rg_mmdvm_hs:
|
||||||
|
ifneq ($(wildcard /usr/local/bin/stm32flash),)
|
||||||
|
/usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 23,-22,22:-23,22 /dev/ttySC0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(wildcard /usr/bin/stm32flash),)
|
||||||
|
/usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 23,-22,22:-23,22 /dev/ttySC0
|
||||||
|
endif
|
||||||
|
|
||||||
|
zumspot-pi:
|
||||||
|
ifneq ($(wildcard /usr/local/bin/stm32flash),)
|
||||||
|
/usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(wildcard /usr/bin/stm32flash),)
|
||||||
|
/usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
mmdvm_hs_hat: zumspot-pi
|
mmdvm_hs_hat: zumspot-pi
|
||||||
|
|
||||||
|
mmdvm_hs_dual_hat: zumspot-pi
|
||||||
|
|
||||||
|
skybridge: zumspot-pi
|
||||||
|
|
||||||
|
hotpot-opipc_opipcplus:
|
||||||
|
ifneq ($(wildcard /usr/local/bin/stm32flash),)
|
||||||
|
/usr/local/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 198,-199,199:-198,199 /dev/ttyS3
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(wildcard /usr/bin/stm32flash),)
|
||||||
|
/usr/bin/stm32flash -v -w bin/$(BINBIN_F1) -g 0x0 -R -i 198,-199,199:-198,199 /dev/ttyS3
|
||||||
|
endif
|
||||||
|
|
||||||
|
mmdvm_hs_hat_opi: hotpot-opipc_opipcplus
|
||||||
|
|
||||||
|
mmdvm_hs_dual_hat_opi: hotpot-opipc_opipcplus
|
||||||
|
|
||||||
dfu:
|
dfu:
|
||||||
ifdef devser
|
ifdef devser
|
||||||
$(DFU_RST) $(devser) 750
|
$(DFU_RST) $(devser) 750
|
||||||
endif
|
endif
|
||||||
$(DFU_UTIL) -D bin/$(BINBIN) -d 1eaf:0003 -a 2 -R -R
|
$(DFU_UTIL) -D bin/$(BINBIN_F1BL) -d 1eaf:0003 -a 2 -R -R
|
||||||
|
|
||||||
ocd:
|
ocd:
|
||||||
ifneq ($(wildcard /usr/bin/openocd),)
|
ifneq ($(wildcard /usr/bin/openocd),)
|
||||||
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF) verify reset exit"
|
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF_F1) verify reset exit"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(wildcard /usr/local/bin/openocd),)
|
ifneq ($(wildcard /usr/local/bin/openocd),)
|
||||||
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF) verify reset exit"
|
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF_F1) verify reset exit"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(wildcard /opt/openocd/bin/openocd),)
|
ifneq ($(wildcard /opt/openocd/bin/openocd),)
|
||||||
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF) verify reset exit"
|
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF_F1) verify reset exit"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ocd-nobl:
|
||||||
|
ifneq ($(wildcard /usr/bin/openocd),)
|
||||||
|
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF_F1NOBL) verify reset exit"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(wildcard /usr/local/bin/openocd),)
|
||||||
|
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF_F1NOBL) verify reset exit"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(wildcard /opt/openocd/bin/openocd),)
|
||||||
|
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINELF_F1NOBL) verify reset exit"
|
||||||
|
endif
|
||||||
|
|
||||||
ocd-bl:
|
ocd-bl:
|
||||||
ifneq ($(wildcard /usr/bin/openocd),)
|
ifneq ($(wildcard /usr/bin/openocd),)
|
||||||
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program STM32F10X_Lib/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08000000"
|
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin verify reset exit 0x08000000"
|
||||||
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN) verify reset exit 0x08002000"
|
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN_F1BL) verify reset exit 0x08002000"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(wildcard /usr/local/bin/openocd),)
|
ifneq ($(wildcard /usr/local/bin/openocd),)
|
||||||
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program STM32F10X_Lib/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08000000"
|
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin verify reset exit 0x08000000"
|
||||||
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN) verify reset exit 0x08002000"
|
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN_F1BL) verify reset exit 0x08002000"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(wildcard /opt/openocd/bin/openocd),)
|
ifneq ($(wildcard /opt/openocd/bin/openocd),)
|
||||||
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program STM32F10X_Lib/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08000000"
|
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13_long_rst.bin verify reset exit 0x08000000"
|
||||||
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN) verify reset exit 0x08002000"
|
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN_F1BL) verify reset exit 0x08002000"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ocd-bl-old:
|
||||||
|
ifneq ($(wildcard /usr/bin/openocd),)
|
||||||
|
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08000000"
|
||||||
|
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN_F1BL) verify reset exit 0x08002000"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(wildcard /usr/local/bin/openocd),)
|
||||||
|
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08000000"
|
||||||
|
/usr/local/bin/openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN_F1BL) verify reset exit 0x08002000"
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(wildcard /opt/openocd/bin/openocd),)
|
||||||
|
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program $(F1_LIB_PATH)/utils/bootloader/generic_boot20_pc13.bin verify reset exit 0x08000000"
|
||||||
|
/opt/openocd/bin/openocd -f /opt/openocd/scripts/interface/stlink-v2-1.cfg -f /opt/openocd/share/openocd/scripts/target/stm32f1x.cfg -c "program bin/$(BINBIN_F1BL) verify reset exit 0x08002000"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Export the current git version if the index file exists, else 000...
|
# Export the current git version if the index file exists, else 000...
|
||||||
|
|
@ -250,4 +586,3 @@ endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.FORCE:
|
.FORCE:
|
||||||
|
|
||||||
|
|
|
||||||
35
NXDNDefines.h
Normal file
35
NXDNDefines.h
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2018 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(NXDNDEFINES_H)
|
||||||
|
#define NXDNDEFINES_H
|
||||||
|
|
||||||
|
const unsigned int NXDN_FRAME_LENGTH_BITS = 384U;
|
||||||
|
const unsigned int NXDN_FRAME_LENGTH_BYTES = NXDN_FRAME_LENGTH_BITS / 8U;
|
||||||
|
|
||||||
|
const unsigned int NXDN_FSW_LENGTH_BITS = 20U;
|
||||||
|
|
||||||
|
const uint8_t NXDN_FSW_BYTES[] = {0xCDU, 0xF5U, 0x90U};
|
||||||
|
const uint8_t NXDN_FSW_BYTES_MASK[] = {0xFFU, 0xFFU, 0xF0U};
|
||||||
|
const uint8_t NXDN_FSW_BYTES_LENGTH = 3U;
|
||||||
|
|
||||||
|
const uint32_t NXDN_FSW_BITS = 0x000CDF59U;
|
||||||
|
const uint32_t NXDN_FSW_BITS_MASK = 0x000FFFFFU;
|
||||||
|
|
||||||
|
#endif
|
||||||
137
NXDNRX.cpp
Normal file
137
NXDNRX.cpp
Normal file
|
|
@ -0,0 +1,137 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2009-2017,2018 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "NXDNRX.h"
|
||||||
|
#include "Utils.h"
|
||||||
|
|
||||||
|
const uint8_t MAX_FSW_BIT_START_ERRS = 0U;
|
||||||
|
const uint8_t MAX_FSW_BIT_RUN_ERRS = 3U;
|
||||||
|
|
||||||
|
const unsigned int MAX_FSW_FRAMES = 5U + 1U;
|
||||||
|
|
||||||
|
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
||||||
|
|
||||||
|
#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
|
||||||
|
|
||||||
|
CNXDNRX::CNXDNRX() :
|
||||||
|
m_state(NXDNRXS_NONE),
|
||||||
|
m_bitBuffer(0x00U),
|
||||||
|
m_outBuffer(),
|
||||||
|
m_buffer(NULL),
|
||||||
|
m_bufferPtr(0U),
|
||||||
|
m_lostCount(0U)
|
||||||
|
{
|
||||||
|
m_buffer = m_outBuffer + 1U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNXDNRX::reset()
|
||||||
|
{
|
||||||
|
m_state = NXDNRXS_NONE;
|
||||||
|
m_bitBuffer = 0x00U;
|
||||||
|
m_bufferPtr = 0U;
|
||||||
|
m_lostCount = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNXDNRX::databit(bool bit)
|
||||||
|
{
|
||||||
|
if (m_state == NXDNRXS_NONE)
|
||||||
|
processNone(bit);
|
||||||
|
else
|
||||||
|
processData(bit);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNXDNRX::processNone(bool bit)
|
||||||
|
{
|
||||||
|
m_bitBuffer <<= 1;
|
||||||
|
if (bit)
|
||||||
|
m_bitBuffer |= 0x01U;
|
||||||
|
|
||||||
|
// Fuzzy matching of the data sync bit sequence
|
||||||
|
if (countBits64((m_bitBuffer & NXDN_FSW_BITS_MASK) ^ NXDN_FSW_BITS) <= MAX_FSW_BIT_START_ERRS) {
|
||||||
|
DEBUG1("NXDNRX: sync found in None");
|
||||||
|
for (uint8_t i = 0U; i < NXDN_FSW_BYTES_LENGTH; i++)
|
||||||
|
m_buffer[i] = NXDN_FSW_BYTES[i];
|
||||||
|
|
||||||
|
m_lostCount = MAX_FSW_FRAMES;
|
||||||
|
m_bufferPtr = NXDN_FSW_LENGTH_BITS;
|
||||||
|
m_state = NXDNRXS_DATA;
|
||||||
|
|
||||||
|
io.setDecode(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNXDNRX::processData(bool bit)
|
||||||
|
{
|
||||||
|
m_bitBuffer <<= 1;
|
||||||
|
if (bit)
|
||||||
|
m_bitBuffer |= 0x01U;
|
||||||
|
|
||||||
|
WRITE_BIT1(m_buffer, m_bufferPtr, bit);
|
||||||
|
|
||||||
|
m_bufferPtr++;
|
||||||
|
if (m_bufferPtr > NXDN_FRAME_LENGTH_BITS)
|
||||||
|
reset();
|
||||||
|
|
||||||
|
// Only search for a sync in the right place +-2 symbols
|
||||||
|
if (m_bufferPtr >= (NXDN_FSW_LENGTH_BITS - 2U) && m_bufferPtr <= (NXDN_FSW_LENGTH_BITS + 2U)) {
|
||||||
|
// Fuzzy matching of the data sync bit sequence
|
||||||
|
if (countBits64((m_bitBuffer & NXDN_FSW_BITS_MASK) ^ NXDN_FSW_BITS) <= MAX_FSW_BIT_RUN_ERRS) {
|
||||||
|
DEBUG2("NXDNRX: found sync in Data, pos", m_bufferPtr - NXDN_FSW_LENGTH_BITS);
|
||||||
|
m_lostCount = MAX_FSW_FRAMES;
|
||||||
|
m_bufferPtr = NXDN_FSW_LENGTH_BITS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send a data frame to the host if the required number of bits have been received
|
||||||
|
if (m_bufferPtr == NXDN_FRAME_LENGTH_BITS) {
|
||||||
|
// We've not seen a data sync for too long, signal RXLOST and change to RX_NONE
|
||||||
|
m_lostCount--;
|
||||||
|
if (m_lostCount == 0U) {
|
||||||
|
DEBUG1("NXDNRX: sync timed out, lost lock");
|
||||||
|
io.setDecode(false);
|
||||||
|
serial.writeNXDNLost();
|
||||||
|
reset();
|
||||||
|
} else {
|
||||||
|
// Write data to host
|
||||||
|
m_outBuffer[0U] = m_lostCount == (MAX_FSW_FRAMES - 1U) ? 0x01U : 0x00U;
|
||||||
|
writeRSSIData(m_outBuffer);
|
||||||
|
|
||||||
|
// Start the next frame
|
||||||
|
::memset(m_outBuffer, 0x00U, NXDN_FRAME_LENGTH_BYTES + 3U);
|
||||||
|
m_bufferPtr = 0U;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNXDNRX::writeRSSIData(uint8_t* data)
|
||||||
|
{
|
||||||
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
uint16_t rssi = io.readRSSI();
|
||||||
|
|
||||||
|
data[49U] = (rssi >> 8) & 0xFFU;
|
||||||
|
data[50U] = (rssi >> 0) & 0xFFU;
|
||||||
|
|
||||||
|
serial.writeNXDNData(data, NXDN_FRAME_LENGTH_BYTES + 3U);
|
||||||
|
#else
|
||||||
|
serial.writeNXDNData(data, NXDN_FRAME_LENGTH_BYTES + 1U);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
52
NXDNRX.h
Normal file
52
NXDNRX.h
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(NXDNRX_H)
|
||||||
|
#define NXDNRX_H
|
||||||
|
|
||||||
|
#include "NXDNDefines.h"
|
||||||
|
|
||||||
|
enum NXDNRX_STATE {
|
||||||
|
NXDNRXS_NONE,
|
||||||
|
NXDNRXS_DATA
|
||||||
|
};
|
||||||
|
|
||||||
|
class CNXDNRX {
|
||||||
|
public:
|
||||||
|
CNXDNRX();
|
||||||
|
|
||||||
|
void databit(bool bit);
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
private:
|
||||||
|
NXDNRX_STATE m_state;
|
||||||
|
uint64_t m_bitBuffer;
|
||||||
|
uint8_t m_outBuffer[NXDN_FRAME_LENGTH_BYTES + 3U];
|
||||||
|
uint8_t* m_buffer;
|
||||||
|
uint16_t m_bufferPtr;
|
||||||
|
uint16_t m_lostCount;
|
||||||
|
|
||||||
|
void processNone(bool bit);
|
||||||
|
void processData(bool bit);
|
||||||
|
void writeRSSIData(uint8_t* data);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
132
NXDNTX.cpp
Normal file
132
NXDNTX.cpp
Normal file
|
|
@ -0,0 +1,132 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2009-2016,2018 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "NXDNTX.h"
|
||||||
|
|
||||||
|
#include "NXDNDefines.h"
|
||||||
|
|
||||||
|
const uint8_t NXDN_PREAMBLE[] = {0x57U, 0x75U, 0xFDU};
|
||||||
|
const uint8_t NXDN_SYNC = 0x5FU;
|
||||||
|
|
||||||
|
CNXDNTX::CNXDNTX() :
|
||||||
|
m_buffer(1500U),
|
||||||
|
m_poBuffer(),
|
||||||
|
m_poLen(0U),
|
||||||
|
m_poPtr(0U),
|
||||||
|
m_txDelay(240U), // 200ms
|
||||||
|
m_delay(false),
|
||||||
|
m_preamble(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNXDNTX::process()
|
||||||
|
{
|
||||||
|
if (m_buffer.getData() == 0U && m_poLen == 0U)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_poLen == 0U) {
|
||||||
|
if (!m_tx) {
|
||||||
|
m_delay = true;
|
||||||
|
m_preamble = false;
|
||||||
|
m_poLen = m_txDelay;
|
||||||
|
} else {
|
||||||
|
m_delay = false;
|
||||||
|
m_preamble = false;
|
||||||
|
for (uint8_t i = 0U; i < NXDN_FRAME_LENGTH_BYTES; i++)
|
||||||
|
m_poBuffer[m_poLen++] = m_buffer.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_poPtr = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_poLen > 0U) {
|
||||||
|
uint16_t space = io.getSpace();
|
||||||
|
|
||||||
|
while (space > 8U) {
|
||||||
|
if (m_delay) {
|
||||||
|
writeByte(NXDN_SYNC);
|
||||||
|
m_poPtr++;
|
||||||
|
} else if (m_preamble) {
|
||||||
|
writeByte(NXDN_PREAMBLE[m_poPtr++]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
writeByte(m_poBuffer[m_poPtr++]);
|
||||||
|
|
||||||
|
space -= 8U;
|
||||||
|
|
||||||
|
if (m_poPtr >= m_poLen) {
|
||||||
|
if (m_delay) {
|
||||||
|
m_preamble = true;
|
||||||
|
m_delay = false;
|
||||||
|
m_poPtr = 0U;
|
||||||
|
m_poLen = 3U;
|
||||||
|
} else {
|
||||||
|
m_poPtr = 0U;
|
||||||
|
m_poLen = 0U;
|
||||||
|
m_preamble = false;
|
||||||
|
m_delay = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CNXDNTX::writeData(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (length != (NXDN_FRAME_LENGTH_BYTES + 1U))
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
uint16_t space = m_buffer.getSpace();
|
||||||
|
if (space < NXDN_FRAME_LENGTH_BYTES)
|
||||||
|
return 5U;
|
||||||
|
|
||||||
|
for (uint8_t i = 0U; i < NXDN_FRAME_LENGTH_BYTES; i++)
|
||||||
|
m_buffer.put(data[i + 1U]);
|
||||||
|
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNXDNTX::writeByte(uint8_t c)
|
||||||
|
{
|
||||||
|
uint8_t bit;
|
||||||
|
uint8_t mask = 0x80U;
|
||||||
|
|
||||||
|
for (uint8_t i = 0U; i < 8U; i++, c <<= 1) {
|
||||||
|
if ((c & mask) == mask)
|
||||||
|
bit = 1U;
|
||||||
|
else
|
||||||
|
bit = 0U;
|
||||||
|
|
||||||
|
io.write(&bit, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNXDNTX::setTXDelay(uint8_t delay)
|
||||||
|
{
|
||||||
|
m_txDelay = 300U + uint16_t(delay) * 6U; // 500ms + tx delay
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t CNXDNTX::getSpace() const
|
||||||
|
{
|
||||||
|
return m_buffer.getSpace() / NXDN_FRAME_LENGTH_BYTES;
|
||||||
|
}
|
||||||
|
|
||||||
50
NXDNTX.h
Normal file
50
NXDNTX.h
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(NXDNTX_H)
|
||||||
|
#define NXDNTX_H
|
||||||
|
|
||||||
|
#include "SerialRB.h"
|
||||||
|
|
||||||
|
class CNXDNTX {
|
||||||
|
public:
|
||||||
|
CNXDNTX();
|
||||||
|
|
||||||
|
uint8_t writeData(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
|
void process();
|
||||||
|
|
||||||
|
void setTXDelay(uint8_t delay);
|
||||||
|
|
||||||
|
uint16_t getSpace() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CSerialRB m_buffer;
|
||||||
|
uint8_t m_poBuffer[60U];
|
||||||
|
uint16_t m_poLen;
|
||||||
|
uint16_t m_poPtr;
|
||||||
|
uint16_t m_txDelay;
|
||||||
|
bool m_delay;
|
||||||
|
bool m_preamble;
|
||||||
|
|
||||||
|
void writeByte(uint8_t c);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
33
P25Defines.h
33
P25Defines.h
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -21,26 +22,27 @@
|
||||||
|
|
||||||
const unsigned int P25_HDR_FRAME_LENGTH_BYTES = 99U;
|
const unsigned int P25_HDR_FRAME_LENGTH_BYTES = 99U;
|
||||||
const unsigned int P25_HDR_FRAME_LENGTH_BITS = P25_HDR_FRAME_LENGTH_BYTES * 8U;
|
const unsigned int P25_HDR_FRAME_LENGTH_BITS = P25_HDR_FRAME_LENGTH_BYTES * 8U;
|
||||||
const unsigned int P25_HDR_FRAME_LENGTH_SYMBOLS = P25_HDR_FRAME_LENGTH_BYTES * 4U;
|
|
||||||
|
|
||||||
const unsigned int P25_LDU_FRAME_LENGTH_BYTES = 216U;
|
const unsigned int P25_LDU_FRAME_LENGTH_BYTES = 216U;
|
||||||
const unsigned int P25_LDU_FRAME_LENGTH_BITS = P25_LDU_FRAME_LENGTH_BYTES * 8U;
|
const unsigned int P25_LDU_FRAME_LENGTH_BITS = P25_LDU_FRAME_LENGTH_BYTES * 8U;
|
||||||
const unsigned int P25_LDU_FRAME_LENGTH_SYMBOLS = P25_LDU_FRAME_LENGTH_BYTES * 4U;
|
|
||||||
|
|
||||||
const unsigned int P25_TERMLC_FRAME_LENGTH_BYTES = 54U;
|
const unsigned int P25_TERMLC_FRAME_LENGTH_BYTES = 54U;
|
||||||
const unsigned int P25_TERMLC_FRAME_LENGTH_BITS = P25_TERMLC_FRAME_LENGTH_BYTES * 8U;
|
const unsigned int P25_TERMLC_FRAME_LENGTH_BITS = P25_TERMLC_FRAME_LENGTH_BYTES * 8U;
|
||||||
const unsigned int P25_TERMLC_FRAME_LENGTH_SYMBOLS = P25_TERMLC_FRAME_LENGTH_BYTES * 4U;
|
|
||||||
|
|
||||||
const unsigned int P25_TERM_FRAME_LENGTH_BYTES = 18U;
|
const unsigned int P25_TERM_FRAME_LENGTH_BYTES = 18U;
|
||||||
const unsigned int P25_TERM_FRAME_LENGTH_BITS = P25_TERM_FRAME_LENGTH_BYTES * 8U;
|
const unsigned int P25_TERM_FRAME_LENGTH_BITS = P25_TERM_FRAME_LENGTH_BYTES * 8U;
|
||||||
const unsigned int P25_TERM_FRAME_LENGTH_SYMBOLS = P25_TERM_FRAME_LENGTH_BYTES * 4U;
|
|
||||||
|
|
||||||
const unsigned int P25_SYNC_LENGTH_BYTES = 6U;
|
const unsigned int P25_TSDU_FRAME_LENGTH_BYTES = 45U;
|
||||||
const unsigned int P25_SYNC_LENGTH_BITS = P25_SYNC_LENGTH_BYTES * 8U;
|
const unsigned int P25_TSDU_FRAME_LENGTH_BITS = P25_TSDU_FRAME_LENGTH_BYTES * 8U;
|
||||||
const unsigned int P25_SYNC_LENGTH_SYMBOLS = P25_SYNC_LENGTH_BYTES * 4U;
|
|
||||||
|
|
||||||
const unsigned int P25_NID_LENGTH_BITS = 64U;
|
const unsigned int P25_PDU_HDR_FRAME_LENGTH_BYTES = 45U;
|
||||||
const unsigned int P25_NID_LENGTH_SYMBOLS = 32U;
|
const unsigned int P25_PDU_HDR_FRAME_LENGTH_BITS = P25_PDU_HDR_FRAME_LENGTH_BYTES * 8U;
|
||||||
|
|
||||||
|
const unsigned int P25_SYNC_LENGTH_BYTES = 6U;
|
||||||
|
const unsigned int P25_SYNC_LENGTH_BITS = P25_SYNC_LENGTH_BYTES * 8U;
|
||||||
|
|
||||||
|
const unsigned int P25_NID_LENGTH_BYTES = 8U;
|
||||||
|
const unsigned int P25_NID_LENGTH_BITS = P25_NID_LENGTH_BYTES * 8U;
|
||||||
|
|
||||||
const uint8_t P25_SYNC_BYTES[] = {0x55U, 0x75U, 0xF5U, 0xFFU, 0x77U, 0xFFU};
|
const uint8_t P25_SYNC_BYTES[] = {0x55U, 0x75U, 0xF5U, 0xFFU, 0x77U, 0xFFU};
|
||||||
const uint8_t P25_SYNC_BYTES_LENGTH = 6U;
|
const uint8_t P25_SYNC_BYTES_LENGTH = 6U;
|
||||||
|
|
@ -48,11 +50,12 @@ const uint8_t P25_SYNC_BYTES_LENGTH = 6U;
|
||||||
const uint64_t P25_SYNC_BITS = 0x00005575F5FF77FFU;
|
const uint64_t P25_SYNC_BITS = 0x00005575F5FF77FFU;
|
||||||
const uint64_t P25_SYNC_BITS_MASK = 0x0000FFFFFFFFFFFFU;
|
const uint64_t P25_SYNC_BITS_MASK = 0x0000FFFFFFFFFFFFU;
|
||||||
|
|
||||||
// 5 5 7 5 F 5 F F 7 7 F F
|
const uint8_t P25_DUID_HDU = 0x00U; // Header Data Unit
|
||||||
// 01 01 01 01 01 11 01 01 11 11 01 01 11 11 11 11 01 11 01 11 11 11 11 11
|
const uint8_t P25_DUID_TDU = 0x03U; // Simple Terminator Data Unit
|
||||||
// +3 +3 +3 +3 +3 -3 +3 +3 -3 -3 +3 +3 -3 -3 -3 -3 +3 -3 +3 -3 -3 -3 -3 -3
|
const uint8_t P25_DUID_LDU1 = 0x05U; // Logical Link Data Unit 1
|
||||||
|
const uint8_t P25_DUID_TSDU = 0x07U; // Trunking System Data Unit
|
||||||
const uint32_t P25_SYNC_SYMBOLS = 0x00FB30A0U;
|
const uint8_t P25_DUID_LDU2 = 0x0AU; // Logical Link Data Unit 2
|
||||||
const uint32_t P25_SYNC_SYMBOLS_MASK = 0x00FFFFFFU;
|
const uint8_t P25_DUID_PDU = 0x0CU; // Packet Data Unit
|
||||||
|
const uint8_t P25_DUID_TDULC = 0x0FU; // Terminator Data Unit with Link Control
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
155
P25RX.cpp
155
P25RX.cpp
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -31,33 +31,44 @@ const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02
|
||||||
|
|
||||||
#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
|
#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
|
||||||
|
|
||||||
|
const uint16_t NOENDPTR = 9999U;
|
||||||
|
|
||||||
CP25RX::CP25RX() :
|
CP25RX::CP25RX() :
|
||||||
m_prev(false),
|
|
||||||
m_state(P25RXS_NONE),
|
m_state(P25RXS_NONE),
|
||||||
m_bitBuffer(0x00U),
|
m_bitBuffer(0x00U),
|
||||||
m_outBuffer(),
|
m_outBuffer(),
|
||||||
m_buffer(NULL),
|
m_buffer(NULL),
|
||||||
m_bufferPtr(0U),
|
m_bufferPtr(0U),
|
||||||
m_lostCount(0U)
|
m_endPtr(NOENDPTR),
|
||||||
|
m_lostCount(0U),
|
||||||
|
m_duid(0U)
|
||||||
{
|
{
|
||||||
m_buffer = m_outBuffer + 1U;
|
m_buffer = m_outBuffer + 1U;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CP25RX::reset()
|
void CP25RX::reset()
|
||||||
{
|
{
|
||||||
m_prev = false;
|
|
||||||
m_state = P25RXS_NONE;
|
m_state = P25RXS_NONE;
|
||||||
m_bitBuffer = 0x00U;
|
m_bitBuffer = 0x00U;
|
||||||
m_bufferPtr = 0U;
|
m_bufferPtr = 0U;
|
||||||
|
m_endPtr = NOENDPTR;
|
||||||
m_lostCount = 0U;
|
m_lostCount = 0U;
|
||||||
|
m_duid = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CP25RX::databit(bool bit)
|
void CP25RX::databit(bool bit)
|
||||||
{
|
{
|
||||||
if (m_state == P25RXS_NONE)
|
switch (m_state) {
|
||||||
processNone(bit);
|
case P25RXS_HDR:
|
||||||
else
|
processHdr(bit);
|
||||||
processData(bit);
|
break;
|
||||||
|
case P25RXS_LDU:
|
||||||
|
processLdu(bit);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
processNone(bit);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CP25RX::processNone(bool bit)
|
void CP25RX::processNone(bool bit)
|
||||||
|
|
@ -71,72 +82,106 @@ void CP25RX::processNone(bool bit)
|
||||||
DEBUG1("P25RX: sync found in None");
|
DEBUG1("P25RX: sync found in None");
|
||||||
for (uint8_t i = 0U; i < P25_SYNC_LENGTH_BYTES; i++)
|
for (uint8_t i = 0U; i < P25_SYNC_LENGTH_BYTES; i++)
|
||||||
m_buffer[i] = P25_SYNC_BYTES[i];
|
m_buffer[i] = P25_SYNC_BYTES[i];
|
||||||
|
|
||||||
m_lostCount = MAX_SYNC_FRAMES;
|
m_lostCount = MAX_SYNC_FRAMES;
|
||||||
m_bufferPtr = P25_SYNC_LENGTH_BITS;
|
m_bufferPtr = P25_SYNC_LENGTH_BITS;
|
||||||
m_state = P25RXS_DATA;
|
m_state = P25RXS_HDR;
|
||||||
|
|
||||||
io.setDecode(true);
|
io.setDecode(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CP25RX::processData(bool bit)
|
void CP25RX::processHdr(bool bit)
|
||||||
{
|
{
|
||||||
m_bitBuffer <<= 1;
|
m_bitBuffer <<= 1;
|
||||||
if (bit)
|
if (bit)
|
||||||
m_bitBuffer |= 0x01U;
|
m_bitBuffer |= 0x01U;
|
||||||
|
|
||||||
WRITE_BIT1(m_buffer, m_bufferPtr, bit);
|
WRITE_BIT1(m_buffer, m_bufferPtr, bit);
|
||||||
m_bufferPtr++;
|
|
||||||
|
|
||||||
// Search for an early sync to indicate an LDU following a header
|
m_bufferPtr++;
|
||||||
if (m_bufferPtr >= (P25_HDR_FRAME_LENGTH_BITS + P25_SYNC_LENGTH_BITS - 1U) && m_bufferPtr <= (P25_HDR_FRAME_LENGTH_BITS + P25_SYNC_LENGTH_BITS + 1U)) {
|
if (m_bufferPtr > P25_LDU_FRAME_LENGTH_BITS)
|
||||||
|
reset();
|
||||||
|
|
||||||
|
if (m_bufferPtr == P25_SYNC_LENGTH_BITS + 16U) {
|
||||||
|
// FIXME: we should check and correct for errors in NID first!
|
||||||
|
m_duid = m_buffer[7U] & 0x0F;
|
||||||
|
|
||||||
|
if (m_duid != P25_DUID_HDU && m_duid != P25_DUID_TSDU &&
|
||||||
|
m_duid != P25_DUID_TDU && m_duid != P25_DUID_TDULC) {
|
||||||
|
m_lostCount = MAX_SYNC_FRAMES;
|
||||||
|
m_state = P25RXS_LDU;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setEndPtr();
|
||||||
|
DEBUG2("P25RX: DUID", m_duid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search for end of header frame
|
||||||
|
if (m_bufferPtr == m_endPtr) {
|
||||||
|
m_outBuffer[0U] = 0x01U;
|
||||||
|
serial.writeP25Hdr(m_outBuffer, (m_endPtr / 8U) + 1U);
|
||||||
|
|
||||||
|
m_lostCount = MAX_SYNC_FRAMES;
|
||||||
|
m_bufferPtr = 0U;
|
||||||
|
m_state = P25RXS_LDU;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CP25RX::processLdu(bool bit)
|
||||||
|
{
|
||||||
|
m_bitBuffer <<= 1;
|
||||||
|
if (bit)
|
||||||
|
m_bitBuffer |= 0x01U;
|
||||||
|
|
||||||
|
WRITE_BIT1(m_buffer, m_bufferPtr, bit);
|
||||||
|
|
||||||
|
m_bufferPtr++;
|
||||||
|
if (m_bufferPtr > P25_LDU_FRAME_LENGTH_BITS)
|
||||||
|
reset();
|
||||||
|
|
||||||
|
// Only search for a sync in the right place +-2 bits
|
||||||
|
if (m_bufferPtr >= (P25_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (P25_SYNC_LENGTH_BITS + 2U)) {
|
||||||
// Fuzzy matching of the data sync bit sequence
|
// Fuzzy matching of the data sync bit sequence
|
||||||
if (countBits64((m_bitBuffer & P25_SYNC_BITS_MASK) ^ P25_SYNC_BITS) <= SYNC_BIT_RUN_ERRS) {
|
if (countBits64((m_bitBuffer & P25_SYNC_BITS_MASK) ^ P25_SYNC_BITS) <= SYNC_BIT_RUN_ERRS) {
|
||||||
DEBUG2("P25RX: found LDU sync in Data, pos", m_bufferPtr - P25_SYNC_LENGTH_BITS);
|
DEBUG1("P25RX: found sync in LDU");
|
||||||
|
|
||||||
m_outBuffer[0U] = 0x01U;
|
|
||||||
serial.writeP25Hdr(m_outBuffer, P25_HDR_FRAME_LENGTH_BYTES + 1U);
|
|
||||||
|
|
||||||
// Restore the sync that's now in the wrong place
|
|
||||||
for (uint8_t i = 0U; i < P25_SYNC_LENGTH_BYTES; i++)
|
|
||||||
m_buffer[i] = P25_SYNC_BYTES[i];
|
|
||||||
|
|
||||||
m_lostCount = MAX_SYNC_FRAMES;
|
m_lostCount = MAX_SYNC_FRAMES;
|
||||||
m_bufferPtr = P25_SYNC_LENGTH_BITS;
|
m_bufferPtr = P25_SYNC_LENGTH_BITS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only search for a sync in the right place +-2 symbols
|
if (m_bufferPtr == P25_SYNC_LENGTH_BITS + 16U) {
|
||||||
if (m_bufferPtr >= (P25_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (P25_SYNC_LENGTH_BITS + 2U)) {
|
// We use DUID here only to detect TDU for EOT
|
||||||
// Fuzzy matching of the data sync bit sequence
|
// FIXME: we should check and correct for errors in NID first!
|
||||||
if (countBits64((m_bitBuffer & P25_SYNC_BITS_MASK) ^ P25_SYNC_BITS) <= SYNC_BIT_RUN_ERRS) {
|
m_duid = m_buffer[7U] & 0x0F;
|
||||||
DEBUG2("P25RX: found sync in Data, pos", m_bufferPtr - P25_SYNC_LENGTH_BITS);
|
setEndPtr();
|
||||||
m_lostCount = MAX_SYNC_FRAMES;
|
DEBUG2("P25RX: DUID", m_duid);
|
||||||
m_bufferPtr = P25_SYNC_LENGTH_BITS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a data frame to the host if the required number of bits have been received
|
// Send a data frame to the host if the required number of bits have been received
|
||||||
if (m_bufferPtr == P25_LDU_FRAME_LENGTH_BITS) {
|
if (m_bufferPtr == P25_LDU_FRAME_LENGTH_BITS) {
|
||||||
// We've not seen a data sync for too long, signal RXLOST and change to RX_NONE
|
|
||||||
m_lostCount--;
|
m_lostCount--;
|
||||||
|
// We've not seen a data sync for too long, signal RXLOST and change to RX_NONE
|
||||||
if (m_lostCount == 0U) {
|
if (m_lostCount == 0U) {
|
||||||
DEBUG1("P25RX: sync timed out, lost lock");
|
DEBUG1("P25RX: sync timed out, lost lock");
|
||||||
io.setDecode(false);
|
io.setDecode(false);
|
||||||
|
|
||||||
serial.writeP25Lost();
|
serial.writeP25Lost();
|
||||||
|
reset();
|
||||||
m_state = P25RXS_NONE;
|
|
||||||
} else {
|
} else {
|
||||||
|
// Write data to host
|
||||||
m_outBuffer[0U] = m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U;
|
m_outBuffer[0U] = m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U;
|
||||||
|
|
||||||
writeRSSILdu(m_outBuffer);
|
writeRSSILdu(m_outBuffer);
|
||||||
|
|
||||||
// Start the next frame
|
// Start the next frame
|
||||||
::memset(m_outBuffer, 0x00U, P25_LDU_FRAME_LENGTH_BYTES + 3U);
|
::memset(m_outBuffer, 0x00U, P25_LDU_FRAME_LENGTH_BYTES + 3U);
|
||||||
m_bufferPtr = 0U;
|
m_bufferPtr = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if we found a TDU to avoid a false "lost lock"
|
||||||
|
if (m_duid == P25_DUID_TDU || m_duid == P25_DUID_TDULC) {
|
||||||
|
reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,14 +189,42 @@ void CP25RX::writeRSSILdu(uint8_t* ldu)
|
||||||
{
|
{
|
||||||
#if defined(SEND_RSSI_DATA)
|
#if defined(SEND_RSSI_DATA)
|
||||||
uint16_t rssi = io.readRSSI();
|
uint16_t rssi = io.readRSSI();
|
||||||
|
|
||||||
ldu[217U] = (rssi >> 8) & 0xFFU;
|
ldu[217U] = (rssi >> 8) & 0xFFU;
|
||||||
ldu[218U] = (rssi >> 0) & 0xFFU;
|
ldu[218U] = (rssi >> 0) & 0xFFU;
|
||||||
|
|
||||||
serial.writeP25Ldu(ldu, P25_LDU_FRAME_LENGTH_BYTES + 3U);
|
serial.writeP25Ldu(ldu, P25_LDU_FRAME_LENGTH_BYTES + 3U);
|
||||||
#else
|
#else
|
||||||
serial.writeP25Ldu(ldu, P25_LDU_FRAME_LENGTH_BYTES + 1U);
|
serial.writeP25Ldu(ldu, P25_LDU_FRAME_LENGTH_BYTES + 1U);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CP25RX::setEndPtr()
|
||||||
|
{
|
||||||
|
switch (m_duid) {
|
||||||
|
case P25_DUID_HDU:
|
||||||
|
DEBUG1("P25RX: sync found in HDU");
|
||||||
|
m_endPtr = P25_HDR_FRAME_LENGTH_BITS;
|
||||||
|
break;
|
||||||
|
case P25_DUID_TDU:
|
||||||
|
DEBUG1("P25RX: sync found in TDU");
|
||||||
|
m_endPtr = P25_TERM_FRAME_LENGTH_BITS;
|
||||||
|
break;
|
||||||
|
case P25_DUID_TSDU:
|
||||||
|
DEBUG1("P25RX: sync found in TSDU");
|
||||||
|
m_endPtr = P25_TSDU_FRAME_LENGTH_BITS;
|
||||||
|
break;
|
||||||
|
case P25_DUID_PDU:
|
||||||
|
// FIXME: not sure about PDU lengths since they have arbitrary length...
|
||||||
|
DEBUG1("P25RX: sync found in PDU");
|
||||||
|
m_endPtr = P25_PDU_HDR_FRAME_LENGTH_BITS;
|
||||||
|
break;
|
||||||
|
case P25_DUID_TDULC:
|
||||||
|
DEBUG1("P25RX: sync found in TDULC");
|
||||||
|
m_endPtr = P25_TERMLC_FRAME_LENGTH_BITS;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
m_endPtr = P25_LDU_FRAME_LENGTH_BITS;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
12
P25RX.h
12
P25RX.h
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -24,7 +24,8 @@
|
||||||
|
|
||||||
enum P25RX_STATE {
|
enum P25RX_STATE {
|
||||||
P25RXS_NONE,
|
P25RXS_NONE,
|
||||||
P25RXS_DATA
|
P25RXS_HDR,
|
||||||
|
P25RXS_LDU
|
||||||
};
|
};
|
||||||
|
|
||||||
class CP25RX {
|
class CP25RX {
|
||||||
|
|
@ -36,17 +37,20 @@ public:
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_prev;
|
|
||||||
P25RX_STATE m_state;
|
P25RX_STATE m_state;
|
||||||
uint64_t m_bitBuffer;
|
uint64_t m_bitBuffer;
|
||||||
uint8_t m_outBuffer[P25_LDU_FRAME_LENGTH_BYTES + 3U];
|
uint8_t m_outBuffer[P25_LDU_FRAME_LENGTH_BYTES + 3U];
|
||||||
uint8_t* m_buffer;
|
uint8_t* m_buffer;
|
||||||
uint16_t m_bufferPtr;
|
uint16_t m_bufferPtr;
|
||||||
|
uint16_t m_endPtr;
|
||||||
uint16_t m_lostCount;
|
uint16_t m_lostCount;
|
||||||
|
uint8_t m_duid;
|
||||||
|
|
||||||
void processNone(bool bit);
|
void processNone(bool bit);
|
||||||
void processData(bool bit);
|
void processHdr(bool bit);
|
||||||
|
void processLdu(bool bit);
|
||||||
void writeRSSILdu(uint8_t* data);
|
void writeRSSILdu(uint8_t* data);
|
||||||
|
void setEndPtr();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -31,7 +31,7 @@ m_poBuffer(),
|
||||||
m_poLen(0U),
|
m_poLen(0U),
|
||||||
m_poPtr(0U),
|
m_poPtr(0U),
|
||||||
m_txDelay(240U), // 200ms
|
m_txDelay(240U), // 200ms
|
||||||
m_count(0U)
|
m_delay(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,7 +43,6 @@ void CP25TX::process()
|
||||||
if (m_poLen == 0U) {
|
if (m_poLen == 0U) {
|
||||||
if (!m_tx) {
|
if (!m_tx) {
|
||||||
m_delay = true;
|
m_delay = true;
|
||||||
m_count = 0U;
|
|
||||||
m_poLen = m_txDelay;
|
m_poLen = m_txDelay;
|
||||||
} else {
|
} else {
|
||||||
uint8_t length = m_buffer.get();
|
uint8_t length = m_buffer.get();
|
||||||
|
|
|
||||||
3
P25TX.h
3
P25TX.h
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -40,7 +40,6 @@ private:
|
||||||
uint16_t m_poLen;
|
uint16_t m_poLen;
|
||||||
uint16_t m_poPtr;
|
uint16_t m_poPtr;
|
||||||
uint16_t m_txDelay;
|
uint16_t m_txDelay;
|
||||||
uint32_t m_count;
|
|
||||||
bool m_delay;
|
bool m_delay;
|
||||||
|
|
||||||
void writeByte(uint8_t c);
|
void writeByte(uint8_t c);
|
||||||
|
|
|
||||||
27
POCSAGDefines.h
Normal file
27
POCSAGDefines.h
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2009-2018 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2018 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(POCSAGDEFINES_H)
|
||||||
|
#define POCSAGDEFINES_H
|
||||||
|
|
||||||
|
const uint16_t POCSAG_PREAMBLE_LENGTH_BYTES = 18U * sizeof(uint32_t);
|
||||||
|
const uint16_t POCSAG_FRAME_LENGTH_BYTES = 17U * sizeof(uint32_t);
|
||||||
|
const uint8_t POCSAG_SYNC = 0xAAU;
|
||||||
|
|
||||||
|
#endif
|
||||||
154
POCSAGTX.cpp
Normal file
154
POCSAGTX.cpp
Normal file
|
|
@ -0,0 +1,154 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2018,2019 by Andy Uribe CA6JAU
|
||||||
|
* Copyright (C) 2019 by Florian Wolters DF2ET
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "POCSAGTX.h"
|
||||||
|
#include "POCSAGDefines.h"
|
||||||
|
|
||||||
|
CPOCSAGTX::CPOCSAGTX() :
|
||||||
|
m_buffer(1000U),
|
||||||
|
m_poBuffer(),
|
||||||
|
m_poLen(0U),
|
||||||
|
m_poPtr(0U),
|
||||||
|
m_txDelay(POCSAG_PREAMBLE_LENGTH_BYTES),
|
||||||
|
m_delay(false),
|
||||||
|
m_cal(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPOCSAGTX::process()
|
||||||
|
{
|
||||||
|
if (m_cal) {
|
||||||
|
m_delay = false;
|
||||||
|
createCal();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_poLen == 0U && m_buffer.getData() > 0U) {
|
||||||
|
if (!m_tx) {
|
||||||
|
m_delay = true;
|
||||||
|
m_poLen = m_txDelay;
|
||||||
|
} else {
|
||||||
|
m_delay = false;
|
||||||
|
for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++)
|
||||||
|
m_poBuffer[i] = m_buffer.get();
|
||||||
|
|
||||||
|
m_poLen = POCSAG_FRAME_LENGTH_BYTES;
|
||||||
|
}
|
||||||
|
m_poPtr = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_poLen > 0U) {
|
||||||
|
uint16_t space = io.getSpace();
|
||||||
|
|
||||||
|
while (space > 8U) {
|
||||||
|
if (m_delay) {
|
||||||
|
m_poPtr++;
|
||||||
|
writeByte(POCSAG_SYNC);
|
||||||
|
} else
|
||||||
|
writeByte(m_poBuffer[m_poPtr++]);
|
||||||
|
|
||||||
|
space -= 8U;
|
||||||
|
|
||||||
|
if (m_poPtr >= m_poLen) {
|
||||||
|
m_poPtr = 0U;
|
||||||
|
m_poLen = 0U;
|
||||||
|
m_delay = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPOCSAGTX::busy()
|
||||||
|
{
|
||||||
|
if (m_poLen > 0U || m_buffer.getData() > 0U)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CPOCSAGTX::writeData(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (length != POCSAG_FRAME_LENGTH_BYTES)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
uint16_t space = m_buffer.getSpace();
|
||||||
|
if (space < POCSAG_FRAME_LENGTH_BYTES)
|
||||||
|
return 5U;
|
||||||
|
|
||||||
|
for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++)
|
||||||
|
m_buffer.put(data[i]);
|
||||||
|
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPOCSAGTX::writeByte(uint8_t c)
|
||||||
|
{
|
||||||
|
uint8_t bit;
|
||||||
|
uint8_t mask = 0x80U;
|
||||||
|
|
||||||
|
for (uint8_t i = 0U; i < 8U; i++, c <<= 1) {
|
||||||
|
if ((c & mask) == mask)
|
||||||
|
bit = 1U;
|
||||||
|
else
|
||||||
|
bit = 0U;
|
||||||
|
|
||||||
|
io.write(&bit, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPOCSAGTX::setTXDelay(uint8_t delay)
|
||||||
|
{
|
||||||
|
m_txDelay = POCSAG_PREAMBLE_LENGTH_BYTES + (delay * 3U) / 2U;
|
||||||
|
|
||||||
|
if (m_txDelay > 150U)
|
||||||
|
m_txDelay = 150U;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CPOCSAGTX::getSpace() const
|
||||||
|
{
|
||||||
|
return m_buffer.getSpace() / POCSAG_FRAME_LENGTH_BYTES;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t CPOCSAGTX::setCal(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (length != 1U)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
m_cal = data[0U] == 1U;
|
||||||
|
|
||||||
|
if (m_cal)
|
||||||
|
io.ifConf(STATE_POCSAG, true);
|
||||||
|
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPOCSAGTX::createCal()
|
||||||
|
{
|
||||||
|
// 600 Hz square wave generation
|
||||||
|
for (unsigned int i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) {
|
||||||
|
m_poBuffer[i] = 0xAAU;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_poLen = POCSAG_FRAME_LENGTH_BYTES;
|
||||||
|
|
||||||
|
m_poPtr = 0U;
|
||||||
|
}
|
||||||
54
POCSAGTX.h
Normal file
54
POCSAGTX.h
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2018,2019 by Andy Uribe CA6JAU
|
||||||
|
* Copyright (C) 2019 by Florian Wolters DF2ET
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(POCSAGTX_H)
|
||||||
|
#define POCSAGTX_H
|
||||||
|
|
||||||
|
class CPOCSAGTX {
|
||||||
|
public:
|
||||||
|
CPOCSAGTX();
|
||||||
|
|
||||||
|
uint8_t writeData(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
|
void setTXDelay(uint8_t delay);
|
||||||
|
|
||||||
|
uint8_t setCal(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
|
void createCal();
|
||||||
|
|
||||||
|
uint8_t getSpace() const;
|
||||||
|
|
||||||
|
void process();
|
||||||
|
|
||||||
|
bool busy();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CSerialRB m_buffer;
|
||||||
|
uint8_t m_poBuffer[200U];
|
||||||
|
uint16_t m_poLen;
|
||||||
|
uint16_t m_poPtr;
|
||||||
|
uint16_t m_txDelay;
|
||||||
|
bool m_delay;
|
||||||
|
bool m_cal;
|
||||||
|
|
||||||
|
void writeByte(uint8_t c);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
526
README.md
526
README.md
|
|
@ -1,166 +1,360 @@
|
||||||
# Introduction
|
# Introduction
|
||||||
|
|
||||||
This is the source code of ZUMspot, personal hotspot (ADF7021 version of the MMDVM firmware), based on Jonathan G4KLX's MMDVM software. This firmware supports D-Star, DMR, System Fusion and P25 digital modes.
|
This is the source code of ZUMspot/MMDVM_HS firmware for personal hotspots (ADF7021 version of the MMDVM firmware), based on Jonathan G4KLX's [MMDVM](https://github.com/g4klx/MMDVM) software. This firmware supports D-Star, DMR, System Fusion, P25 and NXDN digital voice modes and POCSAG 1200 pager protocol.
|
||||||
|
|
||||||
This software is intended to be run on STM32F103 microcontroller. You can build this code using Arduino IDE with STM32duino package, or using "make" with ARM GCC tools. Also, Arduino with 3.3 V I/O (Arduino Due and Zero) and Teensy (3.1, 3.2, 3.5 or 3.6) are supported.
|
This software is intended to be run on STM32F103 microcontroller. Also, Arduino with 3.3 V I/O (Arduino Due and Zero) and Teensy (3.1, 3.2, 3.5 or 3.6) are supported. You can build this code using Arduino IDE with Roger Clark's [STM32duino](https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/ZUMspot) package, or using command line tools with ARM GCC tools. The preferred method under Windows is using STM32duino, and under Linux or macOS (command line) is using [STM32F10X_Lib](https://github.com/juribeparada/STM32F10X_Lib).
|
||||||
|
|
||||||
This software is licenced under the GPL v2 and is intended for amateur and educational use only. Use of this software for commercial purposes is strictly forbidden.
|
This software comes with ABSOLUTELY NO WARRANTY, it is provided "AS IS" with the hope to be useful, use at your own risk. This firmware software is intended to be use into personal hotspots hardware, with a few mili-watts of RF power and short ranges (indoor). Because this is an amateur project doing by developers under their free time, and due to ADF7021 limitations, please DO NOT EXPECT high performance or full compliant to any digital voice standard of this firmware or any board based on this firmware.
|
||||||
|
|
||||||
# Features
|
This software is licenced under the GPL v2 and is intended for amateur and educational use only. Use of this software for commercial purposes is strictly forbidden.
|
||||||
|
|
||||||
- Supported modes: D-Star, DMR, Yaesu Fusion and P25 Phase 1
|
# Features
|
||||||
- Automatic mode detection (scanning)
|
|
||||||
- G4KLX software suite: MMDVMHost, ircDDBGateway, YSFGateway, P25Gateway and DMRGateway
|
- Supported modes: D-Star, DMR, Yaesu Fusion, P25 Phase 1 and NXDN
|
||||||
- Bands: 144, 220, 430 and 900 MHz (VHF requires external inductor)
|
- Other modes: POCSAG 1200
|
||||||
- Status LEDs (PTT, COR and digital modes)
|
- Automatic mode detection (scanning)
|
||||||
- Serial repeater port for Nextion displays
|
- G4KLX software suite: [MMDVMHost](https://github.com/g4klx/MMDVMHost), [ircDDBGateway](https://github.com/g4klx/ircDDBGateway), [YSFGateway](https://github.com/g4klx/YSFClients), [P25Gateway](https://github.com/g4klx/P25Clients), [DMRGateway](https://github.com/g4klx/DMRGateway), [NXDNGateway](https://github.com/g4klx/NXDNClients),
|
||||||
- Support for native USB port in STM32F103 CPU
|
[DAPNETGateway](https://github.com/g4klx/DAPNETGateway) and [MMDVMCal](https://github.com/g4klx/MMDVMCal)
|
||||||
- RSSI support
|
- Bands: 144, 220, 430 and 900 MHz (VHF requires external inductor)
|
||||||
- Full duplex support with two ADF7021 (experimental)
|
- Status LEDs (PTT, COR and digital modes)
|
||||||
|
- Serial repeater port for Nextion displays
|
||||||
# Important notes
|
- Support for native USB port in STM32F103 CPU
|
||||||
|
- RSSI support
|
||||||
The ADF7021 (or RF7021SE module) must operate with a 14.7456 MHz TCXO and with at least 2 ppm of frequency stability. You could use also 12.2880 MHz TCXO, but this frequency configuration has less testing. Any other TCXO frequency is not supported.
|
- CW ID support
|
||||||
|
- Full duplex support with two ADF7021
|
||||||
The jumper wire to CLKOUT in RF7021SE module is not longer required for lastest MMDVM_HS firmware. But CE pin connection of ADF7021 is required for proper operation of ZUMspot.
|
|
||||||
|
# Known issues
|
||||||
Be aware that some Blue Pill STM32F103 board are defectives. If you have trouble with USB, please check this: http://wiki.stm32duino.com/index.php?title=Blue_Pill
|
|
||||||
|
## Common issues for simplex and duplex boards
|
||||||
VHF (144-148 MHz) support for ZUMSpot is added by an external 18 nH inductor between L1 and L2 pins of ADF7021. This will enable dual band (VHF/UHF) operation.
|
|
||||||
|
- High RX BER or not RX, poor TX audio (4FSK modes): adjust frequency offset, specially RXOffset.
|
||||||
Dual ADF7021 for full duplex operation (#define DUPLEX in Config.h) will work only with a big RX/TX frequency separation (5 MHz or more in UHF band for example) and proper antenna filtering. At the moment #define ADF7021_CARRIER_BOARD (Config.h) with STM32F103 platform is supported. Please see [BUILD.md](BUILD.md) for pinout details.
|
- Not instantaneous mode detection (2 modes or more enabled): mode detection could be slow and sometimes you need to hold PTT several seconds, in order to activate the hotspot. There is no solution for that, since ADF7021 works only one mode at once. You can disable mode scanning, enabling just one mode.
|
||||||
|
- Poor audio with MD380: increase DMR deviation to 55 % or 60 %.
|
||||||
If you can't decode any 4FSK modulation (DMR, YSF and P25) with your ZUMspot, the common solution is to adjust RX frequency offset (RXOffset) in your MMDVM.ini file. Please try with steps of +-100 Hz until you get low BER. If you don't have test equipment, the only procedure is trial and error. In some cases TXOffset adjustment is also required for proper radio decoding. If you have test equipment, enable TEST_TX feature (see "Hidden functions" in [BUILD.md](BUILD.md) document).
|
- Bad RX sensitivity: this is not a firmware issue, ADF7021 has a minimum signal detection around -109 dBm in DMR, but RX performance depends on RF board design, external RX noise, frequency, etc. At the moment only original ZUMspot RPi can reach the best RX sensitivity in 70 cm band.
|
||||||
|
- Not working with RPi 3B+ (USB): be sure your firmware version is >= 1.4.8 and update to new USB bootloader with long reset pulse (make stlink-bl, for example).
|
||||||
# Quick start
|
- Not working with USB (not RPi 3B+): compile with "LONG_USB_RESET" option disabled, and use old bootloader (make stlink-bl-old, for example).
|
||||||
|
|
||||||
Please see [BUILD.md](BUILD.md) for more details, and also MMDVM Yahoo Groups. You also can check at MMDVM_HS/scripts folder for some automatic tasks.
|
## Duplex boards
|
||||||
|
|
||||||
## Binary firmware installation
|
- Very difficult DMR activation ("repeater fail" error): disable mode scanning, select just DMR mode.
|
||||||
|
- Not DMR activation ("repeater fail" error) with MD380, Ailunce HD1 or some other radios: increase DMR deviation to 55 % or 60 %.
|
||||||
Please check the latest firmware:
|
- RX timeout: this is due to TX and RX clock differences, which does not have easy solution. Be sure your firmware version is >= 1.4.7, which minimizes this problem.
|
||||||
|
|
||||||
https://github.com/juribeparada/MMDVM_HS/releases
|
# Notes for previous users of MMDVM boards
|
||||||
|
|
||||||
### Windows
|
MMDVM_HS boards do not need deviation calibration like MMDVM boards, but could be necessary some frequency offset calibration (ADF7021 does not have AFC for 4FSK modes).
|
||||||
|
|
||||||
Download the ZUMspotFW firmware upgrade utility (ZUMspotFW_setup.exe) from the releases section:
|
The following options in MMDVM.ini ([Modem] section) have not any effect for MMDVM_HS boards:
|
||||||
|
|
||||||
https://github.com/juribeparada/MMDVM_HS/releases/download/v1.0.0/ZUMSpotFW_setup.exe
|
TXInvert
|
||||||
|
RXInvert
|
||||||
This utility includes firmwares binaries and USB drivers for Windows 7/8/10. If you have problems with the installer, you can download ZUMspotFW.zip for a manual installation.
|
PTTInvert
|
||||||
|
RXLevel
|
||||||
### Linux or macOS
|
RXDCOffset
|
||||||
|
TXDCOffset
|
||||||
Download the script (*.sh) that matches with your ZUMspot board:
|
|
||||||
|
The following options in MMDVM.ini ([Modem] section) are very important for MMDVM_HS boards:
|
||||||
- install_fw_rpi.sh: only for ZUMspot RPi board
|
|
||||||
- install_fw_librekit.sh: only for ZUMspot Libre Kit board or generic ZUMspot board
|
RXOffset: RX frequency offset (HS RX BER improvement)
|
||||||
- install_fw_usb.sh: only for ZUMspot USB dongle
|
TXOffset: TX frequency offset (radio RX improvement)
|
||||||
- install_fw_duplex.sh: only for ZUMspot with dual ADF7021
|
TXLevel: default deviation setting (recommended value: 50)
|
||||||
|
RFLevel: RF power output (recommended value: 100)
|
||||||
make the script executable (for example for ZUMspot RPi):
|
CWIdTXLevel: CW ID deviation setting (recommended value: 50)
|
||||||
|
D-StarTXLevel: D-Star deviation setting (recommended value: 50)
|
||||||
chmod +x install_fw_rpi.sh
|
DMRTXLevel: DMR deviation setting (recommended value: 50)
|
||||||
|
YSFTXLevel: YSF deviation setting (recommended value: 50)
|
||||||
stop your MMDVMHost process and run (you will need the root password):
|
P25TXLevel: P25 deviation setting (recommended value: 50)
|
||||||
|
NXDNTXLevel: NXDN deviation setting (recommended value: 50)
|
||||||
./install_fw_rpi.sh
|
POCSAGTXLevel: POCSAG deviation setting (recommended value: 50)
|
||||||
|
|
||||||
and wait to complete the upgrading process.
|
# Important notes
|
||||||
|
|
||||||
## Build from the sources
|
The ADF7021 (or RF7021SE module) must operate with a 14.7456 MHz TCXO and with at least 2.5 ppm of frequency stability or better. For 800-900 MHz frequency band you will need even a better frequency stability TCXO. You could use also 12.2880 MHz TCXO. Any other TCXO frequency is not supported. Please note that a bad quality TCXO not only affects the frequency offset, also affects clock data rate, which is not possible to fix and will cause BER issues.
|
||||||
|
|
||||||
You could check at MMDVM_HS/configs for common Config.h examples, using different ZUMspot boards.
|
Please set TXLevel=50 in MMDVM.ini to configure default deviation levels for all modes. You could modify this value and other TXLevel paramenters to change deviation levels. Use [MMDVMCal](https://github.com/g4klx/MMDVMCal) to check DMR deviation level and TX frequency offset with calibrated test equipment.
|
||||||
|
|
||||||
### ZUMspot Libre Kit (under Linux Raspbian)
|
The jumper wire to CLKOUT in RF7021SE module is not longer required for lastest MMDVM_HS firmware. But CE pin connection of ADF7021 is required for proper operation of ZUMspot.
|
||||||
|
|
||||||
Install the necessary software tools:
|
Be aware that some Blue Pill STM32F103 board are defectives. If you have trouble with USB, please check this [link](http://wiki.stm32duino.com/index.php?title=Blue_Pill).
|
||||||
|
|
||||||
sudo apt-get update
|
VHF (144-148 MHz) support for ZUMSpot is added by an external 18 nH inductor between L1 and L2 pins of ADF7021. This will enable dual band (VHF/UHF) operation.
|
||||||
sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi
|
|
||||||
|
Dual ADF7021 for full duplex operation (#define DUPLEX in Config.h) will work only with a big RX/TX frequency separation (5 MHz or more in UHF band for example) and proper antenna filtering. At the moment #define LIBRE_KIT_ADF7021 (Config.h) with STM32F103 platform is supported. Please see [BUILD.md](BUILD.md) for pinout details.
|
||||||
Download the sources:
|
|
||||||
|
If you can't decode any 4FSK modulation (DMR, YSF, P25 or NXDN) with your ZUMspot, the common solution is to adjust RX frequency offset (RXOffset) in your MMDVM.ini file. Please try with steps of +-100 Hz until you get low BER. If you don't have test equipment, the procedure is trial and error. In some cases TXOffset adjustment is also required for proper radio decoding. If you have test equipment, please use [MMDVMCal](https://github.com/g4klx/MMDVMCal).
|
||||||
cd ~
|
|
||||||
git clone https://github.com/juribeparada/MMDVM_HS
|
If you have problems updating firmware using USB bootloader (DFU mode) on Orange Pi or any other system different from RPi, you could compile the dfu tool directly. You could get the source code of a dfu tool [here](https://sourceforge.net/projects/dfu-programmer/files/dfu-programmer/0.7.0/).
|
||||||
cd MMDVM_HS/
|
|
||||||
git clone https://github.com/juribeparada/STM32F10X_Lib
|
# Quick start
|
||||||
|
|
||||||
Build the firmware with USB bootloader support (the default Config.h is OK for Libre Kit):
|
Please see [BUILD.md](BUILD.md) for more details, and also [MMDVM](https://groups.yahoo.com/neo/groups/mmdvm/info) Yahoo Groups. You also can check at MMDVM_HS/scripts folder for some automatic tasks.
|
||||||
|
|
||||||
make bl
|
## Binary firmware installation
|
||||||
|
|
||||||
Upload the firmware to ZUMspot Libre Kit using the USB port (your Libre Kit has the bootloader already installed):
|
Please check the latest firmware [here](https://github.com/juribeparada/MMDVM_HS/releases).
|
||||||
|
|
||||||
sudo make dfu devser=/dev/ttyACM0
|
### Pi-Star binary firmware installation
|
||||||
|
|
||||||
### ZUMspot RPi
|
You could use some pi-star commands under SSH console:
|
||||||
|
|
||||||
#### Enable serial port in Raspberry Pi 3 or Pi Zero W
|
- sudo pistar-zumspotflash rpi: ZUMspot RPi board
|
||||||
|
- sudo pistar-zumspotflash rpi_duplex: ZUMSpot duplex board conected to GPIO
|
||||||
This this necessary only if you are installing a fresh copy of Raspbian OS.
|
- sudo pistar-zumspotflash usb: ZUMspot USB dongle
|
||||||
|
- sudo pistar-zumspotflash libre: ZUMspot Libre Kit or generic MMDVM_HS board with USB
|
||||||
Edit /boot/cmdline.txt:
|
- sudo pistar-mmdvmhshatflash hs_hat: MMDVM_HS_Hat board (14.7456MHz TCXO)
|
||||||
|
- sudo pistar-mmdvmhshatflash hs_dual_hat: HS_DUAL_HAT board (14.7456MHz TCXO)
|
||||||
sudo nano /boot/cmdline.txt
|
- sudo pistar-mmdvmhshatflash hs_hat-12mhz: MMDVM_HS_Hat board (12.288MHz TCXO)
|
||||||
(remove the text: console=serial0,115200)
|
- sudo pistar-mmdvmhshatflash hs_dual_hat-12mhz: HS_DUAL_HAT board (12.288MHz TCXO)
|
||||||
|
- sudo pistar-nanohsflash nano_hs: Nano hotSPOT board
|
||||||
Disable services:
|
- sudo pistar-nanodvflash pi: NanoDV NPi board
|
||||||
|
- sudo pistar-nanodvflash usb: NanoDV USB board
|
||||||
sudo systemctl disable serial-getty@ttyAMA0.service
|
|
||||||
sudo systemctl disable bluetooth.service
|
### Windows
|
||||||
|
|
||||||
Edit /boot/config.txt
|
Download the ZUMspotFW firmware upgrade utility (ZUMspotFW_setup.exe) from the [releases section](https://github.com/juribeparada/MMDVM_HS/releases).
|
||||||
|
|
||||||
sudo nano /boot/config.txt
|
This utility includes firmwares binaries and USB drivers for Windows 7/8/10. If you have problems with the installer, you can download [ZUMspotFW.zip](https://github.com/juribeparada/MMDVM_HS/releases/download/v1.0.2/ZUMspotFW.zip) for a manual installation.
|
||||||
|
|
||||||
and add the following lines at the end of /boot/config.txt:
|
### Linux or macOS
|
||||||
|
|
||||||
enable_uart=1
|
Download the script (*.sh) that matches with your ZUMspot/MMDVM_HS board:
|
||||||
dtoverlay=pi3-disable-bt
|
|
||||||
|
- install_fw_librekit.sh: only for ZUMspot Libre Kit board (KI6ZUM & VE2GZI) or generic MMDVM_HS board with USB interface
|
||||||
Reboot your RPi:
|
- install_fw_rpi.sh: only for ZUMspot RPi board (KI6ZUM & VE2GZI)
|
||||||
|
- install_fw_usb.sh: only for ZUMspot USB dongle (KI6ZUM)
|
||||||
sudo reboot
|
- install_fw_duplex.sh: only for ZUMspot Duplex for RPi (KI6ZUM)
|
||||||
|
- install_fw_dualband.sh: only for ZUMspot Dualband for RPi (KI6ZUM)
|
||||||
#### Build de firmware and upload to ZUMspot RPi
|
- install_fw_hshat.sh: only for MMDVM_HS_Hat board (DB9MAT & DF2ET)
|
||||||
|
- install_fw_hshat-12mhz.sh: only for MMDVM_HS_Hat board with 12.288 MHz TCXO (DB9MAT & DF2ET)
|
||||||
Install the necessary software tools:
|
- install_fw_hsdualhat.sh: only for MMDVM_HS_Dual_Hat board (DB9MAT & DF2ET & DO7EN)
|
||||||
|
- install_fw_hsdualhat-12mhz.sh: only for MMDVM_HS_Dual_Hat board with 12.288 MHz TCXO (DB9MAT & DF2ET & DO7EN)
|
||||||
sudo apt-get update
|
- install_fw_nanohs.sh: only for Nano hotSPOT board (BI7JTA)
|
||||||
sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi
|
- install_fw_nanodv_npi.sh: only for NanoDV NPi board 1.0 (BG4TGO & BG5HHP)
|
||||||
|
- install_fw_nanodv_usb.sh: only for NanoDV USB board 1.0 (BG4TGO & BG5HHP)
|
||||||
cd ~
|
- install_fw_d2rg_mmdvmhs.sh: only for D2RG MMDVM_HS board (BG3MDO, VE2GZI, CA6JAU)
|
||||||
git clone https://git.code.sf.net/p/stm32flash/code stm32flash
|
- install_fw_gen_gpio.sh: only for generic MMDVM_HS board (EA7GIB) with GPIO serial interface
|
||||||
cd stm32flash
|
- install_fw_duplex_gpio.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board with GPIO serial interface
|
||||||
make
|
- install_fw_duplex_usb.sh: only for MMDVM_HS with dual ADF7021 (EA7GIB) or generic dual ADF7021 board with USB interface
|
||||||
sudo make install
|
- install_fw_skybridge_rpi.sh: only for BridgeCom SkyBridge HotSpot
|
||||||
|
|
||||||
Download the firmware sources:
|
For example, download the ZUMspot RPi upgrade script:
|
||||||
|
|
||||||
cd ~
|
cd ~
|
||||||
git clone https://github.com/juribeparada/MMDVM_HS
|
curl -OL https://raw.github.com/juribeparada/MMDVM_HS/master/scripts/install_fw_rpi.sh
|
||||||
cd MMDVM_HS/
|
|
||||||
git clone https://github.com/juribeparada/STM32F10X_Lib
|
make the script executable:
|
||||||
|
|
||||||
Edit Config.h
|
chmod +x install_fw_rpi.sh
|
||||||
|
|
||||||
nano Config.h
|
stop your MMDVMHost process and run (you will need the root password):
|
||||||
|
|
||||||
and enable:
|
./install_fw_rpi.sh
|
||||||
|
|
||||||
#define PI_HAT_7021_REV_03
|
and wait to complete the upgrading process.
|
||||||
#define ENABLE_ADF7021
|
|
||||||
#define ADF7021_14_7456
|
You could optionally install a beta firmware for testing:
|
||||||
#define STM32_USART1_HOST
|
|
||||||
#define ENABLE_SCAN_MODE
|
./install_fw_rpi.sh beta
|
||||||
|
|
||||||
Build the firmware:
|
## Build from the sources
|
||||||
|
|
||||||
make
|
You could use example files from MMDVM_HS/configs folder and overwrite the Config.h file, in order to compile a firmware with default settings. There are a specific config file for each ZUMspot or any MMDVM_HS compatible boards. In general, there are two possible compilation ways:
|
||||||
|
|
||||||
Upload the firmware to ZUMspot RPi board:
|
- Boards with USB interface:
|
||||||
|
|
||||||
sudo make zumspot-pi
|
Boards with STM32_USB_HOST option enabled in Config.h (ZUMspot Libre Kit, ZUMspot USB, GIBSpot USB, NanoDV USB, etc). Those boards need to have the USB bootloader installed. For example:
|
||||||
|
|
||||||
|
make clean
|
||||||
|
make bl
|
||||||
|
make dfu
|
||||||
|
|
||||||
|
You can optionally install a firmware without bootloader, with USB support. Be aware you will need always a ST-Link or serial interface in order to install or update the firmware. For this reason, you should use USB bootloader, unless you have trouble with the bootloader.
|
||||||
|
|
||||||
|
make clean
|
||||||
|
make nobl
|
||||||
|
make stlink-nobl
|
||||||
|
|
||||||
|
- Boards with GPIO interface:
|
||||||
|
|
||||||
|
Boards with STM32_USART1_HOST option enabled in Config.h (ZUMspot RPi, MMDVM_HS_Hat, MMDVM_HS_Dual_Hat, Nano hotSPOT, etc). No USB bootloader needed. For example:
|
||||||
|
|
||||||
|
make clean
|
||||||
|
make
|
||||||
|
make zumspot-pi
|
||||||
|
|
||||||
|
Some detailed examples as follows:
|
||||||
|
|
||||||
|
### MMDVM_HS_Hat
|
||||||
|
|
||||||
|
Please visit Mathis Schmieder GitHub [here](https://github.com/mathisschmieder/MMDVM_HS_Hat/blob/master/README.md) for detailed instructions.
|
||||||
|
|
||||||
|
### D2RG MMDVM_HS board
|
||||||
|
|
||||||
|
This hotspot needs Raspbian support for SPI-UART converter included in this board. If you don't see /dev/ttySC0, please visit Yuan BG3MDO GitHub [here](https://github.com/bg3mdo/D2RG_MMDVM_HS_ambe_uart_service) for driver installation instructions.
|
||||||
|
|
||||||
|
### ZUMspot Libre Kit (under Linux Raspbian)
|
||||||
|
|
||||||
|
If you are using Pi-Star, expand filesystem (if you haven't done before):
|
||||||
|
|
||||||
|
sudo pistar-expand
|
||||||
|
sudo reboot
|
||||||
|
|
||||||
|
Enable RW filesystem if you are using Pi-Star:
|
||||||
|
|
||||||
|
rpi-rw
|
||||||
|
|
||||||
|
Install the necessary software tools:
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi
|
||||||
|
|
||||||
|
Download the sources:
|
||||||
|
|
||||||
|
cd ~
|
||||||
|
git clone https://github.com/juribeparada/MMDVM_HS
|
||||||
|
cd MMDVM_HS/
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
|
||||||
|
Build the firmware with USB bootloader support (the default Config.h is OK for Libre Kit):
|
||||||
|
|
||||||
|
make bl
|
||||||
|
|
||||||
|
If you are using Pi-Star, stop services:
|
||||||
|
|
||||||
|
sudo pistar-watchdog.service stop
|
||||||
|
sudo systemctl stop mmdvmhost.timer
|
||||||
|
sudo systemctl stop mmdvmhost.service
|
||||||
|
|
||||||
|
Upload the firmware to ZUMspot Libre Kit using the USB port (your Libre Kit has the bootloader already installed):
|
||||||
|
|
||||||
|
sudo make dfu devser=/dev/ttyACM0
|
||||||
|
|
||||||
|
### ZUMspot RPi
|
||||||
|
|
||||||
|
#### Enable serial port in Raspberry Pi 3 or Pi Zero W
|
||||||
|
|
||||||
|
This this necessary only if you are installing a fresh copy of Raspbian OS.
|
||||||
|
|
||||||
|
Edit /boot/cmdline.txt:
|
||||||
|
|
||||||
|
sudo nano /boot/cmdline.txt
|
||||||
|
(remove the text: console=serial0,115200)
|
||||||
|
|
||||||
|
Disable services:
|
||||||
|
|
||||||
|
sudo systemctl disable serial-getty@ttyAMA0.service
|
||||||
|
sudo systemctl disable bluetooth.service
|
||||||
|
|
||||||
|
Edit /boot/config.txt
|
||||||
|
|
||||||
|
sudo nano /boot/config.txt
|
||||||
|
|
||||||
|
and add the following lines at the end of /boot/config.txt:
|
||||||
|
|
||||||
|
enable_uart=1
|
||||||
|
dtoverlay=pi3-disable-bt
|
||||||
|
|
||||||
|
Reboot your RPi:
|
||||||
|
|
||||||
|
sudo reboot
|
||||||
|
|
||||||
|
#### Build the firmware and upload to ZUMspot RPi
|
||||||
|
|
||||||
|
If you are using Pi-Star, expand filesystem (if you haven't done before):
|
||||||
|
|
||||||
|
sudo pistar-expand
|
||||||
|
sudo reboot
|
||||||
|
|
||||||
|
Enable RW filesystem if you are using Pi-Star:
|
||||||
|
|
||||||
|
rpi-rw
|
||||||
|
|
||||||
|
Install the necessary software tools:
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi
|
||||||
|
|
||||||
|
Note: The Pi-Star image contains an executable for stm32flash. The next five steps can be skipped!
|
||||||
|
|
||||||
|
cd ~
|
||||||
|
git clone https://git.code.sf.net/p/stm32flash/code stm32flash
|
||||||
|
cd stm32flash
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
Download the firmware sources:
|
||||||
|
|
||||||
|
cd ~
|
||||||
|
git clone https://github.com/juribeparada/MMDVM_HS
|
||||||
|
cd MMDVM_HS/
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
|
||||||
|
Edit Config.h
|
||||||
|
|
||||||
|
nano Config.h
|
||||||
|
|
||||||
|
and enable:
|
||||||
|
|
||||||
|
#define ZUMSPOT_ADF7021
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
#define ADF7021_14_7456
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
#define STM32_USART1_HOST
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
#define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
#define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
Build the firmware:
|
||||||
|
|
||||||
|
make
|
||||||
|
|
||||||
|
If you are using Pi-Star, stop services:
|
||||||
|
|
||||||
|
sudo pistar-watchdog.service stop
|
||||||
|
sudo systemctl stop mmdvmhost.timer
|
||||||
|
sudo systemctl stop mmdvmhost.service
|
||||||
|
|
||||||
|
Upload the firmware to ZUMspot RPi board:
|
||||||
|
|
||||||
|
sudo make zumspot-pi
|
||||||
|
|
||||||
|
### MMDVM_HS_Dual_Hat\MMDVM_HS_Hat gpio firmware update on OrangePI PC/PC2/PC Plus
|
||||||
|
|
||||||
|
Install the necessary software tools:
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi
|
||||||
|
|
||||||
|
Download the sources:
|
||||||
|
|
||||||
|
cd ~
|
||||||
|
git clone https://github.com/juribeparada/MMDVM_HS
|
||||||
|
cd MMDVM_HS/
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
|
||||||
|
Install the tools for building firmware
|
||||||
|
|
||||||
|
cd MMDVM_HS/scripts
|
||||||
|
./install_buildtools.sh
|
||||||
|
|
||||||
|
Copy MMDVM_HS/configs/MMDVM_HS_Dual_Hat.h or MMDVM_HS/configs/MMDVM_HS_Hat.h (MMDVM_HS_Hat-12mhz.h) to MMDVM_HS/Config.h and build the firmware:
|
||||||
|
|
||||||
|
make
|
||||||
|
|
||||||
|
Stop the MMDVMHost services:
|
||||||
|
|
||||||
|
sudo systemctl stop mmdvmhost.timer
|
||||||
|
sudo systemctl stop mmdvmhost.service
|
||||||
|
|
||||||
|
Upload the firmware to mmdvm_hs_dual_hat (mmdvm_hs_hat) on OrangePi PC\PC2\PC Plus:
|
||||||
|
|
||||||
|
sudo make mmdvm_hs_dual_hat_opi (sudo make mmdvm_hs_hat_opi)
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
sudo /usr/local/bin/stm32flash -v -w bin/mmdvm_f1.bin -g 0x0 -R -i 198,-199,199:-198,199 /dev/ttyS3
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
1
STM32F10X_Lib
Submodule
1
STM32F10X_Lib
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 1debc23063f3942608e2bd62d04d5e1249c47fa3
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2016 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
||||||
669
SerialPort.cpp
669
SerialPort.cpp
|
|
@ -1,7 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2013,2015,2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2013,2015,2016,2018,2020,2021,2023 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU
|
||||||
|
* Copyright (C) 2019 by Florian Wolters DF2ET
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -20,11 +21,7 @@
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
|
#include "version.h"
|
||||||
#if defined(MADEBYMAKEFILE)
|
|
||||||
#include "GitVersion.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "SerialPort.h"
|
#include "SerialPort.h"
|
||||||
|
|
||||||
const uint8_t MMDVM_FRAME_START = 0xE0U;
|
const uint8_t MMDVM_FRAME_START = 0xE0U;
|
||||||
|
|
@ -36,6 +33,7 @@ const uint8_t MMDVM_SET_MODE = 0x03U;
|
||||||
const uint8_t MMDVM_SET_FREQ = 0x04U;
|
const uint8_t MMDVM_SET_FREQ = 0x04U;
|
||||||
|
|
||||||
const uint8_t MMDVM_CAL_DATA = 0x08U;
|
const uint8_t MMDVM_CAL_DATA = 0x08U;
|
||||||
|
const uint8_t MMDVM_RSSI_DATA = 0x09U;
|
||||||
|
|
||||||
const uint8_t MMDVM_SEND_CWID = 0x0AU;
|
const uint8_t MMDVM_SEND_CWID = 0x0AU;
|
||||||
|
|
||||||
|
|
@ -59,38 +57,49 @@ const uint8_t MMDVM_P25_HDR = 0x30U;
|
||||||
const uint8_t MMDVM_P25_LDU = 0x31U;
|
const uint8_t MMDVM_P25_LDU = 0x31U;
|
||||||
const uint8_t MMDVM_P25_LOST = 0x32U;
|
const uint8_t MMDVM_P25_LOST = 0x32U;
|
||||||
|
|
||||||
|
const uint8_t MMDVM_NXDN_DATA = 0x40U;
|
||||||
|
const uint8_t MMDVM_NXDN_LOST = 0x41U;
|
||||||
|
|
||||||
|
const uint8_t MMDVM_M17_LINK_SETUP = 0x45U;
|
||||||
|
const uint8_t MMDVM_M17_STREAM = 0x46U;
|
||||||
|
const uint8_t MMDVM_M17_PACKET = 0x47U;
|
||||||
|
const uint8_t MMDVM_M17_LOST = 0x48U;
|
||||||
|
const uint8_t MMDVM_M17_EOT = 0x49U;
|
||||||
|
|
||||||
|
const uint8_t MMDVM_POCSAG_DATA = 0x50U;
|
||||||
|
|
||||||
const uint8_t MMDVM_ACK = 0x70U;
|
const uint8_t MMDVM_ACK = 0x70U;
|
||||||
const uint8_t MMDVM_NAK = 0x7FU;
|
const uint8_t MMDVM_NAK = 0x7FU;
|
||||||
|
|
||||||
const uint8_t MMDVM_SERIAL = 0x80U;
|
const uint8_t MMDVM_SERIAL = 0x80U;
|
||||||
|
|
||||||
|
const uint8_t MMDVM_TRANSPARENT = 0x90U;
|
||||||
|
const uint8_t MMDVM_QSO_INFO = 0x91U;
|
||||||
|
|
||||||
const uint8_t MMDVM_DEBUG1 = 0xF1U;
|
const uint8_t MMDVM_DEBUG1 = 0xF1U;
|
||||||
const uint8_t MMDVM_DEBUG2 = 0xF2U;
|
const uint8_t MMDVM_DEBUG2 = 0xF2U;
|
||||||
const uint8_t MMDVM_DEBUG3 = 0xF3U;
|
const uint8_t MMDVM_DEBUG3 = 0xF3U;
|
||||||
const uint8_t MMDVM_DEBUG4 = 0xF4U;
|
const uint8_t MMDVM_DEBUG4 = 0xF4U;
|
||||||
const uint8_t MMDVM_DEBUG5 = 0xF5U;
|
const uint8_t MMDVM_DEBUG5 = 0xF5U;
|
||||||
|
|
||||||
#if defined(ADF7021_N_VER)
|
|
||||||
#define DESCRIPTION "ZUMspot ADF7021N v1.0.2 20171023 (DStar/DMR/YSF/P25)"
|
|
||||||
#else
|
|
||||||
#define DESCRIPTION "ZUMspot ADF7021 v1.0.2 20171023 (DStar/DMR/YSF/P25)"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(GITVERSION)
|
|
||||||
#define concat(a, b) a " GitID #" b ""
|
|
||||||
const char HARDWARE[] = concat(DESCRIPTION, GITVERSION);
|
|
||||||
#else
|
|
||||||
#define concat(a, b, c) a " (Build: " b " " c ")"
|
|
||||||
const char HARDWARE[] = concat(DESCRIPTION, __TIME__, __DATE__);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const uint8_t PROTOCOL_VERSION = 1U;
|
const uint8_t PROTOCOL_VERSION = 1U;
|
||||||
|
|
||||||
|
#if defined(ENABLE_UDID)
|
||||||
|
char UDID[] = "00000000000000000000000000000000";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Parameters for batching serial data
|
||||||
|
const int MAX_SERIAL_DATA = 250;
|
||||||
|
const uint16_t MAX_SERIAL_COUNT = 100U;
|
||||||
|
|
||||||
CSerialPort::CSerialPort() :
|
CSerialPort::CSerialPort() :
|
||||||
m_buffer(),
|
m_buffer(),
|
||||||
m_ptr(0U),
|
m_ptr(0U),
|
||||||
m_len(0U),
|
m_len(0U),
|
||||||
m_debug(false)
|
m_lastSerialAvail(0),
|
||||||
|
m_lastSerialAvailCount(0U),
|
||||||
|
m_debug(false),
|
||||||
|
m_firstCal(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,7 +136,7 @@ void CSerialPort::getStatus()
|
||||||
|
|
||||||
// Send all sorts of interesting internal values
|
// Send all sorts of interesting internal values
|
||||||
reply[0U] = MMDVM_FRAME_START;
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
reply[1U] = 11U;
|
reply[1U] = 14U;
|
||||||
reply[2U] = MMDVM_GET_STATUS;
|
reply[2U] = MMDVM_GET_STATUS;
|
||||||
|
|
||||||
reply[3U] = 0x00U;
|
reply[3U] = 0x00U;
|
||||||
|
|
@ -139,6 +148,12 @@ void CSerialPort::getStatus()
|
||||||
reply[3U] |= 0x04U;
|
reply[3U] |= 0x04U;
|
||||||
if (m_p25Enable)
|
if (m_p25Enable)
|
||||||
reply[3U] |= 0x08U;
|
reply[3U] |= 0x08U;
|
||||||
|
if (m_nxdnEnable)
|
||||||
|
reply[3U] |= 0x10U;
|
||||||
|
if (m_pocsagEnable)
|
||||||
|
reply[3U] |= 0x20U;
|
||||||
|
if (m_m17Enable)
|
||||||
|
reply[3U] |= 0x80U;
|
||||||
|
|
||||||
reply[4U] = uint8_t(m_modemState);
|
reply[4U] = uint8_t(m_modemState);
|
||||||
|
|
||||||
|
|
@ -183,12 +198,27 @@ void CSerialPort::getStatus()
|
||||||
else
|
else
|
||||||
reply[10U] = 0U;
|
reply[10U] = 0U;
|
||||||
|
|
||||||
writeInt(1U, reply, 11);
|
if (m_nxdnEnable)
|
||||||
|
reply[11U] = nxdnTX.getSpace();
|
||||||
|
else
|
||||||
|
reply[11U] = 0U;
|
||||||
|
|
||||||
|
if (m_pocsagEnable)
|
||||||
|
reply[12U] = pocsagTX.getSpace();
|
||||||
|
else
|
||||||
|
reply[12U] = 0U;
|
||||||
|
|
||||||
|
if (m_m17Enable)
|
||||||
|
reply[13U] = m17TX.getSpace();
|
||||||
|
else
|
||||||
|
reply[13U] = 0U;
|
||||||
|
|
||||||
|
writeInt(1U, reply, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSerialPort::getVersion()
|
void CSerialPort::getVersion()
|
||||||
{
|
{
|
||||||
uint8_t reply[100U];
|
uint8_t reply[132U];
|
||||||
|
|
||||||
reply[0U] = MMDVM_FRAME_START;
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
reply[1U] = 0U;
|
reply[1U] = 0U;
|
||||||
|
|
@ -200,6 +230,12 @@ void CSerialPort::getVersion()
|
||||||
for (uint8_t i = 0U; HARDWARE[i] != 0x00U; i++, count++)
|
for (uint8_t i = 0U; HARDWARE[i] != 0x00U; i++, count++)
|
||||||
reply[count] = HARDWARE[i];
|
reply[count] = HARDWARE[i];
|
||||||
|
|
||||||
|
#if defined(ENABLE_UDID)
|
||||||
|
reply[count++] = '\0';
|
||||||
|
for (uint8_t i = 0U; UDID[i] != 0x00U; i++, count++)
|
||||||
|
reply[count] = UDID[i];
|
||||||
|
#endif
|
||||||
|
|
||||||
reply[1U] = count;
|
reply[1U] = count;
|
||||||
|
|
||||||
writeInt(1U, reply, count);
|
writeInt(1U, reply, count);
|
||||||
|
|
@ -209,16 +245,19 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
||||||
{
|
{
|
||||||
if (length < 13U)
|
if (length < 13U)
|
||||||
return 4U;
|
return 4U;
|
||||||
|
|
||||||
bool ysfLoDev = (data[0U] & 0x08U) == 0x08U;
|
bool ysfLoDev = (data[0U] & 0x08U) == 0x08U;
|
||||||
bool simplex = (data[0U] & 0x80U) == 0x80U;
|
bool simplex = (data[0U] & 0x80U) == 0x80U;
|
||||||
|
|
||||||
m_debug = (data[0U] & 0x10U) == 0x10U;
|
m_debug = (data[0U] & 0x10U) == 0x10U;
|
||||||
|
|
||||||
bool dstarEnable = (data[1U] & 0x01U) == 0x01U;
|
bool dstarEnable = (data[1U] & 0x01U) == 0x01U;
|
||||||
bool dmrEnable = (data[1U] & 0x02U) == 0x02U;
|
bool dmrEnable = (data[1U] & 0x02U) == 0x02U;
|
||||||
bool ysfEnable = (data[1U] & 0x04U) == 0x04U;
|
bool ysfEnable = (data[1U] & 0x04U) == 0x04U;
|
||||||
bool p25Enable = (data[1U] & 0x08U) == 0x08U;
|
bool p25Enable = (data[1U] & 0x08U) == 0x08U;
|
||||||
|
bool nxdnEnable = (data[1U] & 0x10U) == 0x10U;
|
||||||
|
bool pocsagEnable = (data[1U] & 0x20U) == 0x20U;
|
||||||
|
bool m17Enable = (data[1U] & 0x40U) == 0x40U;
|
||||||
|
|
||||||
uint8_t txDelay = data[2U];
|
uint8_t txDelay = data[2U];
|
||||||
if (txDelay > 50U)
|
if (txDelay > 50U)
|
||||||
|
|
@ -226,7 +265,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
||||||
|
|
||||||
MMDVM_STATE modemState = MMDVM_STATE(data[3U]);
|
MMDVM_STATE modemState = MMDVM_STATE(data[3U]);
|
||||||
|
|
||||||
if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25)
|
if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_M17 && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_INTCAL && modemState != STATE_RSSICAL && modemState != STATE_POCSAGCAL)
|
||||||
return 4U;
|
return 4U;
|
||||||
if (modemState == STATE_DSTAR && !dstarEnable)
|
if (modemState == STATE_DSTAR && !dstarEnable)
|
||||||
return 4U;
|
return 4U;
|
||||||
|
|
@ -236,29 +275,92 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
||||||
return 4U;
|
return 4U;
|
||||||
if (modemState == STATE_P25 && !p25Enable)
|
if (modemState == STATE_P25 && !p25Enable)
|
||||||
return 4U;
|
return 4U;
|
||||||
|
if (modemState == STATE_NXDN && !nxdnEnable)
|
||||||
|
return 4U;
|
||||||
|
if (modemState == STATE_POCSAG && !pocsagEnable)
|
||||||
|
return 4U;
|
||||||
|
if (modemState == STATE_M17 && !m17Enable)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
uint8_t colorCode = data[6U];
|
uint8_t colorCode = data[6U];
|
||||||
if (colorCode > 15U)
|
if (colorCode > 15U)
|
||||||
return 4U;
|
return 4U;
|
||||||
|
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
uint8_t dmrDelay = data[7U];
|
uint8_t dmrDelay = data[7U];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_modemState = modemState;
|
m_cwIdTXLevel = data[5U] >> 2;
|
||||||
|
|
||||||
|
uint8_t dstarTXLevel = data[9U];
|
||||||
|
uint8_t dmrTXLevel = data[10U];
|
||||||
|
uint8_t ysfTXLevel = data[11U];
|
||||||
|
uint8_t p25TXLevel = data[12U];
|
||||||
|
uint8_t nxdnTXLevel = 128U;
|
||||||
|
uint8_t pocsagTXLevel = 128U;
|
||||||
|
uint8_t m17TXLevel = 128U;
|
||||||
|
|
||||||
|
if (length >= 16U)
|
||||||
|
nxdnTXLevel = data[15U];
|
||||||
|
|
||||||
|
if (length >= 18U)
|
||||||
|
pocsagTXLevel = data[17U];
|
||||||
|
|
||||||
|
if (length >= 22U)
|
||||||
|
m17TXLevel = data[21U];
|
||||||
|
|
||||||
|
io.setDeviations(dstarTXLevel, dmrTXLevel, ysfTXLevel, p25TXLevel, nxdnTXLevel, m17TXLevel, pocsagTXLevel, ysfLoDev);
|
||||||
|
|
||||||
|
m_dstarEnable = dstarEnable;
|
||||||
|
m_dmrEnable = dmrEnable;
|
||||||
|
m_ysfEnable = ysfEnable;
|
||||||
|
m_p25Enable = p25Enable;
|
||||||
|
m_nxdnEnable = nxdnEnable;
|
||||||
|
m_m17Enable = m17Enable;
|
||||||
|
m_pocsagEnable = pocsagEnable;
|
||||||
|
|
||||||
|
if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL || modemState == STATE_INTCAL) {
|
||||||
|
m_dmrEnable = true;
|
||||||
|
m_modemState = STATE_DMR;
|
||||||
|
m_calState = modemState;
|
||||||
|
if (m_firstCal)
|
||||||
|
io.updateCal();
|
||||||
|
if (modemState == STATE_RSSICAL)
|
||||||
|
io.ifConf(STATE_DMR, true);
|
||||||
|
} else if (modemState == STATE_POCSAGCAL) {
|
||||||
|
m_pocsagEnable = true;
|
||||||
|
m_modemState = STATE_POCSAG;
|
||||||
|
m_calState = modemState;
|
||||||
|
if (m_firstCal)
|
||||||
|
io.updateCal();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_modemState = modemState;
|
||||||
|
m_calState = STATE_IDLE;
|
||||||
|
}
|
||||||
|
|
||||||
m_dstarEnable = dstarEnable;
|
|
||||||
m_dmrEnable = dmrEnable;
|
|
||||||
m_ysfEnable = ysfEnable;
|
|
||||||
m_p25Enable = p25Enable;
|
|
||||||
|
|
||||||
m_duplex = !simplex;
|
m_duplex = !simplex;
|
||||||
|
|
||||||
|
#if !defined(DUPLEX)
|
||||||
|
if (m_duplex && m_calState == STATE_IDLE && modemState != STATE_DSTARCAL) {
|
||||||
|
DEBUG1("Full duplex not supported with this firmware");
|
||||||
|
return 6U;
|
||||||
|
}
|
||||||
|
#elif defined(DUPLEX) && (defined(ZUMSPOT_ADF7021) || defined(LONESTAR_USB) || defined(SKYBRIDGE_HS))
|
||||||
|
if (io.isDualBand() && m_duplex && m_calState == STATE_IDLE && modemState != STATE_DSTARCAL) {
|
||||||
|
DEBUG1("Full duplex is not supported on this board");
|
||||||
|
return 6U;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
dstarTX.setTXDelay(txDelay);
|
dstarTX.setTXDelay(txDelay);
|
||||||
ysfTX.setTXDelay(txDelay);
|
ysfTX.setTXDelay(txDelay);
|
||||||
p25TX.setTXDelay(txDelay);
|
p25TX.setTXDelay(txDelay);
|
||||||
|
nxdnTX.setTXDelay(txDelay);
|
||||||
|
m17TX.setTXDelay(txDelay);
|
||||||
|
pocsagTX.setTXDelay(txDelay);
|
||||||
dmrDMOTX.setTXDelay(txDelay);
|
dmrDMOTX.setTXDelay(txDelay);
|
||||||
|
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
dmrTX.setColorCode(colorCode);
|
dmrTX.setColorCode(colorCode);
|
||||||
dmrRX.setColorCode(colorCode);
|
dmrRX.setColorCode(colorCode);
|
||||||
|
|
@ -269,19 +371,32 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
||||||
dmrDMORX.setColorCode(colorCode);
|
dmrDMORX.setColorCode(colorCode);
|
||||||
|
|
||||||
io.setLoDevYSF(ysfLoDev);
|
io.setLoDevYSF(ysfLoDev);
|
||||||
|
|
||||||
if(m_dstarEnable)
|
if (!m_firstCal || (modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL && modemState != STATE_INTCAL && modemState != STATE_POCSAGCAL)) {
|
||||||
io.ifConf(STATE_DSTAR, true);
|
if(m_dstarEnable)
|
||||||
else if(m_dmrEnable)
|
io.ifConf(STATE_DSTAR, true);
|
||||||
io.ifConf(STATE_DMR, true);
|
else if(m_dmrEnable)
|
||||||
else if(m_ysfEnable)
|
io.ifConf(STATE_DMR, true);
|
||||||
io.ifConf(STATE_YSF, true);
|
else if(m_ysfEnable)
|
||||||
else if(m_p25Enable)
|
io.ifConf(STATE_YSF, true);
|
||||||
io.ifConf(STATE_P25, true);
|
else if(m_p25Enable)
|
||||||
|
io.ifConf(STATE_P25, true);
|
||||||
|
else if(m_nxdnEnable)
|
||||||
|
io.ifConf(STATE_NXDN, true);
|
||||||
|
else if(m_m17Enable)
|
||||||
|
io.ifConf(STATE_M17, true);
|
||||||
|
else if(m_pocsagEnable)
|
||||||
|
io.ifConf(STATE_POCSAG, true);
|
||||||
|
}
|
||||||
|
|
||||||
io.start();
|
io.start();
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
io.printConf();
|
io.printConf();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL || modemState == STATE_INTCAL || modemState == STATE_POCSAGCAL)
|
||||||
|
m_firstCal = true;
|
||||||
|
|
||||||
return 0U;
|
return 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -291,11 +406,12 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length)
|
||||||
return 4U;
|
return 4U;
|
||||||
|
|
||||||
MMDVM_STATE modemState = MMDVM_STATE(data[0U]);
|
MMDVM_STATE modemState = MMDVM_STATE(data[0U]);
|
||||||
|
MMDVM_STATE tmpState;
|
||||||
|
|
||||||
if (modemState == m_modemState)
|
if (modemState == m_modemState)
|
||||||
return 0U;
|
return 0U;
|
||||||
|
|
||||||
if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25)
|
if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_M17 && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL && modemState != STATE_INTCAL && modemState != STATE_POCSAGCAL)
|
||||||
return 4U;
|
return 4U;
|
||||||
if (modemState == STATE_DSTAR && !m_dstarEnable)
|
if (modemState == STATE_DSTAR && !m_dstarEnable)
|
||||||
return 4U;
|
return 4U;
|
||||||
|
|
@ -305,30 +421,73 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length)
|
||||||
return 4U;
|
return 4U;
|
||||||
if (modemState == STATE_P25 && !m_p25Enable)
|
if (modemState == STATE_P25 && !m_p25Enable)
|
||||||
return 4U;
|
return 4U;
|
||||||
|
if (modemState == STATE_NXDN && !m_nxdnEnable)
|
||||||
setMode(modemState);
|
return 4U;
|
||||||
|
if (modemState == STATE_M17 && !m_m17Enable)
|
||||||
|
return 4U;
|
||||||
|
if (modemState == STATE_POCSAG && !m_pocsagEnable)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL || modemState == STATE_INTCAL) {
|
||||||
|
m_dmrEnable = true;
|
||||||
|
tmpState = STATE_DMR;
|
||||||
|
m_calState = modemState;
|
||||||
|
if (m_firstCal)
|
||||||
|
io.updateCal();
|
||||||
|
} else if (modemState == STATE_POCSAGCAL) {
|
||||||
|
m_pocsagEnable = true;
|
||||||
|
tmpState = STATE_POCSAG;
|
||||||
|
m_calState = modemState;
|
||||||
|
if (m_firstCal)
|
||||||
|
io.updateCal();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tmpState = modemState;
|
||||||
|
m_calState = STATE_IDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
setMode(tmpState);
|
||||||
|
|
||||||
return 0U;
|
return 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t CSerialPort::setFreq(const uint8_t* data, uint8_t length)
|
uint8_t CSerialPort::setFreq(const uint8_t* data, uint8_t length)
|
||||||
{
|
{
|
||||||
uint32_t freq_rx, freq_tx;
|
uint32_t freq_rx, freq_tx, pocsag_freq_tx;
|
||||||
|
uint8_t rf_power;
|
||||||
|
|
||||||
if (length < 9U)
|
if (length < 9U)
|
||||||
return 4U;
|
return 4U;
|
||||||
|
|
||||||
freq_rx = data[1] * 1;
|
// Very old MMDVMHost, set full power
|
||||||
freq_rx += data[2] * 256;
|
if (length == 9U)
|
||||||
freq_rx += data[3] * 65536;
|
rf_power = 255U;
|
||||||
freq_rx += data[4] * 16777216;
|
|
||||||
|
// Current MMDVMHost, set power from MMDVM.ini
|
||||||
freq_tx = data[5] * 1;
|
if (length >= 10U)
|
||||||
freq_tx += data[6] * 256;
|
rf_power = data[9U];
|
||||||
freq_tx += data[7] * 65536;
|
|
||||||
freq_tx += data[8] * 16777216;
|
freq_rx = data[1U] << 0;
|
||||||
|
freq_rx |= data[2U] << 8;
|
||||||
return io.setFreq(freq_rx, freq_tx);
|
freq_rx |= data[3U] << 16;
|
||||||
|
freq_rx |= data[4U] << 24;
|
||||||
|
|
||||||
|
freq_tx = data[5U] << 0;
|
||||||
|
freq_tx |= data[6U] << 8;
|
||||||
|
freq_tx |= data[7U] << 16;
|
||||||
|
freq_tx |= data[8U] << 24;
|
||||||
|
|
||||||
|
// New MMDVMHost, set POCSAG TX frequency
|
||||||
|
if (length >= 14U) {
|
||||||
|
pocsag_freq_tx = data[10U] << 0;
|
||||||
|
pocsag_freq_tx |= data[11U] << 8;
|
||||||
|
pocsag_freq_tx |= data[12U] << 16;
|
||||||
|
pocsag_freq_tx |= data[13U] << 24;
|
||||||
|
} else {
|
||||||
|
pocsag_freq_tx = freq_tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
return io.setFreq(freq_rx, freq_tx, rf_power, pocsag_freq_tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSerialPort::setMode(MMDVM_STATE modemState)
|
void CSerialPort::setMode(MMDVM_STATE modemState)
|
||||||
|
|
@ -339,6 +498,9 @@ void CSerialPort::setMode(MMDVM_STATE modemState)
|
||||||
dstarRX.reset();
|
dstarRX.reset();
|
||||||
ysfRX.reset();
|
ysfRX.reset();
|
||||||
p25RX.reset();
|
p25RX.reset();
|
||||||
|
nxdnRX.reset();
|
||||||
|
m17RX.reset();
|
||||||
|
cwIdTX.reset();
|
||||||
break;
|
break;
|
||||||
case STATE_DSTAR:
|
case STATE_DSTAR:
|
||||||
DEBUG1("Mode set to D-Star");
|
DEBUG1("Mode set to D-Star");
|
||||||
|
|
@ -349,6 +511,9 @@ void CSerialPort::setMode(MMDVM_STATE modemState)
|
||||||
dmrDMORX.reset();
|
dmrDMORX.reset();
|
||||||
ysfRX.reset();
|
ysfRX.reset();
|
||||||
p25RX.reset();
|
p25RX.reset();
|
||||||
|
nxdnRX.reset();
|
||||||
|
m17RX.reset();
|
||||||
|
cwIdTX.reset();
|
||||||
break;
|
break;
|
||||||
case STATE_YSF:
|
case STATE_YSF:
|
||||||
DEBUG1("Mode set to System Fusion");
|
DEBUG1("Mode set to System Fusion");
|
||||||
|
|
@ -359,6 +524,9 @@ void CSerialPort::setMode(MMDVM_STATE modemState)
|
||||||
dmrDMORX.reset();
|
dmrDMORX.reset();
|
||||||
dstarRX.reset();
|
dstarRX.reset();
|
||||||
p25RX.reset();
|
p25RX.reset();
|
||||||
|
nxdnRX.reset();
|
||||||
|
m17RX.reset();
|
||||||
|
cwIdTX.reset();
|
||||||
break;
|
break;
|
||||||
case STATE_P25:
|
case STATE_P25:
|
||||||
DEBUG1("Mode set to P25");
|
DEBUG1("Mode set to P25");
|
||||||
|
|
@ -369,6 +537,49 @@ void CSerialPort::setMode(MMDVM_STATE modemState)
|
||||||
dmrDMORX.reset();
|
dmrDMORX.reset();
|
||||||
dstarRX.reset();
|
dstarRX.reset();
|
||||||
ysfRX.reset();
|
ysfRX.reset();
|
||||||
|
nxdnRX.reset();
|
||||||
|
m17RX.reset();
|
||||||
|
cwIdTX.reset();
|
||||||
|
break;
|
||||||
|
case STATE_NXDN:
|
||||||
|
DEBUG1("Mode set to NXDN");
|
||||||
|
#if defined(DUPLEX)
|
||||||
|
dmrIdleRX.reset();
|
||||||
|
dmrRX.reset();
|
||||||
|
#endif
|
||||||
|
dmrDMORX.reset();
|
||||||
|
dstarRX.reset();
|
||||||
|
ysfRX.reset();
|
||||||
|
p25RX.reset();
|
||||||
|
m17RX.reset();
|
||||||
|
cwIdTX.reset();
|
||||||
|
break;
|
||||||
|
case STATE_M17:
|
||||||
|
DEBUG1("Mode set to M17");
|
||||||
|
#if defined(DUPLEX)
|
||||||
|
dmrIdleRX.reset();
|
||||||
|
dmrRX.reset();
|
||||||
|
#endif
|
||||||
|
dmrDMORX.reset();
|
||||||
|
dstarRX.reset();
|
||||||
|
ysfRX.reset();
|
||||||
|
p25RX.reset();
|
||||||
|
nxdnRX.reset();
|
||||||
|
cwIdTX.reset();
|
||||||
|
break;
|
||||||
|
case STATE_POCSAG:
|
||||||
|
DEBUG1("Mode set to POCSAG");
|
||||||
|
#if defined(DUPLEX)
|
||||||
|
dmrIdleRX.reset();
|
||||||
|
dmrRX.reset();
|
||||||
|
#endif
|
||||||
|
dmrDMORX.reset();
|
||||||
|
dstarRX.reset();
|
||||||
|
ysfRX.reset();
|
||||||
|
p25RX.reset();
|
||||||
|
nxdnRX.reset();
|
||||||
|
m17RX.reset();
|
||||||
|
cwIdTX.reset();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DEBUG1("Mode set to Idle");
|
DEBUG1("Mode set to Idle");
|
||||||
|
|
@ -377,12 +588,12 @@ void CSerialPort::setMode(MMDVM_STATE modemState)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_modemState = modemState;
|
m_modemState = modemState;
|
||||||
|
|
||||||
if ((modemState != STATE_IDLE) && (m_modemState_prev != modemState)) {
|
if ((modemState != STATE_IDLE) && (m_modemState_prev != modemState)) {
|
||||||
DEBUG1("setMode: configuring Hardware");
|
DEBUG1("setMode: configuring Hardware");
|
||||||
io.ifConf(modemState, true);
|
io.ifConf(modemState, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
io.setMode(m_modemState);
|
io.setMode(m_modemState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -391,7 +602,7 @@ void CSerialPort::start()
|
||||||
beginInt(1U, 115200);
|
beginInt(1U, 115200);
|
||||||
|
|
||||||
#if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1)
|
#if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1)
|
||||||
beginInt(3U, 9600);
|
beginInt(3U, SERIAL_REPEATER_BAUD);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -406,8 +617,7 @@ void CSerialPort::process()
|
||||||
m_buffer[0U] = c;
|
m_buffer[0U] = c;
|
||||||
m_ptr = 1U;
|
m_ptr = 1U;
|
||||||
m_len = 0U;
|
m_len = 0U;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
m_ptr = 0U;
|
m_ptr = 0U;
|
||||||
m_len = 0U;
|
m_len = 0U;
|
||||||
}
|
}
|
||||||
|
|
@ -458,9 +668,32 @@ void CSerialPort::process()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMDVM_CAL_DATA:
|
case MMDVM_CAL_DATA:
|
||||||
|
if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K) {
|
||||||
|
err = calDMR.write(m_buffer + 3U, m_len - 3U);
|
||||||
|
} else if (m_calState == STATE_POCSAGCAL) {
|
||||||
|
err = pocsagTX.setCal(m_buffer + 3U, m_len - 3U);
|
||||||
|
} else if (m_calState == STATE_RSSICAL || m_calState == STATE_INTCAL) {
|
||||||
|
err = 0U;
|
||||||
|
}
|
||||||
|
if (err == 0U) {
|
||||||
|
sendACK();
|
||||||
|
} else {
|
||||||
|
DEBUG2("Received invalid calibration data", err);
|
||||||
|
sendNAK(err);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMDVM_SEND_CWID:
|
case MMDVM_SEND_CWID:
|
||||||
|
err = 5U;
|
||||||
|
if (m_modemState == STATE_IDLE) {
|
||||||
|
m_cwid_state = true;
|
||||||
|
io.ifConf(STATE_CWID, true);
|
||||||
|
err = cwIdTX.write(m_buffer + 3U, m_len - 3U);
|
||||||
|
}
|
||||||
|
if (err != 0U) {
|
||||||
|
DEBUG2("Invalid CW Id data", err);
|
||||||
|
sendNAK(err);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMDVM_DSTAR_HEADER:
|
case MMDVM_DSTAR_HEADER:
|
||||||
|
|
@ -506,7 +739,7 @@ void CSerialPort::process()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMDVM_DMR_DATA1:
|
case MMDVM_DMR_DATA1:
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
if (m_dmrEnable) {
|
if (m_dmrEnable) {
|
||||||
if (m_modemState == STATE_IDLE || m_modemState == STATE_DMR) {
|
if (m_modemState == STATE_IDLE || m_modemState == STATE_DMR) {
|
||||||
if (m_duplex)
|
if (m_duplex)
|
||||||
|
|
@ -520,7 +753,7 @@ void CSerialPort::process()
|
||||||
DEBUG2("Received invalid DMR data", err);
|
DEBUG2("Received invalid DMR data", err);
|
||||||
sendNAK(err);
|
sendNAK(err);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMDVM_DMR_DATA2:
|
case MMDVM_DMR_DATA2:
|
||||||
|
|
@ -546,7 +779,7 @@ void CSerialPort::process()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMDVM_DMR_START:
|
case MMDVM_DMR_START:
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
if (m_dmrEnable) {
|
if (m_dmrEnable) {
|
||||||
err = 4U;
|
err = 4U;
|
||||||
if (m_len == 4U) {
|
if (m_len == 4U) {
|
||||||
|
|
@ -565,29 +798,29 @@ void CSerialPort::process()
|
||||||
DEBUG2("Received invalid DMR start", err);
|
DEBUG2("Received invalid DMR start", err);
|
||||||
sendNAK(err);
|
sendNAK(err);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMDVM_DMR_SHORTLC:
|
case MMDVM_DMR_SHORTLC:
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
if (m_dmrEnable)
|
if (m_dmrEnable)
|
||||||
err = dmrTX.writeShortLC(m_buffer + 3U, m_len - 3U);
|
err = dmrTX.writeShortLC(m_buffer + 3U, m_len - 3U);
|
||||||
if (err != 0U) {
|
if (err != 0U) {
|
||||||
DEBUG2("Received invalid DMR Short LC", err);
|
DEBUG2("Received invalid DMR Short LC", err);
|
||||||
sendNAK(err);
|
sendNAK(err);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMDVM_DMR_ABORT:
|
case MMDVM_DMR_ABORT:
|
||||||
#if defined(DUPLEX)
|
#if defined(DUPLEX)
|
||||||
if (m_dmrEnable)
|
if (m_dmrEnable)
|
||||||
err = dmrTX.writeAbort(m_buffer + 3U, m_len - 3U);
|
err = dmrTX.writeAbort(m_buffer + 3U, m_len - 3U);
|
||||||
if (err != 0U) {
|
if (err != 0U) {
|
||||||
DEBUG2("Received invalid DMR Abort", err);
|
DEBUG2("Received invalid DMR Abort", err);
|
||||||
sendNAK(err);
|
sendNAK(err);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MMDVM_YSF_DATA:
|
case MMDVM_YSF_DATA:
|
||||||
|
|
@ -632,6 +865,83 @@ void CSerialPort::process()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MMDVM_NXDN_DATA:
|
||||||
|
if (m_nxdnEnable) {
|
||||||
|
if (m_modemState == STATE_IDLE || m_modemState == STATE_NXDN)
|
||||||
|
err = nxdnTX.writeData(m_buffer + 3U, m_len - 3U);
|
||||||
|
}
|
||||||
|
if (err == 0U) {
|
||||||
|
if (m_modemState == STATE_IDLE)
|
||||||
|
setMode(STATE_NXDN);
|
||||||
|
} else {
|
||||||
|
DEBUG2("Received invalid NXDN data", err);
|
||||||
|
sendNAK(err);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MMDVM_M17_LINK_SETUP:
|
||||||
|
if (m_m17Enable) {
|
||||||
|
if (m_modemState == STATE_IDLE || m_modemState == STATE_M17)
|
||||||
|
err = m17TX.writeData(m_buffer + 3U, m_len - 3U);
|
||||||
|
}
|
||||||
|
if (err == 0U) {
|
||||||
|
if (m_modemState == STATE_IDLE)
|
||||||
|
setMode(STATE_M17);
|
||||||
|
} else {
|
||||||
|
DEBUG2("Received invalid M17 link setup data", err);
|
||||||
|
sendNAK(err);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MMDVM_M17_STREAM:
|
||||||
|
if (m_m17Enable) {
|
||||||
|
if (m_modemState == STATE_IDLE || m_modemState == STATE_M17)
|
||||||
|
err = m17TX.writeData(m_buffer + 3U, m_len - 3U);
|
||||||
|
}
|
||||||
|
if (err == 0U) {
|
||||||
|
if (m_modemState == STATE_IDLE)
|
||||||
|
setMode(STATE_M17);
|
||||||
|
} else {
|
||||||
|
DEBUG2("Received invalid M17 stream data", err);
|
||||||
|
sendNAK(err);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MMDVM_M17_EOT:
|
||||||
|
if (m_m17Enable) {
|
||||||
|
if (m_modemState == STATE_IDLE || m_modemState == STATE_M17)
|
||||||
|
err = m17TX.writeData(m_buffer + 3U, m_len - 3U);
|
||||||
|
}
|
||||||
|
if (err == 0U) {
|
||||||
|
if (m_modemState == STATE_IDLE)
|
||||||
|
setMode(STATE_M17);
|
||||||
|
} else {
|
||||||
|
DEBUG2("Received invalid M17 EOT", err);
|
||||||
|
sendNAK(err);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MMDVM_POCSAG_DATA:
|
||||||
|
if (m_pocsagEnable) {
|
||||||
|
if (m_modemState == STATE_IDLE || m_modemState == STATE_POCSAG) {
|
||||||
|
m_pocsag_state = true;
|
||||||
|
err = pocsagTX.writeData(m_buffer + 3U, m_len - 3U);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (err == 0U) {
|
||||||
|
if (m_modemState == STATE_IDLE)
|
||||||
|
setMode(STATE_POCSAG);
|
||||||
|
} else {
|
||||||
|
DEBUG2("Received invalid POCSAG data", err);
|
||||||
|
sendNAK(err);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MMDVM_TRANSPARENT:
|
||||||
|
case MMDVM_QSO_INFO:
|
||||||
|
// Do nothing on the MMDVM.
|
||||||
|
break;
|
||||||
|
|
||||||
#if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1)
|
#if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1)
|
||||||
case MMDVM_SERIAL:
|
case MMDVM_SERIAL:
|
||||||
writeInt(3U, m_buffer + 3U, m_len - 3U);
|
writeInt(3U, m_buffer + 3U, m_len - 3U);
|
||||||
|
|
@ -654,14 +964,43 @@ void CSerialPort::process()
|
||||||
m_ptr = 0U;
|
m_ptr = 0U;
|
||||||
m_len = 0U;
|
m_len = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1)
|
#if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1)
|
||||||
// Drain any incoming serial data
|
// Check for any incoming serial data from a device/screen on UART2
|
||||||
while (availableInt(3U))
|
int serialAvail = availableInt(3U);
|
||||||
readInt(3U);
|
if ((serialAvail > 0 && serialAvail == m_lastSerialAvail && m_lastSerialAvailCount >= MAX_SERIAL_COUNT) || (serialAvail >= MAX_SERIAL_DATA)) {
|
||||||
|
uint8_t buffer[MAX_SERIAL_DATA];
|
||||||
|
for (int i = 0; i < serialAvail && i < MAX_SERIAL_DATA; i++) {
|
||||||
|
buffer[i] = readInt(3U);
|
||||||
|
m_lastSerialAvail--;
|
||||||
|
}
|
||||||
|
serial.writeSerialRpt(buffer, serialAvail - m_lastSerialAvail);
|
||||||
|
m_lastSerialAvailCount = 0U;
|
||||||
|
} else if (serialAvail > 0 && serialAvail == m_lastSerialAvail) {
|
||||||
|
m_lastSerialAvailCount++;
|
||||||
|
} else {
|
||||||
|
m_lastSerialAvail = serialAvail;
|
||||||
|
m_lastSerialAvailCount = 0U;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1)
|
||||||
|
void CSerialPort::writeSerialRpt(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8_t head[3];
|
||||||
|
head[0U] = MMDVM_FRAME_START;
|
||||||
|
head[1U] = length + 3;
|
||||||
|
head[2U] = MMDVM_SERIAL;
|
||||||
|
|
||||||
|
writeInt(1U, head, 3U);
|
||||||
|
writeInt(1U, data, length, true);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void CSerialPort::writeDStarHeader(const uint8_t* header, uint8_t length)
|
void CSerialPort::writeDStarHeader(const uint8_t* header, uint8_t length)
|
||||||
{
|
{
|
||||||
if (m_modemState != STATE_DSTAR && m_modemState != STATE_IDLE)
|
if (m_modemState != STATE_DSTAR && m_modemState != STATE_IDLE)
|
||||||
|
|
@ -884,11 +1223,156 @@ void CSerialPort::writeP25Lost()
|
||||||
writeInt(1U, reply, 3);
|
writeInt(1U, reply, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSerialPort::writeNXDNData(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (m_modemState != STATE_NXDN && m_modemState != STATE_IDLE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_nxdnEnable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8_t reply[130U];
|
||||||
|
|
||||||
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
reply[1U] = 0U;
|
||||||
|
reply[2U] = MMDVM_NXDN_DATA;
|
||||||
|
|
||||||
|
uint8_t count = 3U;
|
||||||
|
for (uint8_t i = 0U; i < length; i++, count++)
|
||||||
|
reply[count] = data[i];
|
||||||
|
|
||||||
|
reply[1U] = count;
|
||||||
|
|
||||||
|
writeInt(1U, reply, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSerialPort::writeNXDNLost()
|
||||||
|
{
|
||||||
|
if (m_modemState != STATE_NXDN && m_modemState != STATE_IDLE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_nxdnEnable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8_t reply[3U];
|
||||||
|
|
||||||
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
reply[1U] = 3U;
|
||||||
|
reply[2U] = MMDVM_NXDN_LOST;
|
||||||
|
|
||||||
|
writeInt(1U, reply, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSerialPort::writeM17LinkSetup(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_m17Enable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8_t reply[130U];
|
||||||
|
|
||||||
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
reply[1U] = 0U;
|
||||||
|
reply[2U] = MMDVM_M17_LINK_SETUP;
|
||||||
|
|
||||||
|
uint8_t count = 3U;
|
||||||
|
for (uint8_t i = 0U; i < length; i++, count++)
|
||||||
|
reply[count] = data[i];
|
||||||
|
|
||||||
|
reply[1U] = count;
|
||||||
|
|
||||||
|
writeInt(1U, reply, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSerialPort::writeM17Stream(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_m17Enable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8_t reply[130U];
|
||||||
|
|
||||||
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
reply[1U] = 0U;
|
||||||
|
reply[2U] = MMDVM_M17_STREAM;
|
||||||
|
|
||||||
|
uint8_t count = 3U;
|
||||||
|
for (uint8_t i = 0U; i < length; i++, count++)
|
||||||
|
reply[count] = data[i];
|
||||||
|
|
||||||
|
reply[1U] = count;
|
||||||
|
|
||||||
|
writeInt(1U, reply, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSerialPort::writeM17EOT()
|
||||||
|
{
|
||||||
|
if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_m17Enable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8_t reply[3U];
|
||||||
|
|
||||||
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
reply[1U] = 3U;
|
||||||
|
reply[2U] = MMDVM_M17_EOT;
|
||||||
|
|
||||||
|
writeInt(1U, reply, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSerialPort::writeM17Lost()
|
||||||
|
{
|
||||||
|
if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_m17Enable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8_t reply[3U];
|
||||||
|
|
||||||
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
reply[1U] = 3U;
|
||||||
|
reply[2U] = MMDVM_M17_LOST;
|
||||||
|
|
||||||
|
writeInt(1U, reply, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
|
||||||
|
void CSerialPort::writeRSSIData(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (m_calState != STATE_RSSICAL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8_t reply[30U];
|
||||||
|
|
||||||
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
reply[1U] = 0U;
|
||||||
|
reply[2U] = MMDVM_RSSI_DATA;
|
||||||
|
|
||||||
|
uint8_t count = 3U;
|
||||||
|
for (uint8_t i = 0U; i < length; i++, count++)
|
||||||
|
reply[count] = data[i];
|
||||||
|
|
||||||
|
reply[1U] = count;
|
||||||
|
|
||||||
|
writeInt(1U, reply, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
void CSerialPort::writeDebug(const char* text)
|
void CSerialPort::writeDebug(const char* text)
|
||||||
{
|
{
|
||||||
if (!m_debug)
|
if (!m_debug)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint8_t reply[130U];
|
uint8_t reply[130U];
|
||||||
|
|
||||||
reply[0U] = MMDVM_FRAME_START;
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
|
@ -908,7 +1392,7 @@ void CSerialPort::writeDebugI(const char* text, int32_t n1)
|
||||||
{
|
{
|
||||||
if (!m_debug)
|
if (!m_debug)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint8_t reply[130U];
|
uint8_t reply[130U];
|
||||||
|
|
||||||
reply[0U] = MMDVM_FRAME_START;
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
|
@ -919,7 +1403,7 @@ void CSerialPort::writeDebugI(const char* text, int32_t n1)
|
||||||
for (uint8_t i = 0U; text[i] != '\0'; i++, count++)
|
for (uint8_t i = 0U; text[i] != '\0'; i++, count++)
|
||||||
reply[count] = text[i];
|
reply[count] = text[i];
|
||||||
|
|
||||||
reply[count++] = ' ';
|
reply[count++] = ' ';
|
||||||
|
|
||||||
i2str(&reply[count], 130U - count, n1);
|
i2str(&reply[count], 130U - count, n1);
|
||||||
|
|
||||||
|
|
@ -934,7 +1418,7 @@ void CSerialPort::writeDebug(const char* text, int16_t n1)
|
||||||
{
|
{
|
||||||
if (!m_debug)
|
if (!m_debug)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint8_t reply[130U];
|
uint8_t reply[130U];
|
||||||
|
|
||||||
reply[0U] = MMDVM_FRAME_START;
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
|
@ -952,12 +1436,13 @@ void CSerialPort::writeDebug(const char* text, int16_t n1)
|
||||||
|
|
||||||
writeInt(1U, reply, count, true);
|
writeInt(1U, reply, count, true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2)
|
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2)
|
||||||
{
|
{
|
||||||
if (!m_debug)
|
if (!m_debug)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint8_t reply[130U];
|
uint8_t reply[130U];
|
||||||
|
|
||||||
reply[0U] = MMDVM_FRAME_START;
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
|
@ -979,11 +1464,12 @@ void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2)
|
||||||
writeInt(1U, reply, count, true);
|
writeInt(1U, reply, count, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3)
|
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3)
|
||||||
{
|
{
|
||||||
if (!m_debug)
|
if (!m_debug)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint8_t reply[130U];
|
uint8_t reply[130U];
|
||||||
|
|
||||||
reply[0U] = MMDVM_FRAME_START;
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
|
@ -1039,3 +1525,4 @@ void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n
|
||||||
|
|
||||||
writeInt(1U, reply, count, true);
|
writeInt(1U, reply, count, true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
||||||
36
SerialPort.h
36
SerialPort.h
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2018,2020,2021 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -29,6 +30,10 @@ public:
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
|
|
||||||
|
#if defined(SERIAL_REPEATER) || defined(SERIAL_REPEATER_USART1)
|
||||||
|
void writeSerialRpt(const uint8_t* data, uint8_t length);
|
||||||
|
#endif
|
||||||
|
|
||||||
void writeDStarHeader(const uint8_t* header, uint8_t length);
|
void writeDStarHeader(const uint8_t* header, uint8_t length);
|
||||||
void writeDStarData(const uint8_t* data, uint8_t length);
|
void writeDStarData(const uint8_t* data, uint8_t length);
|
||||||
void writeDStarLost();
|
void writeDStarLost();
|
||||||
|
|
@ -44,18 +49,36 @@ public:
|
||||||
void writeP25Ldu(const uint8_t* data, uint8_t length);
|
void writeP25Ldu(const uint8_t* data, uint8_t length);
|
||||||
void writeP25Lost();
|
void writeP25Lost();
|
||||||
|
|
||||||
|
void writeNXDNData(const uint8_t* data, uint8_t length);
|
||||||
|
void writeNXDNLost();
|
||||||
|
|
||||||
|
void writeM17LinkSetup(const uint8_t* data, uint8_t length);
|
||||||
|
void writeM17Stream(const uint8_t* data, uint8_t length);
|
||||||
|
void writeM17EOT();
|
||||||
|
void writeM17Lost();
|
||||||
|
|
||||||
|
#if defined(SEND_RSSI_DATA)
|
||||||
|
void writeRSSIData(const uint8_t* data, uint8_t length);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
void writeDebug(const char* text);
|
void writeDebug(const char* text);
|
||||||
void writeDebug(const char* text, int16_t n1);
|
void writeDebug(const char* text, int16_t n1);
|
||||||
void writeDebugI(const char* text, int32_t n1);
|
void writeDebugI(const char* text, int32_t n1);
|
||||||
void writeDebug(const char* text, int16_t n1, int16_t n2);
|
|
||||||
void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3);
|
void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3);
|
||||||
void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3, int16_t n4);
|
void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3, int16_t n4);
|
||||||
|
#endif
|
||||||
|
void writeDebug(const char* text, int16_t n1, int16_t n2);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t m_buffer[256U];
|
uint8_t m_buffer[256U];
|
||||||
uint8_t m_ptr;
|
uint8_t m_ptr;
|
||||||
uint8_t m_len;
|
uint8_t m_len;
|
||||||
|
int m_lastSerialAvail;
|
||||||
|
uint16_t m_lastSerialAvailCount;
|
||||||
|
|
||||||
bool m_debug;
|
bool m_debug;
|
||||||
|
bool m_firstCal;
|
||||||
|
|
||||||
void sendACK();
|
void sendACK();
|
||||||
void sendNAK(uint8_t err);
|
void sendNAK(uint8_t err);
|
||||||
|
|
@ -65,7 +88,7 @@ private:
|
||||||
uint8_t setMode(const uint8_t* data, uint8_t length);
|
uint8_t setMode(const uint8_t* data, uint8_t length);
|
||||||
void setMode(MMDVM_STATE modemState);
|
void setMode(MMDVM_STATE modemState);
|
||||||
uint8_t setFreq(const uint8_t* data, uint8_t length);
|
uint8_t setFreq(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
// Hardware versions
|
// Hardware versions
|
||||||
void beginInt(uint8_t n, int speed);
|
void beginInt(uint8_t n, int speed);
|
||||||
int availableInt(uint8_t n);
|
int availableInt(uint8_t n);
|
||||||
|
|
@ -74,4 +97,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,15 @@ Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
#if defined(STM32F10X_MD)
|
#if defined(STM32F10X_MD)
|
||||||
#include "stm32f10x.h"
|
#include "stm32f10x.h"
|
||||||
|
#elif defined(STM32F4XX)
|
||||||
|
#include "stm32f4xx.h"
|
||||||
|
#elif defined(STM32F7XX)
|
||||||
|
#include "stm32f7xx.h"
|
||||||
#else
|
#else
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const uint16_t SERIAL_RINGBUFFER_SIZE = 370U;
|
const uint16_t SERIAL_RINGBUFFER_SIZE = 1000U;
|
||||||
|
|
||||||
class CSerialRB {
|
class CSerialRB {
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 by Jim McLaughlin KI6ZUM
|
* Copyright (C) 2016 by Jim McLaughlin KI6ZUM
|
||||||
* Copyright (C) 2016 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018,2019 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "SerialPort.h"
|
#include "SerialPort.h"
|
||||||
|
#include "I2CHost.h"
|
||||||
|
|
||||||
#if defined(STM32_USB_HOST)
|
#if defined(STM32_USB_HOST)
|
||||||
#include <usb_serial.h>
|
#include <usb_serial.h>
|
||||||
|
|
@ -32,9 +33,9 @@
|
||||||
Pin definitions:
|
Pin definitions:
|
||||||
|
|
||||||
- Host communication:
|
- Host communication:
|
||||||
USART1 - TXD PA9 - RXD PA10
|
1) USART1 - TXD PA9 - RXD PA10
|
||||||
or
|
2) USB VCOM
|
||||||
USB VCOM
|
3) I2C - SCL PB10 - SDA PB11
|
||||||
|
|
||||||
- Serial repeater
|
- Serial repeater
|
||||||
USART2 - TXD PA2 - RXD PA3
|
USART2 - TXD PA2 - RXD PA3
|
||||||
|
|
@ -44,6 +45,10 @@ USART2 - TXD PA2 - RXD PA3
|
||||||
#define TX_SERIAL_FIFO_SIZE 256U
|
#define TX_SERIAL_FIFO_SIZE 256U
|
||||||
#define RX_SERIAL_FIFO_SIZE 256U
|
#define RX_SERIAL_FIFO_SIZE 256U
|
||||||
|
|
||||||
|
#if defined(STM32_USART1_HOST) && defined(STM32_USB_HOST)
|
||||||
|
#error "You have to select STM32_USART1_HOST or STM32_USB_HOST, but not both"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(STM32_USART1_HOST) || defined(SERIAL_REPEATER_USART1)
|
#if defined(STM32_USART1_HOST) || defined(SERIAL_REPEATER_USART1)
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
@ -428,15 +433,45 @@ void WriteUSART2(const uint8_t* data, uint16_t length)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
#if defined(ENABLE_UDID)
|
||||||
|
extern char UDID[];
|
||||||
|
extern "C" {
|
||||||
|
#include <stdio.h>
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void CSerialPort::beginInt(uint8_t n, int speed)
|
void CSerialPort::beginInt(uint8_t n, int speed)
|
||||||
{
|
{
|
||||||
|
#if defined(ENABLE_UDID)
|
||||||
|
#if defined(STM32F4XX)
|
||||||
|
uint32_t *id0 = (uint32_t *) (0x1FFF7A10);
|
||||||
|
uint32_t *id1 = (uint32_t *) (0x1FFF7A10 + 0x04);
|
||||||
|
uint32_t *id2 = (uint32_t *) (0x1FFF7A10 + 0x08);
|
||||||
|
::sprintf(UDID, "%08X%08X%08X", *(unsigned int *)id0, *(unsigned int *)id1, *(unsigned int *)id2);
|
||||||
|
|
||||||
|
#elif defined(STM32F7XX)
|
||||||
|
uint32_t *id0 = (uint32_t *) (0x1FF0F420);
|
||||||
|
uint32_t *id1 = (uint32_t *) (0x1FF0F420 + 0x04);
|
||||||
|
uint32_t *id2 = (uint32_t *) (0x1FF0F420 + 0x08);
|
||||||
|
::sprintf(UDID, "%08X%08X%08X", *(unsigned int *)id0, *(unsigned int *)id1, *(unsigned int *)id2);
|
||||||
|
|
||||||
|
#elif defined(STM32F10X_MD)
|
||||||
|
uint16_t *id00 = (uint16_t *) (0x1FFFF7E8);
|
||||||
|
uint16_t *id01 = (uint16_t *) (0x1FFFF7E8 + 0x02);
|
||||||
|
uint32_t *id1 = (uint32_t *) (0x1FFFF7E8 + 0x04);
|
||||||
|
uint32_t *id2 = (uint32_t *) (0x1FFFF7E8 + 0x08);
|
||||||
|
::sprintf(UDID, "%04X%04X%08X%08X", *id00, *id01, *(unsigned int *)id1, *(unsigned int *)id2);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 1U:
|
case 1U:
|
||||||
#if defined(STM32_USART1_HOST)
|
#if defined(STM32_USART1_HOST)
|
||||||
InitUSART1(speed);
|
InitUSART1(speed);
|
||||||
#elif defined(STM32_USB_HOST)
|
#elif defined(STM32_USB_HOST)
|
||||||
usbserial.begin();
|
usbserial.begin();
|
||||||
|
#elif defined(STM32_I2C_HOST)
|
||||||
|
i2c.Init();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 3U:
|
case 3U:
|
||||||
|
|
@ -448,7 +483,7 @@ void CSerialPort::beginInt(uint8_t n, int speed)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSerialPort::availableInt(uint8_t n)
|
int CSerialPort::availableInt(uint8_t n)
|
||||||
|
|
@ -459,6 +494,8 @@ int CSerialPort::availableInt(uint8_t n)
|
||||||
return AvailUSART1();
|
return AvailUSART1();
|
||||||
#elif defined(STM32_USB_HOST)
|
#elif defined(STM32_USB_HOST)
|
||||||
return usbserial.available();
|
return usbserial.available();
|
||||||
|
#elif defined(STM32_I2C_HOST)
|
||||||
|
return i2c.AvailI2C();
|
||||||
#endif
|
#endif
|
||||||
case 3U:
|
case 3U:
|
||||||
#if defined(SERIAL_REPEATER)
|
#if defined(SERIAL_REPEATER)
|
||||||
|
|
@ -479,6 +516,8 @@ uint8_t CSerialPort::readInt(uint8_t n)
|
||||||
return ReadUSART1();
|
return ReadUSART1();
|
||||||
#elif defined(STM32_USB_HOST)
|
#elif defined(STM32_USB_HOST)
|
||||||
return usbserial.read();
|
return usbserial.read();
|
||||||
|
#elif defined(STM32_I2C_HOST)
|
||||||
|
return i2c.ReadI2C();
|
||||||
#endif
|
#endif
|
||||||
case 3U:
|
case 3U:
|
||||||
#if defined(SERIAL_REPEATER)
|
#if defined(SERIAL_REPEATER)
|
||||||
|
|
@ -497,12 +536,14 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool
|
||||||
case 1U:
|
case 1U:
|
||||||
#if defined(STM32_USART1_HOST)
|
#if defined(STM32_USART1_HOST)
|
||||||
WriteUSART1(data, length);
|
WriteUSART1(data, length);
|
||||||
if (flush)
|
if (flush)
|
||||||
TXSerialFlush1();
|
TXSerialFlush1();
|
||||||
#elif defined(STM32_USB_HOST)
|
#elif defined(STM32_USB_HOST)
|
||||||
usbserial.write(data, length);
|
usbserial.write(data, length);
|
||||||
if (flush)
|
if (flush)
|
||||||
usbserial.flush();
|
usbserial.flush();
|
||||||
|
#elif defined(STM32_I2C_HOST)
|
||||||
|
i2c.WriteI2C(data, length);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 3U:
|
case 3U:
|
||||||
|
|
|
||||||
14
Utils.cpp
14
Utils.cpp
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2020 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -30,6 +31,15 @@ uint8_t countBits8(uint8_t bits)
|
||||||
return BITS_TABLE[bits];
|
return BITS_TABLE[bits];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t countBits16(uint16_t bits)
|
||||||
|
{
|
||||||
|
uint8_t* p = (uint8_t*)&bits;
|
||||||
|
uint8_t n = 0U;
|
||||||
|
n += BITS_TABLE[p[0U]];
|
||||||
|
n += BITS_TABLE[p[1U]];
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t countBits32(uint32_t bits)
|
uint8_t countBits32(uint32_t bits)
|
||||||
{
|
{
|
||||||
uint8_t* p = (uint8_t*)&bits;
|
uint8_t* p = (uint8_t*)&bits;
|
||||||
|
|
@ -56,6 +66,7 @@ uint8_t countBits64(uint64_t bits)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
// Simple functions to convert from int to string
|
// Simple functions to convert from int to string
|
||||||
// Example from: https://stackoverflow.com/questions/8257714/how-to-convert-an-int-to-string-in-c
|
// Example from: https://stackoverflow.com/questions/8257714/how-to-convert-an-int-to-string-in-c
|
||||||
static uint8_t *i2str_helper(uint8_t *dest, uint32_t n, int32_t x) {
|
static uint8_t *i2str_helper(uint8_t *dest, uint32_t n, int32_t x) {
|
||||||
|
|
@ -82,3 +93,4 @@ uint8_t *i2str(uint8_t *dest, uint32_t n, int32_t x) {
|
||||||
*p = 0;
|
*p = 0;
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
||||||
13
Utils.h
13
Utils.h
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -19,19 +20,29 @@
|
||||||
#if !defined(UTILS_H)
|
#if !defined(UTILS_H)
|
||||||
#define UTILS_H
|
#define UTILS_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
#if defined(STM32F10X_MD)
|
#if defined(STM32F10X_MD)
|
||||||
#include "stm32f10x.h"
|
#include "stm32f10x.h"
|
||||||
|
#elif defined(STM32F4XX)
|
||||||
|
#include "stm32f4xx.h"
|
||||||
|
#elif defined(STM32F7XX)
|
||||||
|
#include "stm32f7xx.h"
|
||||||
#else
|
#else
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t countBits8(uint8_t bits);
|
uint8_t countBits8(uint8_t bits);
|
||||||
|
|
||||||
|
uint8_t countBits16(uint16_t bits);
|
||||||
|
|
||||||
uint8_t countBits32(uint32_t bits);
|
uint8_t countBits32(uint32_t bits);
|
||||||
|
|
||||||
uint8_t countBits64(uint64_t bits);
|
uint8_t countBits64(uint64_t bits);
|
||||||
|
|
||||||
|
#if defined(ENABLE_DEBUG)
|
||||||
uint8_t *i2str(uint8_t *dest, uint32_t n, int32_t x);
|
uint8_t *i2str(uint8_t *dest, uint32_t n, int32_t x);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
20
YSFDefines.h
20
YSFDefines.h
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
|
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX
|
||||||
|
* Copyright (C) 2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -19,16 +20,13 @@
|
||||||
#if !defined(YSFDEFINES_H)
|
#if !defined(YSFDEFINES_H)
|
||||||
#define YSFDEFINES_H
|
#define YSFDEFINES_H
|
||||||
|
|
||||||
const unsigned int YSF_FRAME_LENGTH_BYTES = 120U;
|
const unsigned int YSF_FRAME_LENGTH_BYTES = 120U;
|
||||||
const unsigned int YSF_FRAME_LENGTH_BITS = YSF_FRAME_LENGTH_BYTES * 8U;
|
const unsigned int YSF_FRAME_LENGTH_BITS = YSF_FRAME_LENGTH_BYTES * 8U;
|
||||||
const unsigned int YSF_FRAME_LENGTH_SYMBOLS = YSF_FRAME_LENGTH_BYTES * 4U;
|
|
||||||
|
|
||||||
const unsigned int YSF_SYNC_LENGTH_BYTES = 5U;
|
const unsigned int YSF_SYNC_LENGTH_BYTES = 5U;
|
||||||
const unsigned int YSF_SYNC_LENGTH_BITS = YSF_SYNC_LENGTH_BYTES * 8U;
|
const unsigned int YSF_SYNC_LENGTH_BITS = YSF_SYNC_LENGTH_BYTES * 8U;
|
||||||
const unsigned int YSF_SYNC_LENGTH_SYMBOLS = YSF_SYNC_LENGTH_BYTES * 4U;
|
|
||||||
|
|
||||||
const unsigned int YSF_FICH_LENGTH_BITS = 200U;
|
const unsigned int YSF_FICH_LENGTH_BITS = 200U;
|
||||||
const unsigned int YSF_FICH_LENGTH_SYMBOLS = 100U;
|
|
||||||
|
|
||||||
const uint8_t YSF_SYNC_BYTES[] = {0xD4U, 0x71U, 0xC9U, 0x63U, 0x4DU};
|
const uint8_t YSF_SYNC_BYTES[] = {0xD4U, 0x71U, 0xC9U, 0x63U, 0x4DU};
|
||||||
const uint8_t YSF_SYNC_BYTES_LENGTH = 5U;
|
const uint8_t YSF_SYNC_BYTES_LENGTH = 5U;
|
||||||
|
|
@ -36,11 +34,5 @@ const uint8_t YSF_SYNC_BYTES_LENGTH = 5U;
|
||||||
const uint64_t YSF_SYNC_BITS = 0x000000D471C9634DU;
|
const uint64_t YSF_SYNC_BITS = 0x000000D471C9634DU;
|
||||||
const uint64_t YSF_SYNC_BITS_MASK = 0x000000FFFFFFFFFFU;
|
const uint64_t YSF_SYNC_BITS_MASK = 0x000000FFFFFFFFFFU;
|
||||||
|
|
||||||
// D 4 7 1 C 9 6 3 4 D
|
|
||||||
// 11 01 01 00 01 11 00 01 11 00 10 01 01 10 00 11 01 00 11 01
|
|
||||||
// -3 +3 +3 +1 +3 -3 +1 +3 -3 +1 -1 +3 +3 -1 +3 -3 +3 +1 -3 +3
|
|
||||||
const uint32_t YSF_SYNC_SYMBOLS = 0x0007B5ADU;
|
|
||||||
const uint32_t YSF_SYNC_SYMBOLS_MASK = 0x000FFFFFU;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
24
YSFRX.cpp
24
YSFRX.cpp
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2017 by Jonathan Naylor G4KLX
|
* Copyright (C) 2009-2017 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -25,14 +25,13 @@
|
||||||
const uint8_t SYNC_BIT_START_ERRS = 2U;
|
const uint8_t SYNC_BIT_START_ERRS = 2U;
|
||||||
const uint8_t SYNC_BIT_RUN_ERRS = 4U;
|
const uint8_t SYNC_BIT_RUN_ERRS = 4U;
|
||||||
|
|
||||||
const unsigned int MAX_SYNC_FRAMES = 4U + 1U;
|
const unsigned int MAX_SYNC_FRAMES = 1U + 1U;
|
||||||
|
|
||||||
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
||||||
|
|
||||||
#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
|
#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
|
||||||
|
|
||||||
CYSFRX::CYSFRX() :
|
CYSFRX::CYSFRX() :
|
||||||
m_prev(false),
|
|
||||||
m_state(YSFRXS_NONE),
|
m_state(YSFRXS_NONE),
|
||||||
m_bitBuffer(0x00U),
|
m_bitBuffer(0x00U),
|
||||||
m_outBuffer(),
|
m_outBuffer(),
|
||||||
|
|
@ -45,7 +44,6 @@ m_lostCount(0U)
|
||||||
|
|
||||||
void CYSFRX::reset()
|
void CYSFRX::reset()
|
||||||
{
|
{
|
||||||
m_prev = false;
|
|
||||||
m_state = YSFRXS_NONE;
|
m_state = YSFRXS_NONE;
|
||||||
m_bitBuffer = 0x00U;
|
m_bitBuffer = 0x00U;
|
||||||
m_bufferPtr = 0U;
|
m_bufferPtr = 0U;
|
||||||
|
|
@ -75,9 +73,8 @@ void CYSFRX::processNone(bool bit)
|
||||||
m_lostCount = MAX_SYNC_FRAMES;
|
m_lostCount = MAX_SYNC_FRAMES;
|
||||||
m_bufferPtr = YSF_SYNC_LENGTH_BITS;
|
m_bufferPtr = YSF_SYNC_LENGTH_BITS;
|
||||||
m_state = YSFRXS_DATA;
|
m_state = YSFRXS_DATA;
|
||||||
|
|
||||||
io.setDecode(true);
|
io.setDecode(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -89,9 +86,12 @@ void CYSFRX::processData(bool bit)
|
||||||
m_bitBuffer |= 0x01U;
|
m_bitBuffer |= 0x01U;
|
||||||
|
|
||||||
WRITE_BIT1(m_buffer, m_bufferPtr, bit);
|
WRITE_BIT1(m_buffer, m_bufferPtr, bit);
|
||||||
m_bufferPtr++;
|
|
||||||
|
|
||||||
// Only search for a sync in the right place +-2 symbols
|
m_bufferPtr++;
|
||||||
|
if (m_bufferPtr > YSF_FRAME_LENGTH_BITS)
|
||||||
|
reset();
|
||||||
|
|
||||||
|
// Only search for a sync in the right place +-2 bits
|
||||||
if (m_bufferPtr >= (YSF_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (YSF_SYNC_LENGTH_BITS + 2U)) {
|
if (m_bufferPtr >= (YSF_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (YSF_SYNC_LENGTH_BITS + 2U)) {
|
||||||
// Fuzzy matching of the data sync bit sequence
|
// Fuzzy matching of the data sync bit sequence
|
||||||
if (countBits64((m_bitBuffer & YSF_SYNC_BITS_MASK) ^ YSF_SYNC_BITS) <= SYNC_BIT_RUN_ERRS) {
|
if (countBits64((m_bitBuffer & YSF_SYNC_BITS_MASK) ^ YSF_SYNC_BITS) <= SYNC_BIT_RUN_ERRS) {
|
||||||
|
|
@ -103,18 +103,16 @@ void CYSFRX::processData(bool bit)
|
||||||
|
|
||||||
// Send a data frame to the host if the required number of bits have been received
|
// Send a data frame to the host if the required number of bits have been received
|
||||||
if (m_bufferPtr == YSF_FRAME_LENGTH_BITS) {
|
if (m_bufferPtr == YSF_FRAME_LENGTH_BITS) {
|
||||||
// We've not seen a data sync for too long, signal RXLOST and change to RX_NONE
|
|
||||||
m_lostCount--;
|
m_lostCount--;
|
||||||
|
// We've not seen a data sync for too long, signal RXLOST and change to RX_NONE
|
||||||
if (m_lostCount == 0U) {
|
if (m_lostCount == 0U) {
|
||||||
DEBUG1("YSFRX: sync timed out, lost lock");
|
DEBUG1("YSFRX: sync timed out, lost lock");
|
||||||
io.setDecode(false);
|
io.setDecode(false);
|
||||||
|
|
||||||
serial.writeYSFLost();
|
serial.writeYSFLost();
|
||||||
|
reset();
|
||||||
m_state = YSFRXS_NONE;
|
|
||||||
} else {
|
} else {
|
||||||
|
// Write data to host
|
||||||
m_outBuffer[0U] = m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U;
|
m_outBuffer[0U] = m_lostCount == (MAX_SYNC_FRAMES - 1U) ? 0x01U : 0x00U;
|
||||||
|
|
||||||
writeRSSIData(m_outBuffer);
|
writeRSSIData(m_outBuffer);
|
||||||
|
|
||||||
// Start the next frame
|
// Start the next frame
|
||||||
|
|
|
||||||
6
YSFRX.h
6
YSFRX.h
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -36,7 +36,6 @@ public:
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_prev;
|
|
||||||
YSFRX_STATE m_state;
|
YSFRX_STATE m_state;
|
||||||
uint64_t m_bitBuffer;
|
uint64_t m_bitBuffer;
|
||||||
uint8_t m_outBuffer[YSF_FRAME_LENGTH_BYTES + 3U];
|
uint8_t m_outBuffer[YSF_FRAME_LENGTH_BYTES + 3U];
|
||||||
|
|
@ -47,8 +46,7 @@ private:
|
||||||
void processNone(bool bit);
|
void processNone(bool bit);
|
||||||
void processData(bool bit);
|
void processData(bool bit);
|
||||||
void writeRSSIData(uint8_t* data);
|
void writeRSSIData(uint8_t* data);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
|
* Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -32,7 +32,7 @@ m_poBuffer(),
|
||||||
m_poLen(0U),
|
m_poLen(0U),
|
||||||
m_poPtr(0U),
|
m_poPtr(0U),
|
||||||
m_txDelay(240U), // 200ms
|
m_txDelay(240U), // 200ms
|
||||||
m_count(0U)
|
m_delay(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,7 +44,6 @@ void CYSFTX::process()
|
||||||
if (m_poLen == 0U) {
|
if (m_poLen == 0U) {
|
||||||
if (!m_tx) {
|
if (!m_tx) {
|
||||||
m_delay = true;
|
m_delay = true;
|
||||||
m_count = 0U;
|
|
||||||
m_poLen = m_txDelay;
|
m_poLen = m_txDelay;
|
||||||
} else {
|
} else {
|
||||||
m_delay = false;
|
m_delay = false;
|
||||||
|
|
|
||||||
3
YSFTX.h
3
YSFTX.h
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
||||||
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2016,2017 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -40,7 +40,6 @@ private:
|
||||||
uint16_t m_poLen;
|
uint16_t m_poLen;
|
||||||
uint16_t m_poPtr;
|
uint16_t m_poPtr;
|
||||||
uint16_t m_txDelay;
|
uint16_t m_txDelay;
|
||||||
uint32_t m_count;
|
|
||||||
bool m_delay;
|
bool m_delay;
|
||||||
|
|
||||||
void writeByte(uint8_t c);
|
void writeByte(uint8_t c);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 by Andy Uribe CA6JAU
|
* Copyright (C) 2016-2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
/* Memory areas */
|
/* Memory areas */
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
ROM (rx) : ORIGIN = 0x08002000, LENGTH = 56K /* FLASH */
|
ROM (rx) : ORIGIN = 0x08002000, LENGTH = 120K /* FLASH */
|
||||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K /* Main RAM */
|
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K /* Main RAM */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
119
configs/D2RG_MMDVM_HS.h
Normal file
119
configs/D2RG_MMDVM_HS.h
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Select one board (STM32F103 based boards)
|
||||||
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
|
// #define ZUMSPOT_ADF7021
|
||||||
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
|
// #define LIBRE_KIT_ADF7021
|
||||||
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
#define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
|
// Enable ADF7021 support:
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
|
// #define DUPLEX
|
||||||
|
|
||||||
|
// TCXO of the ADF7021
|
||||||
|
// For 14.7456 MHz:
|
||||||
|
#define ADF7021_14_7456
|
||||||
|
// For 12.2880 MHz:
|
||||||
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
|
// Host communication selection:
|
||||||
|
#define STM32_USART1_HOST
|
||||||
|
// #define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
|
// Enable mode detection:
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
|
// Send RSSI value:
|
||||||
|
#define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
||||||
|
// Enable P25 Wide modulation:
|
||||||
|
// #define ENABLE_P25_WIDE
|
||||||
|
|
||||||
|
// Disable mode LEDs blink during scan mode:
|
||||||
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
// #define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
// #define ENABLE_UDID
|
||||||
|
|
||||||
|
#endif
|
||||||
120
configs/LoneStar_USB.h
Normal file
120
configs/LoneStar_USB.h
Normal file
|
|
@ -0,0 +1,120 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Select one board (STM32F103 based boards)
|
||||||
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
|
// #define ZUMSPOT_ADF7021
|
||||||
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
|
// #define LIBRE_KIT_ADF7021
|
||||||
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
// 9) LoneStar USB Stick ADF7071
|
||||||
|
#define LONESTAR_USB
|
||||||
|
|
||||||
|
// Enable ADF7021 support:
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
|
// #define DUPLEX
|
||||||
|
|
||||||
|
// TCXO of the ADF7021
|
||||||
|
// For 14.7456 MHz:
|
||||||
|
#define ADF7021_14_7456
|
||||||
|
// For 12.2880 MHz:
|
||||||
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
|
// Host communication selection:
|
||||||
|
// #define STM32_USART1_HOST
|
||||||
|
#define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
|
// Enable mode detection:
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
|
// Send RSSI value:
|
||||||
|
#define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
|
// #define SERIAL_REPEATER
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
||||||
|
// Enable P25 Wide modulation:
|
||||||
|
// #define ENABLE_P25_WIDE
|
||||||
|
|
||||||
|
// Disable mode LEDs blink during scan mode:
|
||||||
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
#define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
// #define ENABLE_UDID
|
||||||
|
|
||||||
|
#endif
|
||||||
119
configs/MMDVM_HS_Dual_Hat-12mhz.h
Normal file
119
configs/MMDVM_HS_Dual_Hat-12mhz.h
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU, Florian Wolters DF2ET
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Select one board (STM32F103 based boards)
|
||||||
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
|
// #define ZUMSPOT_ADF7021
|
||||||
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
|
// #define LIBRE_KIT_ADF7021
|
||||||
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
#define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
|
// Enable ADF7021 support:
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
|
#define DUPLEX
|
||||||
|
|
||||||
|
// TCXO of the ADF7021
|
||||||
|
// For 14.7456 MHz:
|
||||||
|
// #define ADF7021_14_7456
|
||||||
|
// For 12.2880 MHz:
|
||||||
|
#define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
|
// Host communication selection:
|
||||||
|
#define STM32_USART1_HOST
|
||||||
|
// #define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
|
// Enable mode detection:
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
|
// Send RSSI value:
|
||||||
|
#define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
||||||
|
// Enable P25 Wide modulation:
|
||||||
|
// #define ENABLE_P25_WIDE
|
||||||
|
|
||||||
|
// Disable mode LEDs blink during scan mode:
|
||||||
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
#define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
// #define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
// #define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
#define ENABLE_UDID
|
||||||
|
|
||||||
|
#endif
|
||||||
119
configs/MMDVM_HS_Dual_Hat.h
Normal file
119
configs/MMDVM_HS_Dual_Hat.h
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU, Florian Wolters DF2ET
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Select one board (STM32F103 based boards)
|
||||||
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
|
// #define ZUMSPOT_ADF7021
|
||||||
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
|
// #define LIBRE_KIT_ADF7021
|
||||||
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
#define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
|
// Enable ADF7021 support:
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
|
#define DUPLEX
|
||||||
|
|
||||||
|
// TCXO of the ADF7021
|
||||||
|
// For 14.7456 MHz:
|
||||||
|
#define ADF7021_14_7456
|
||||||
|
// For 12.2880 MHz:
|
||||||
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
|
// Host communication selection:
|
||||||
|
#define STM32_USART1_HOST
|
||||||
|
// #define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
|
// Enable mode detection:
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
|
// Send RSSI value:
|
||||||
|
#define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
||||||
|
// Enable P25 Wide modulation:
|
||||||
|
// #define ENABLE_P25_WIDE
|
||||||
|
|
||||||
|
// Disable mode LEDs blink during scan mode:
|
||||||
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
#define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
// #define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
// #define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
#define ENABLE_UDID
|
||||||
|
|
||||||
|
#endif
|
||||||
119
configs/MMDVM_HS_Hat-12mhz.h
Normal file
119
configs/MMDVM_HS_Hat-12mhz.h
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU, Florian Wolters DF2ET
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Select one board (STM32F103 based boards)
|
||||||
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
|
// #define ZUMSPOT_ADF7021
|
||||||
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
|
// #define LIBRE_KIT_ADF7021
|
||||||
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
|
#define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
|
// Enable ADF7021 support:
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
|
// #define DUPLEX
|
||||||
|
|
||||||
|
// TCXO of the ADF7021
|
||||||
|
// For 14.7456 MHz:
|
||||||
|
// #define ADF7021_14_7456
|
||||||
|
// For 12.2880 MHz:
|
||||||
|
#define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
|
// Host communication selection:
|
||||||
|
#define STM32_USART1_HOST
|
||||||
|
// #define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
|
// Enable mode detection:
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
|
// Send RSSI value:
|
||||||
|
#define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
||||||
|
// Enable P25 Wide modulation:
|
||||||
|
// #define ENABLE_P25_WIDE
|
||||||
|
|
||||||
|
// Disable mode LEDs blink during scan mode:
|
||||||
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
#define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
// #define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
#define ENABLE_UDID
|
||||||
|
|
||||||
|
#endif
|
||||||
119
configs/MMDVM_HS_Hat.h
Normal file
119
configs/MMDVM_HS_Hat.h
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Select one board (STM32F103 based boards)
|
||||||
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
|
// #define ZUMSPOT_ADF7021
|
||||||
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
|
// #define LIBRE_KIT_ADF7021
|
||||||
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
|
#define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
|
// Enable ADF7021 support:
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
|
// #define DUPLEX
|
||||||
|
|
||||||
|
// TCXO of the ADF7021
|
||||||
|
// For 14.7456 MHz:
|
||||||
|
#define ADF7021_14_7456
|
||||||
|
// For 12.2880 MHz:
|
||||||
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
|
// Host communication selection:
|
||||||
|
#define STM32_USART1_HOST
|
||||||
|
// #define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
|
// Enable mode detection:
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
|
// Send RSSI value:
|
||||||
|
#define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
||||||
|
// Enable P25 Wide modulation:
|
||||||
|
// #define ENABLE_P25_WIDE
|
||||||
|
|
||||||
|
// Disable mode LEDs blink during scan mode:
|
||||||
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
#define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
// #define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
#define ENABLE_UDID
|
||||||
|
|
||||||
|
#endif
|
||||||
119
configs/NanoDV_NPI.h
Normal file
119
configs/NanoDV_NPI.h
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Select one board (STM32F103 based boards)
|
||||||
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
|
// #define ZUMSPOT_ADF7021
|
||||||
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
|
// #define LIBRE_KIT_ADF7021
|
||||||
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.1 (BG4TGO & BG5HHP)
|
||||||
|
#define NANO_DV_REV11
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
|
// Enable ADF7021 support:
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
|
// #define DUPLEX
|
||||||
|
|
||||||
|
// TCXO of the ADF7021
|
||||||
|
// For 14.7456 MHz:
|
||||||
|
// #define ADF7021_14_7456
|
||||||
|
// For 12.2880 MHz:
|
||||||
|
#define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
|
// Host communication selection:
|
||||||
|
#define STM32_USART1_HOST
|
||||||
|
// #define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
|
// Enable mode detection:
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
|
// Send RSSI value:
|
||||||
|
#define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
||||||
|
// Enable P25 Wide modulation:
|
||||||
|
#define ENABLE_P25_WIDE
|
||||||
|
|
||||||
|
// Disable mode LEDs blink during scan mode:
|
||||||
|
#define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
#define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
// #define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
#define ENABLE_UDID
|
||||||
|
|
||||||
|
#endif
|
||||||
119
configs/NanoDV_USB.h
Normal file
119
configs/NanoDV_USB.h
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Select one board (STM32F103 based boards)
|
||||||
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
|
// #define ZUMSPOT_ADF7021
|
||||||
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
|
// #define LIBRE_KIT_ADF7021
|
||||||
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.1 (BG4TGO & BG5HHP)
|
||||||
|
#define NANO_DV_REV11
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
|
// Enable ADF7021 support:
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
|
// #define DUPLEX
|
||||||
|
|
||||||
|
// TCXO of the ADF7021
|
||||||
|
// For 14.7456 MHz:
|
||||||
|
// #define ADF7021_14_7456
|
||||||
|
// For 12.2880 MHz:
|
||||||
|
#define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
|
// Host communication selection:
|
||||||
|
// #define STM32_USART1_HOST
|
||||||
|
#define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
|
// Enable mode detection:
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
|
// Send RSSI value:
|
||||||
|
#define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
||||||
|
// Enable P25 Wide modulation:
|
||||||
|
#define ENABLE_P25_WIDE
|
||||||
|
|
||||||
|
// Disable mode LEDs blink during scan mode:
|
||||||
|
#define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
#define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
#define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
// #define ENABLE_UDID
|
||||||
|
|
||||||
|
#endif
|
||||||
119
configs/Nano_hotSPOT.h
Normal file
119
configs/Nano_hotSPOT.h
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Select one board (STM32F103 based boards)
|
||||||
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
|
// #define ZUMSPOT_ADF7021
|
||||||
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
|
// #define LIBRE_KIT_ADF7021
|
||||||
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
#define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
|
// Enable ADF7021 support:
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
|
// #define DUPLEX
|
||||||
|
|
||||||
|
// TCXO of the ADF7021
|
||||||
|
// For 14.7456 MHz:
|
||||||
|
#define ADF7021_14_7456
|
||||||
|
// For 12.2880 MHz:
|
||||||
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
|
// Host communication selection:
|
||||||
|
#define STM32_USART1_HOST
|
||||||
|
// #define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
|
// Enable mode detection:
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
|
// Send RSSI value:
|
||||||
|
#define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
||||||
|
// Enable P25 Wide modulation:
|
||||||
|
// #define ENABLE_P25_WIDE
|
||||||
|
|
||||||
|
// Disable mode LEDs blink during scan mode:
|
||||||
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
// #define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
#define ENABLE_UDID
|
||||||
|
|
||||||
|
#endif
|
||||||
116
configs/SkyBridge_RPi.h
Normal file
116
configs/SkyBridge_RPi.h
Normal file
|
|
@ -0,0 +1,116 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Select one board (STM32F103 based boards)
|
||||||
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
|
// #define ZUMSPOT_ADF7021
|
||||||
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
|
// #define LIBRE_KIT_ADF7021
|
||||||
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
#define SKYBRIDGE_HS
|
||||||
|
|
||||||
|
// Enable ADF7021 support:
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
|
// #define DUPLEX
|
||||||
|
|
||||||
|
// TCXO of the ADF7021
|
||||||
|
// For 14.7456 MHz:
|
||||||
|
#define ADF7021_14_7456
|
||||||
|
// For 12.2880 MHz:
|
||||||
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
|
// Host communication selection:
|
||||||
|
#define STM32_USART1_HOST
|
||||||
|
// #define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
|
// Enable mode detection:
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
|
// Send RSSI value:
|
||||||
|
#define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
||||||
|
// Enable P25 Wide modulation:
|
||||||
|
// #define ENABLE_P25_WIDE
|
||||||
|
|
||||||
|
// Disable mode LEDs blink during scan mode:
|
||||||
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
// #define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
#define ENABLE_UDID
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -20,17 +20,27 @@
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
// Select one board (STM32F103 based boards)
|
// Select one board (STM32F103 based boards)
|
||||||
// 1) ZUMspot USB and ZUMspot RPi:
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
// #define PI_HAT_7021_REV_03
|
// #define ZUMSPOT_ADF7021
|
||||||
// 2) ZUMspot Libre Kit or board with modified RF7021SE and Blue Pill STM32F103:
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
#define ADF7021_CARRIER_BOARD
|
#define LIBRE_KIT_ADF7021
|
||||||
// 3) MMDVM_HS_Hat revisions 1.1 and 1.2 (DB9MAT & DF2ET)
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
// #define MMDVM_HS_HAT_REV12
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
// Enable ADF7021 support:
|
// Enable ADF7021 support:
|
||||||
#define ENABLE_ADF7021
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
// Enable full duplex support with dual ADF7021:
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
// #define DUPLEX
|
// #define DUPLEX
|
||||||
|
|
||||||
// TCXO of the ADF7021
|
// TCXO of the ADF7021
|
||||||
|
|
@ -39,9 +49,23 @@
|
||||||
// For 12.2880 MHz:
|
// For 12.2880 MHz:
|
||||||
// #define ADF7021_12_2880
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
// Host communication selection:
|
// Host communication selection:
|
||||||
// #define STM32_USART1_HOST
|
// #define STM32_USART1_HOST
|
||||||
#define STM32_USB_HOST
|
#define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
// Enable mode detection:
|
// Enable mode detection:
|
||||||
#define ENABLE_SCAN_MODE
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
@ -51,6 +75,7 @@
|
||||||
|
|
||||||
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
#define SERIAL_REPEATER
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
// #define SERIAL_REPEATER_USART1
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
@ -61,4 +86,34 @@
|
||||||
// Disable mode LEDs blink during scan mode:
|
// Disable mode LEDs blink during scan mode:
|
||||||
// #define QUIET_MODE_LEDS
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
#define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
// #define ENABLE_UDID
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -20,17 +20,27 @@
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
// Select one board (STM32F103 based boards)
|
// Select one board (STM32F103 based boards)
|
||||||
// 1) ZUMspot USB and ZUMspot RPi:
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
#define PI_HAT_7021_REV_03
|
#define ZUMSPOT_ADF7021
|
||||||
// 2) ZUMspot Libre Kit or board with modified RF7021SE and Blue Pill STM32F103:
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
// #define ADF7021_CARRIER_BOARD
|
// #define LIBRE_KIT_ADF7021
|
||||||
// 3) MMDVM_HS_Hat revisions 1.1 and 1.2 (DB9MAT & DF2ET)
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
// #define MMDVM_HS_HAT_REV12
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
// Enable ADF7021 support:
|
// Enable ADF7021 support:
|
||||||
#define ENABLE_ADF7021
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
// Enable full duplex support with dual ADF7021:
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
// #define DUPLEX
|
// #define DUPLEX
|
||||||
|
|
||||||
// TCXO of the ADF7021
|
// TCXO of the ADF7021
|
||||||
|
|
@ -39,9 +49,23 @@
|
||||||
// For 12.2880 MHz:
|
// For 12.2880 MHz:
|
||||||
// #define ADF7021_12_2880
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
// Host communication selection:
|
// Host communication selection:
|
||||||
#define STM32_USART1_HOST
|
#define STM32_USART1_HOST
|
||||||
// #define STM32_USB_HOST
|
// #define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
// Enable mode detection:
|
// Enable mode detection:
|
||||||
#define ENABLE_SCAN_MODE
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
@ -51,6 +75,7 @@
|
||||||
|
|
||||||
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
#define SERIAL_REPEATER
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
// #define SERIAL_REPEATER_USART1
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
@ -61,4 +86,34 @@
|
||||||
// Disable mode LEDs blink during scan mode:
|
// Disable mode LEDs blink during scan mode:
|
||||||
// #define QUIET_MODE_LEDS
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
// #define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
#define ENABLE_UDID
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -20,17 +20,27 @@
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
// Select one board (STM32F103 based boards)
|
// Select one board (STM32F103 based boards)
|
||||||
// 1) ZUMspot USB and ZUMspot RPi:
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
#define PI_HAT_7021_REV_03
|
#define ZUMSPOT_ADF7021
|
||||||
// 2) ZUMspot Libre Kit or board with modified RF7021SE and Blue Pill STM32F103:
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
// #define ADF7021_CARRIER_BOARD
|
// #define LIBRE_KIT_ADF7021
|
||||||
// 3) MMDVM_HS_Hat revisions 1.1 and 1.2 (DB9MAT & DF2ET)
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
// #define MMDVM_HS_HAT_REV12
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
// Enable ADF7021 support:
|
// Enable ADF7021 support:
|
||||||
#define ENABLE_ADF7021
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
// Enable full duplex support with dual ADF7021:
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
// #define DUPLEX
|
// #define DUPLEX
|
||||||
|
|
||||||
// TCXO of the ADF7021
|
// TCXO of the ADF7021
|
||||||
|
|
@ -39,9 +49,23 @@
|
||||||
// For 12.2880 MHz:
|
// For 12.2880 MHz:
|
||||||
// #define ADF7021_12_2880
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
// Host communication selection:
|
// Host communication selection:
|
||||||
// #define STM32_USART1_HOST
|
// #define STM32_USART1_HOST
|
||||||
#define STM32_USB_HOST
|
#define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
// Enable mode detection:
|
// Enable mode detection:
|
||||||
#define ENABLE_SCAN_MODE
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
@ -61,4 +85,34 @@
|
||||||
// Disable mode LEDs blink during scan mode:
|
// Disable mode LEDs blink during scan mode:
|
||||||
// #define QUIET_MODE_LEDS
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
#define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
// #define ENABLE_UDID
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
119
configs/ZUMspot_dualband.h
Normal file
119
configs/ZUMspot_dualband.h
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Select one board (STM32F103 based boards)
|
||||||
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
|
#define ZUMSPOT_ADF7021
|
||||||
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
|
// #define LIBRE_KIT_ADF7021
|
||||||
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
|
// Enable ADF7021 support:
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
|
// #define DUPLEX
|
||||||
|
|
||||||
|
// TCXO of the ADF7021
|
||||||
|
// For 14.7456 MHz:
|
||||||
|
#define ADF7021_14_7456
|
||||||
|
// For 12.2880 MHz:
|
||||||
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
|
// Host communication selection:
|
||||||
|
#define STM32_USART1_HOST
|
||||||
|
// #define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
|
// Enable mode detection:
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
|
// Send RSSI value:
|
||||||
|
#define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
||||||
|
// Enable P25 Wide modulation:
|
||||||
|
// #define ENABLE_P25_WIDE
|
||||||
|
|
||||||
|
// Disable mode LEDs blink during scan mode:
|
||||||
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
// #define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
#define ENABLE_UDID
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -20,17 +20,27 @@
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
// Select one board (STM32F103 based boards)
|
// Select one board (STM32F103 based boards)
|
||||||
// 1) ZUMspot USB and ZUMspot RPi:
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
// #define PI_HAT_7021_REV_03
|
#define ZUMSPOT_ADF7021
|
||||||
// 2) ZUMspot Libre Kit or board with modified RF7021SE and Blue Pill STM32F103:
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
#define ADF7021_CARRIER_BOARD
|
// #define LIBRE_KIT_ADF7021
|
||||||
// 3) MMDVM_HS_Hat revisions 1.1 and 1.2 (DB9MAT & DF2ET)
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
// #define MMDVM_HS_HAT_REV12
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
// Enable ADF7021 support:
|
// Enable ADF7021 support:
|
||||||
#define ENABLE_ADF7021
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
// Enable full duplex support with dual ADF7021:
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
#define DUPLEX
|
#define DUPLEX
|
||||||
|
|
||||||
// TCXO of the ADF7021
|
// TCXO of the ADF7021
|
||||||
|
|
@ -39,18 +49,33 @@
|
||||||
// For 12.2880 MHz:
|
// For 12.2880 MHz:
|
||||||
// #define ADF7021_12_2880
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
// Host communication selection:
|
// Host communication selection:
|
||||||
// #define STM32_USART1_HOST
|
#define STM32_USART1_HOST
|
||||||
#define STM32_USB_HOST
|
// #define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
// Enable mode detection:
|
// Enable mode detection:
|
||||||
#define ENABLE_SCAN_MODE
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
// Send RSSI value:
|
// Send RSSI value:
|
||||||
// #define SEND_RSSI_DATA
|
#define SEND_RSSI_DATA
|
||||||
|
|
||||||
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
#define SERIAL_REPEATER
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
// #define SERIAL_REPEATER_USART1
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
@ -61,4 +86,34 @@
|
||||||
// Disable mode LEDs blink during scan mode:
|
// Disable mode LEDs blink during scan mode:
|
||||||
// #define QUIET_MODE_LEDS
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
// #define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
// #define ENABLE_UDID
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
119
configs/generic_duplex_gpio.h
Normal file
119
configs/generic_duplex_gpio.h
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Select one board (STM32F103 based boards)
|
||||||
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
|
// #define ZUMSPOT_ADF7021
|
||||||
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
|
#define LIBRE_KIT_ADF7021
|
||||||
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
|
// Enable ADF7021 support:
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
|
#define DUPLEX
|
||||||
|
|
||||||
|
// TCXO of the ADF7021
|
||||||
|
// For 14.7456 MHz:
|
||||||
|
#define ADF7021_14_7456
|
||||||
|
// For 12.2880 MHz:
|
||||||
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
|
// Host communication selection:
|
||||||
|
#define STM32_USART1_HOST
|
||||||
|
// #define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
|
// Enable mode detection:
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
|
// Send RSSI value:
|
||||||
|
// #define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
||||||
|
// Enable P25 Wide modulation:
|
||||||
|
// #define ENABLE_P25_WIDE
|
||||||
|
|
||||||
|
// Disable mode LEDs blink during scan mode:
|
||||||
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
// #define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
// #define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
#define ENABLE_UDID
|
||||||
|
|
||||||
|
#endif
|
||||||
119
configs/generic_duplex_usb.h
Normal file
119
configs/generic_duplex_usb.h
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Select one board (STM32F103 based boards)
|
||||||
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
|
// #define ZUMSPOT_ADF7021
|
||||||
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
|
#define LIBRE_KIT_ADF7021
|
||||||
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
|
// Enable ADF7021 support:
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
|
#define DUPLEX
|
||||||
|
|
||||||
|
// TCXO of the ADF7021
|
||||||
|
// For 14.7456 MHz:
|
||||||
|
#define ADF7021_14_7456
|
||||||
|
// For 12.2880 MHz:
|
||||||
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
|
// Host communication selection:
|
||||||
|
// #define STM32_USART1_HOST
|
||||||
|
#define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
|
// Enable mode detection:
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
|
// Send RSSI value:
|
||||||
|
// #define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
||||||
|
// Enable P25 Wide modulation:
|
||||||
|
// #define ENABLE_P25_WIDE
|
||||||
|
|
||||||
|
// Disable mode LEDs blink during scan mode:
|
||||||
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
#define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
// #define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
// #define ENABLE_UDID
|
||||||
|
|
||||||
|
#endif
|
||||||
119
configs/generic_gpio.h
Normal file
119
configs/generic_gpio.h
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_H)
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
// Select one board (STM32F103 based boards)
|
||||||
|
// 1) ZUMspot RPi or ZUMspot USB:
|
||||||
|
// #define ZUMSPOT_ADF7021
|
||||||
|
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
|
||||||
|
#define LIBRE_KIT_ADF7021
|
||||||
|
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
|
||||||
|
// #define MMDVM_HS_HAT_REV12
|
||||||
|
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
|
||||||
|
// #define MMDVM_HS_DUAL_HAT_REV10
|
||||||
|
// 5) Nano hotSPOT (BI7JTA)
|
||||||
|
// #define NANO_HOTSPOT
|
||||||
|
// 6) NanoDV NPi or USB revisions 1.0 (BG4TGO & BG5HHP)
|
||||||
|
// #define NANO_DV_REV10
|
||||||
|
// 7) D2RG MMDVM_HS RPi (BG3MDO, VE2GZI, CA6JAU)
|
||||||
|
// #define D2RG_MMDVM_HS
|
||||||
|
// 8) BridgeCom SkyBridge HotSpot
|
||||||
|
// #define SKYBRIDGE_HS
|
||||||
|
|
||||||
|
// Enable ADF7021 support:
|
||||||
|
#define ENABLE_ADF7021
|
||||||
|
|
||||||
|
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
|
||||||
|
// #define DUPLEX
|
||||||
|
|
||||||
|
// TCXO of the ADF7021
|
||||||
|
// For 14.7456 MHz:
|
||||||
|
#define ADF7021_14_7456
|
||||||
|
// For 12.2880 MHz:
|
||||||
|
// #define ADF7021_12_2880
|
||||||
|
|
||||||
|
// Configure receiver gain for ADF7021
|
||||||
|
// AGC automatic, default settings:
|
||||||
|
#define AD7021_GAIN_AUTO
|
||||||
|
// AGC automatic with high LNA linearity:
|
||||||
|
// #define AD7021_GAIN_AUTO_LIN
|
||||||
|
// AGC OFF, lowest gain:
|
||||||
|
// #define AD7021_GAIN_LOW
|
||||||
|
// AGC OFF, highest gain:
|
||||||
|
// #define AD7021_GAIN_HIGH
|
||||||
|
|
||||||
|
// Host communication selection:
|
||||||
|
#define STM32_USART1_HOST
|
||||||
|
// #define STM32_USB_HOST
|
||||||
|
// #define STM32_I2C_HOST
|
||||||
|
|
||||||
|
// I2C host address:
|
||||||
|
#define I2C_ADDR 0x22
|
||||||
|
|
||||||
|
// Enable mode detection:
|
||||||
|
#define ENABLE_SCAN_MODE
|
||||||
|
|
||||||
|
// Send RSSI value:
|
||||||
|
// #define SEND_RSSI_DATA
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
|
||||||
|
#define SERIAL_REPEATER
|
||||||
|
#define SERIAL_REPEATER_BAUD 9600
|
||||||
|
|
||||||
|
// Enable Nextion LCD serial port repeater on USART1 (Do not use with STM32_USART1_HOST enabled):
|
||||||
|
// #define SERIAL_REPEATER_USART1
|
||||||
|
|
||||||
|
// Enable P25 Wide modulation:
|
||||||
|
// #define ENABLE_P25_WIDE
|
||||||
|
|
||||||
|
// Disable mode LEDs blink during scan mode:
|
||||||
|
// #define QUIET_MODE_LEDS
|
||||||
|
|
||||||
|
// Engage a constant or descreet Service LED mode once repeater is running
|
||||||
|
// #define CONSTANT_SRV_LED
|
||||||
|
// #define CONSTANT_SRV_LED_INVERTED
|
||||||
|
// #define DISCREET_SRV_LED
|
||||||
|
// #define DISCREET_SRV_LED_INVERTED
|
||||||
|
|
||||||
|
// Use the YSF and P25 LEDs for NXDN
|
||||||
|
// #define USE_ALTERNATE_NXDN_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and P25 LEDs for M17
|
||||||
|
// #define USE_ALTERNATE_M17_LEDS
|
||||||
|
|
||||||
|
// Use the D-Star and DMR LEDs for POCSAG
|
||||||
|
// #define USE_ALTERNATE_POCSAG_LEDS
|
||||||
|
|
||||||
|
// Enable for RPi 3B+, USB mode
|
||||||
|
// #define LONG_USB_RESET
|
||||||
|
|
||||||
|
// Enable modem debug messages
|
||||||
|
#define ENABLE_DEBUG
|
||||||
|
|
||||||
|
// Disable frequency bands check
|
||||||
|
// #define DISABLE_FREQ_CHECK
|
||||||
|
|
||||||
|
// Disable frequency restrictions (satellite, ISS, etc)
|
||||||
|
// #define DISABLE_FREQ_BAN
|
||||||
|
|
||||||
|
// Enable UDID feature
|
||||||
|
#define ENABLE_UDID
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 by Andy Uribe CA6JAU
|
* Copyright (C) 2016-2018 by Andy Uribe CA6JAU
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
/* Memory areas */
|
/* Memory areas */
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 64K /* FLASH */
|
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 128K /* FLASH */
|
||||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K /* Main RAM */
|
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K /* Main RAM */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Copyright (C) 2017 by Andy Uribe CA6JAU
|
# Copyright (C) 2017,2018,2019,2020 by Andy Uribe CA6JAU
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -16,32 +16,173 @@
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
echo "******************************************************"
|
||||||
|
echo "********* Cleaning objects and updating code *********"
|
||||||
|
echo "******************************************************"
|
||||||
cd ~/MMDVM_HS/
|
cd ~/MMDVM_HS/
|
||||||
make clean
|
make clean
|
||||||
git pull
|
git pull
|
||||||
|
|
||||||
# Building ZUMspot Libre Kit
|
# Building ZUMspot Libre Kit
|
||||||
|
echo "*******************************************************"
|
||||||
|
echo "********* Building ZUMspot Libre Kit firmware *********"
|
||||||
|
echo "*******************************************************"
|
||||||
cp ~/MMDVM_HS/configs/ZUMspot_Libre.h ~/MMDVM_HS/Config.h
|
cp ~/MMDVM_HS/configs/ZUMspot_Libre.h ~/MMDVM_HS/Config.h
|
||||||
make bl
|
make -j4 bl
|
||||||
mv ~/MMDVM_HS/bin/outp.bin ~/MMDVM_HS/bin/zumspot_libre_fw.bin
|
mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/zumspot_libre_fw.bin
|
||||||
make clean
|
make clean
|
||||||
|
|
||||||
# Building ZUMspot RPi
|
# Building ZUMspot RPi
|
||||||
|
echo "*************************************************"
|
||||||
|
echo "********* Building ZUMspot RPi firmware *********"
|
||||||
|
echo "*************************************************"
|
||||||
cp ~/MMDVM_HS/configs/ZUMspot_RPi.h ~/MMDVM_HS/Config.h
|
cp ~/MMDVM_HS/configs/ZUMspot_RPi.h ~/MMDVM_HS/Config.h
|
||||||
make
|
make -j4
|
||||||
mv ~/MMDVM_HS/bin/outp.bin ~/MMDVM_HS/bin/zumspot_rpi_fw.bin
|
mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/zumspot_rpi_fw.bin
|
||||||
make clean
|
make clean
|
||||||
|
|
||||||
# Building ZUMspot USB
|
# Building ZUMspot USB
|
||||||
|
echo "*************************************************"
|
||||||
|
echo "********* Building ZUMspot USB firmware *********"
|
||||||
|
echo "*************************************************"
|
||||||
cp ~/MMDVM_HS/configs/ZUMspot_USB.h ~/MMDVM_HS/Config.h
|
cp ~/MMDVM_HS/configs/ZUMspot_USB.h ~/MMDVM_HS/Config.h
|
||||||
make bl
|
make -j4 bl
|
||||||
mv ~/MMDVM_HS/bin/outp.bin ~/MMDVM_HS/bin/zumspot_usb_fw.bin
|
mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/zumspot_usb_fw.bin
|
||||||
make clean
|
make clean
|
||||||
|
|
||||||
# Building ZUMspot Duplex
|
# Building ZUMspot Duplex
|
||||||
|
echo "****************************************************"
|
||||||
|
echo "********* Building ZUMspot Duplex firmware *********"
|
||||||
|
echo "****************************************************"
|
||||||
cp ~/MMDVM_HS/configs/ZUMspot_duplex.h ~/MMDVM_HS/Config.h
|
cp ~/MMDVM_HS/configs/ZUMspot_duplex.h ~/MMDVM_HS/Config.h
|
||||||
make bl
|
make -j4
|
||||||
mv ~/MMDVM_HS/bin/outp.bin ~/MMDVM_HS/bin/zumspot_duplex_fw.bin
|
mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/zumspot_duplex_fw.bin
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Building ZUMspot Dualband
|
||||||
|
echo "******************************************************"
|
||||||
|
echo "********* Building ZUMspot Dualband firmware *********"
|
||||||
|
echo "******************************************************"
|
||||||
|
cp ~/MMDVM_HS/configs/ZUMspot_dualband.h ~/MMDVM_HS/Config.h
|
||||||
|
make -j4
|
||||||
|
mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/zumspot_dualband_fw.bin
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Building MMDVM_HS_Hat
|
||||||
|
echo "**************************************************"
|
||||||
|
echo "********* Building MMDVM_HS_Hat firmware *********"
|
||||||
|
echo "**************************************************"
|
||||||
|
cp ~/MMDVM_HS/configs/MMDVM_HS_Hat.h ~/MMDVM_HS/Config.h
|
||||||
|
make -j4
|
||||||
|
mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_hat_fw.bin
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Building MMDVM_HS_Hat (12.288 MHz TCXO)
|
||||||
|
echo "********************************************************************"
|
||||||
|
echo "********* Building MMDVM_HS_Hat (12.288 MHz TCXO) firmware *********"
|
||||||
|
echo "********************************************************************"
|
||||||
|
cp ~/MMDVM_HS/configs/MMDVM_HS_Hat-12mhz.h ~/MMDVM_HS/Config.h
|
||||||
|
make -j4
|
||||||
|
mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_hat_fw-12mhz.bin
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Building MMDVM_HS_Dual_Hat
|
||||||
|
echo "*******************************************************"
|
||||||
|
echo "********* Building MMDVM_HS_Dual_Hat firmware *********"
|
||||||
|
echo "*******************************************************"
|
||||||
|
cp ~/MMDVM_HS/configs/MMDVM_HS_Dual_Hat.h ~/MMDVM_HS/Config.h
|
||||||
|
make -j4
|
||||||
|
mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_dual_hat_fw.bin
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Building MMDVM_HS_Dual_Hat (12.288 MHz TCXO)
|
||||||
|
echo "*************************************************************************"
|
||||||
|
echo "********* Building MMDVM_HS_Dual_Hat (12.288 MHz TCXO) firmware *********"
|
||||||
|
echo "*************************************************************************"
|
||||||
|
cp ~/MMDVM_HS/configs/MMDVM_HS_Dual_Hat-12mhz.h ~/MMDVM_HS/Config.h
|
||||||
|
make -j4
|
||||||
|
mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/mmdvm_hs_dual_hat_fw-12mhz.bin
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Building Nano hotSPOT
|
||||||
|
echo "**************************************************"
|
||||||
|
echo "********* Building Nano hotSPOT firmware *********"
|
||||||
|
echo "**************************************************"
|
||||||
|
cp ~/MMDVM_HS/configs/Nano_hotSPOT.h ~/MMDVM_HS/Config.h
|
||||||
|
make -j4
|
||||||
|
mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/nano_hotspot_fw.bin
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Building NanoDV NPi
|
||||||
|
echo "************************************************"
|
||||||
|
echo "********* Building NanoDV NPi firmware *********"
|
||||||
|
echo "************************************************"
|
||||||
|
cp ~/MMDVM_HS/configs/NanoDV_NPi.h ~/MMDVM_HS/Config.h
|
||||||
|
make -j4
|
||||||
|
mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/nanodv_npi_fw.bin
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Building NanoDV USB
|
||||||
|
echo "************************************************"
|
||||||
|
echo "********* Building NanoDV USB firmware *********"
|
||||||
|
echo "************************************************"
|
||||||
|
cp ~/MMDVM_HS/configs/NanoDV_USB.h ~/MMDVM_HS/Config.h
|
||||||
|
make -j4 bl
|
||||||
|
mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/nanodv_usb_fw.bin
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Building D2RG MMDVM_HS
|
||||||
|
echo "***************************************************"
|
||||||
|
echo "********* Building D2RG MMDVM_HS firmware *********"
|
||||||
|
echo "***************************************************"
|
||||||
|
cp ~/MMDVM_HS/configs/D2RG_MMDVM_HS.h ~/MMDVM_HS/Config.h
|
||||||
|
make -j4
|
||||||
|
mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/d2rg_mmdvm_hs.bin
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Building Generic Simplex GPIO
|
||||||
|
echo "**********************************************************"
|
||||||
|
echo "********* Building Generic Simplex GPIO firmware *********"
|
||||||
|
echo "**********************************************************"
|
||||||
|
cp ~/MMDVM_HS/configs/generic_gpio.h ~/MMDVM_HS/Config.h
|
||||||
|
make -j4
|
||||||
|
mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/generic_gpio_fw.bin
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Building Generic Duplex GPIO
|
||||||
|
echo "*********************************************************"
|
||||||
|
echo "********* Building Generic Duplex GPIO firmware *********"
|
||||||
|
echo "*********************************************************"
|
||||||
|
cp ~/MMDVM_HS/configs/generic_duplex_gpio.h ~/MMDVM_HS/Config.h
|
||||||
|
make -j4
|
||||||
|
mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/generic_duplex_gpio_fw.bin
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Building Generic Duplex USB
|
||||||
|
echo "********************************************************"
|
||||||
|
echo "********* Building Generic Duplex USB firmware *********"
|
||||||
|
echo "********************************************************"
|
||||||
|
cp ~/MMDVM_HS/configs/generic_duplex_usb.h ~/MMDVM_HS/Config.h
|
||||||
|
make -j4 bl
|
||||||
|
mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/generic_duplex_usb_fw.bin
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Building SkyBridge RPi HS
|
||||||
|
echo "******************************************************"
|
||||||
|
echo "********* Building SkyBridge RPi HS firmware *********"
|
||||||
|
echo "******************************************************"
|
||||||
|
cp ~/MMDVM_HS/configs/SkyBridge_RPi.h ~/MMDVM_HS/Config.h
|
||||||
|
make -j4
|
||||||
|
mv ~/MMDVM_HS/bin/mmdvm_f1.bin ~/MMDVM_HS/bin/skybridge_rpi_fw.bin
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# Building LoneStar USB
|
||||||
|
echo "*************************************************"
|
||||||
|
echo "********* Building LoneStar USB firmware *********"
|
||||||
|
echo "*************************************************"
|
||||||
|
cp ~/MMDVM_HS/configs/LoneStar_USB.h ~/MMDVM_HS/Config.h
|
||||||
|
make -j4 bl
|
||||||
|
mv ~/MMDVM_HS/bin/mmdvm_f1bl.bin ~/MMDVM_HS/bin/lonestar_usb_fw.bin
|
||||||
make clean
|
make clean
|
||||||
|
|
||||||
cp ~/MMDVM_HS/configs/ZUMspot_Libre.h ~/MMDVM_HS/Config.h
|
cp ~/MMDVM_HS/configs/ZUMspot_Libre.h ~/MMDVM_HS/Config.h
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Copyright (C) 2017 by Andy Uribe CA6JAU
|
# Copyright (C) 2017,2018 by Andy Uribe CA6JAU
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -21,7 +21,7 @@ MAC_DEV_USB_SER="/dev/cu.usbmodem1441"
|
||||||
|
|
||||||
# Check if arguement is supplied for bin path. If not, use default.
|
# Check if arguement is supplied for bin path. If not, use default.
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
BIN_PATH="../bin/outp.bin"
|
BIN_PATH="../bin/mmdvm_f1bl.bin"
|
||||||
echo "No path to bin file supplied, trying the default location."
|
echo "No path to bin file supplied, trying the default location."
|
||||||
else
|
else
|
||||||
BIN_PATH="$1"
|
BIN_PATH="$1"
|
||||||
|
|
@ -49,6 +49,12 @@ if [ $(uname -s) == "Linux" ]; then
|
||||||
DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util"
|
DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util"
|
||||||
ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash"
|
ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash"
|
||||||
STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash"
|
STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash"
|
||||||
|
elif [ $(uname -m) == "aarch64" ] ; then
|
||||||
|
echo "Raspberry Pi 4 detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash"
|
||||||
elif [ $(uname -m) == "armv7l" ]; then
|
elif [ $(uname -m) == "armv7l" ]; then
|
||||||
echo "Raspberry Pi 3 detected"
|
echo "Raspberry Pi 3 detected"
|
||||||
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
|
|
||||||
91
scripts/install_fw_d2rg_mmdvmhs.sh
Executable file
91
scripts/install_fw_d2rg_mmdvmhs.sh
Executable file
|
|
@ -0,0 +1,91 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
# Configure latest version
|
||||||
|
FW_VERSION="v1.5.2"
|
||||||
|
|
||||||
|
# Configure beta version
|
||||||
|
FW_VERSION_BETA="v1.5.1b"
|
||||||
|
|
||||||
|
# Firmware filename
|
||||||
|
FW_FILENAME="d2rg_mmdvm_hs.bin"
|
||||||
|
|
||||||
|
# Download latest firmware
|
||||||
|
if [ $1 = "beta" ]; then
|
||||||
|
echo "Downloading beta firmware..."
|
||||||
|
curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME
|
||||||
|
else
|
||||||
|
echo "Downloading latest firmware (stable)..."
|
||||||
|
curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Download STM32F10X_Lib (only for binary tools)
|
||||||
|
if [ ! -d "./STM32F10X_Lib/utils" ]; then
|
||||||
|
git clone https://github.com/juribeparada/STM32F10X_Lib
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configure vars depending on OS
|
||||||
|
if [ $(uname -s) == "Linux" ]; then
|
||||||
|
if [ $(uname -m) == "x86_64" ]; then
|
||||||
|
echo "Linux 64-bit detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash"
|
||||||
|
elif [ $(uname -m) == "aarch64" ] ; then
|
||||||
|
echo "Raspberry Pi 4 detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash"
|
||||||
|
elif [ $(uname -m) == "armv7l" ]; then
|
||||||
|
echo "Raspberry Pi 3 detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash"
|
||||||
|
elif [ $(uname -m) == "armv6l" ]; then
|
||||||
|
echo "Raspberry Pi 2 or Pi Zero W detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash"
|
||||||
|
else
|
||||||
|
echo "Linux 32-bit detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $(uname -s) == "Darwin" ]; then
|
||||||
|
echo "macOS detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Stop MMDVMHost process to free serial port
|
||||||
|
sudo killall MMDVMHost >/dev/null 2>&1
|
||||||
|
|
||||||
|
# Upload the firmware
|
||||||
|
# Note: /dev/ttySC0 should be enabled, see: https://github.com/bg3mdo/D2RG_MMDVM_HS_ambe_uart_service
|
||||||
|
eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 23,-22,22:-23,22 /dev/ttySC0
|
||||||
|
|
||||||
90
scripts/install_fw_dualband.sh
Executable file
90
scripts/install_fw_dualband.sh
Executable file
|
|
@ -0,0 +1,90 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
# Configure latest version
|
||||||
|
FW_VERSION="v1.5.2"
|
||||||
|
|
||||||
|
# Configure beta version
|
||||||
|
FW_VERSION_BETA="v1.5.1b"
|
||||||
|
|
||||||
|
# Firmware filename
|
||||||
|
FW_FILENAME="zumspot_dualband_fw.bin"
|
||||||
|
|
||||||
|
# Download latest firmware
|
||||||
|
if [ $1 = "beta" ]; then
|
||||||
|
echo "Downloading beta firmware..."
|
||||||
|
curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME
|
||||||
|
else
|
||||||
|
echo "Downloading latest firmware (stable)..."
|
||||||
|
curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Download STM32F10X_Lib (only for binary tools)
|
||||||
|
if [ ! -d "./STM32F10X_Lib/utils" ]; then
|
||||||
|
git clone https://github.com/juribeparada/STM32F10X_Lib
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configure vars depending on OS
|
||||||
|
if [ $(uname -s) == "Linux" ]; then
|
||||||
|
if [ $(uname -m) == "x86_64" ]; then
|
||||||
|
echo "Linux 64-bit detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash"
|
||||||
|
elif [ $(uname -m) == "aarch64" ] ; then
|
||||||
|
echo "Raspberry Pi 4 detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash"
|
||||||
|
elif [ $(uname -m) == "armv7l" ]; then
|
||||||
|
echo "Raspberry Pi 3 detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash"
|
||||||
|
elif [ $(uname -m) == "armv6l" ]; then
|
||||||
|
echo "Raspberry Pi 2 or Pi Zero W detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash"
|
||||||
|
else
|
||||||
|
echo "Linux 32-bit detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $(uname -s) == "Darwin" ]; then
|
||||||
|
echo "macOS detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Stop MMDVMHost process to free serial port
|
||||||
|
sudo killall MMDVMHost >/dev/null 2>&1
|
||||||
|
|
||||||
|
# Upload the firmware
|
||||||
|
eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Copyright (C) 2017 by Andy Uribe CA6JAU
|
# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -17,13 +17,22 @@
|
||||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
# Configure latest version
|
# Configure latest version
|
||||||
FW_VERSION="v1.0.2"
|
FW_VERSION="v1.5.2"
|
||||||
|
|
||||||
# Change USB-serial port name ONLY in macOS
|
# Configure beta version
|
||||||
MAC_DEV_USB_SER="/dev/cu.usbmodem1441"
|
FW_VERSION_BETA="v1.5.1b"
|
||||||
|
|
||||||
|
# Firmware filename
|
||||||
|
FW_FILENAME="zumspot_duplex_fw.bin"
|
||||||
|
|
||||||
# Download latest firmware for ZUMspot Libre Kit
|
# Download latest firmware
|
||||||
curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/zumspot_duplex_fw.bin
|
if [ $1 = "beta" ]; then
|
||||||
|
echo "Downloading beta firmware..."
|
||||||
|
curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME
|
||||||
|
else
|
||||||
|
echo "Downloading latest firmware (stable)..."
|
||||||
|
curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME
|
||||||
|
fi
|
||||||
|
|
||||||
# Download STM32F10X_Lib (only for binary tools)
|
# Download STM32F10X_Lib (only for binary tools)
|
||||||
if [ ! -d "./STM32F10X_Lib/utils" ]; then
|
if [ ! -d "./STM32F10X_Lib/utils" ]; then
|
||||||
|
|
@ -32,13 +41,18 @@ fi
|
||||||
|
|
||||||
# Configure vars depending on OS
|
# Configure vars depending on OS
|
||||||
if [ $(uname -s) == "Linux" ]; then
|
if [ $(uname -s) == "Linux" ]; then
|
||||||
DEV_USB_SER="/dev/ttyACM0"
|
|
||||||
if [ $(uname -m) == "x86_64" ]; then
|
if [ $(uname -m) == "x86_64" ]; then
|
||||||
echo "Linux 64-bit detected"
|
echo "Linux 64-bit detected"
|
||||||
DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset"
|
DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset"
|
||||||
DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util"
|
DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util"
|
||||||
ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash"
|
ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash"
|
||||||
STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash"
|
STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash"
|
||||||
|
elif [ $(uname -m) == "aarch64" ] ; then
|
||||||
|
echo "Raspberry Pi 4 detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash"
|
||||||
elif [ $(uname -m) == "armv7l" ]; then
|
elif [ $(uname -m) == "armv7l" ]; then
|
||||||
echo "Raspberry Pi 3 detected"
|
echo "Raspberry Pi 3 detected"
|
||||||
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
|
@ -62,7 +76,6 @@ fi
|
||||||
|
|
||||||
if [ $(uname -s) == "Darwin" ]; then
|
if [ $(uname -s) == "Darwin" ]; then
|
||||||
echo "macOS detected"
|
echo "macOS detected"
|
||||||
DEV_USB_SER=$MAC_DEV_USB_SER
|
|
||||||
DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset"
|
DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset"
|
||||||
DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util"
|
DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util"
|
||||||
ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash"
|
ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash"
|
||||||
|
|
@ -72,12 +85,6 @@ fi
|
||||||
# Stop MMDVMHost process to free serial port
|
# Stop MMDVMHost process to free serial port
|
||||||
sudo killall MMDVMHost >/dev/null 2>&1
|
sudo killall MMDVMHost >/dev/null 2>&1
|
||||||
|
|
||||||
# Reset ZUMspot to enter bootloader mode
|
|
||||||
eval sudo $DFU_RST $DEV_USB_SER 750
|
|
||||||
|
|
||||||
# Upload the firmware
|
# Upload the firmware
|
||||||
eval sudo $DFU_UTIL -D zumspot_duplex_fw.bin -d 1eaf:0003 -a 2 -R -R
|
eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Please RESET your ZUMspot !"
|
|
||||||
echo
|
|
||||||
|
|
|
||||||
93
scripts/install_fw_duplex_gpio.sh
Executable file
93
scripts/install_fw_duplex_gpio.sh
Executable file
|
|
@ -0,0 +1,93 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
# Configure latest version
|
||||||
|
FW_VERSION="v1.5.2"
|
||||||
|
|
||||||
|
# Configure beta version
|
||||||
|
FW_VERSION_BETA="v1.5.1b"
|
||||||
|
|
||||||
|
# Firmware filename
|
||||||
|
FW_FILENAME="generic_duplex_gpio_fw.bin"
|
||||||
|
|
||||||
|
# Download latest firmware
|
||||||
|
if [ $1 = "beta" ]; then
|
||||||
|
echo "Downloading beta firmware..."
|
||||||
|
curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME
|
||||||
|
else
|
||||||
|
echo "Downloading latest firmware (stable)..."
|
||||||
|
curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Download latest firmware for Generic Duplex GPIO
|
||||||
|
curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/
|
||||||
|
|
||||||
|
# Download STM32F10X_Lib (only for binary tools)
|
||||||
|
if [ ! -d "./STM32F10X_Lib/utils" ]; then
|
||||||
|
git clone https://github.com/juribeparada/STM32F10X_Lib
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configure vars depending on OS
|
||||||
|
if [ $(uname -s) == "Linux" ]; then
|
||||||
|
if [ $(uname -m) == "x86_64" ]; then
|
||||||
|
echo "Linux 64-bit detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash"
|
||||||
|
elif [ $(uname -m) == "aarch64" ] ; then
|
||||||
|
echo "Raspberry Pi 4 detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash"
|
||||||
|
elif [ $(uname -m) == "armv7l" ]; then
|
||||||
|
echo "Raspberry Pi 3 detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash"
|
||||||
|
elif [ $(uname -m) == "armv6l" ]; then
|
||||||
|
echo "Raspberry Pi 2 or Pi Zero W detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash"
|
||||||
|
else
|
||||||
|
echo "Linux 32-bit detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $(uname -s) == "Darwin" ]; then
|
||||||
|
echo "macOS detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Stop MMDVMHost process to free serial port
|
||||||
|
sudo killall MMDVMHost >/dev/null 2>&1
|
||||||
|
|
||||||
|
# Upload the firmware
|
||||||
|
eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 20,-21,21:-20,21 /dev/ttyAMA0
|
||||||
|
|
||||||
92
scripts/install_fw_duplex_gpio_opi.sh
Normal file
92
scripts/install_fw_duplex_gpio_opi.sh
Normal file
|
|
@ -0,0 +1,92 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (C) 2017,2018,2019 by Andy Uribe CA6JAU
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
# Configure latest version
|
||||||
|
FW_VERSION="v1.5.2"
|
||||||
|
|
||||||
|
# Configure beta version
|
||||||
|
FW_VERSION_BETA="v1.5.1b"
|
||||||
|
|
||||||
|
# Firmware filename
|
||||||
|
FW_FILENAME="generic_duplex_gpio_fw.bin"
|
||||||
|
|
||||||
|
# Download latest firmware
|
||||||
|
if [ $1 = "beta" ]; then
|
||||||
|
echo "Downloading beta firmware..."
|
||||||
|
curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION_BETA/$FW_FILENAME
|
||||||
|
else
|
||||||
|
echo "Downloading latest firmware (stable)..."
|
||||||
|
curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/$FW_FILENAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Download latest firmware for Generic Duplex GPIO
|
||||||
|
curl -OL https://github.com/juribeparada/MMDVM_HS/releases/download/$FW_VERSION/
|
||||||
|
|
||||||
|
# Download STM32F10X_Lib (only for binary tools)
|
||||||
|
if [ ! -d "./STM32F10X_Lib/utils" ]; then
|
||||||
|
git clone https://github.com/juribeparada/STM32F10X_Lib
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configure vars depending on OS
|
||||||
|
if [ $(uname -s) == "Linux" ]; then
|
||||||
|
if [ $(uname -m) == "x86_64" ]; then
|
||||||
|
echo "Linux 64-bit detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/linux64/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/linux64/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/linux64/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/linux64/stm32flash"
|
||||||
|
elif [ $(uname -m) == "aarch64" ] ; then
|
||||||
|
echo "Raspberry Pi 4 detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash"
|
||||||
|
elif [ $(uname -m) == "armv7l" ]; then
|
||||||
|
echo "Raspberry Pi 3 detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash"
|
||||||
|
elif [ $(uname -m) == "armv6l" ]; then
|
||||||
|
echo "Raspberry Pi 2 or Pi Zero W detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/rpi32/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/rpi32/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/rpi32/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/rpi32/stm32flash"
|
||||||
|
else
|
||||||
|
echo "Linux 32-bit detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/linux/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/linux/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/linux/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/linux/stm32flash"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $(uname -s) == "Darwin" ]; then
|
||||||
|
echo "macOS detected"
|
||||||
|
DFU_RST="./STM32F10X_Lib/utils/macosx/upload-reset"
|
||||||
|
DFU_UTIL="./STM32F10X_Lib/utils/macosx/dfu-util"
|
||||||
|
ST_FLASH="./STM32F10X_Lib/utils/macosx/st-flash"
|
||||||
|
STM32FLASH="./STM32F10X_Lib/utils/macosx/stm32flash"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Stop MMDVMHost process to free serial port
|
||||||
|
sudo killall MMDVMHost >/dev/null 2>&1
|
||||||
|
|
||||||
|
# Upload the firmware
|
||||||
|
eval sudo $STM32FLASH -v -w $FW_FILENAME -g 0x0 -R -i 198,-199,199:-198,199 /dev/ttyS3
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue