updated protoview and fixed array count issue

arrays start at 0 and citroen_tpms was trying to read 0-10 meaning 11 full bytes rather than actually 10 (0-9).
This commit is contained in:
jbohack
2023-01-13 10:02:14 -05:00
parent 332abdacbb
commit 6015afe368
23 changed files with 663 additions and 89 deletions

View File

@@ -11,7 +11,7 @@
*
* ((256+MDMCFG3)*(2^MDMCFG4:0..3bits)) / 2^28 * 26000000.
*
* For instance for the default values of MDMCFG3 (34) and MDMCFG4 (12):
* For instance for the default values of MDMCFG3[0..3] (34) and MDMCFG4 (12):
*
* ((256+34)*(2^12))/(2^28)*26000000 = 115051.2688000000, that is 115KBaud
*
@@ -38,6 +38,23 @@
* d 82 khz
* e 68 khz
* f 58 khz
*
* FSK deviation is controlled by the DEVIATION register. In Ruby:
*
* dev = (26000000.0/2**17)*(8+(deviation&7))*(2**(deviation>>4&7))
*
* deviation&7 (last three bits) is the deviation mantissa, while
* deviation>>4&7 (bits 6,5,4) are the exponent.
*
* Deviations values according to certain configuration of DEVIATION:
*
* 0x04 -> 2.380371 kHz
* 0x24 -> 9.521484 kHz
* 0x34 -> 19.042969 Khz
* 0x40 -> 25.390625 Khz
* 0x43 -> 34.912109 Khz
* 0x45 -> 41.259765 Khz
* 0x47 -> 47.607422 kHz
*/
/* 20 KBaud, 2FSK, 28.56 kHz deviation, 325 Khz bandwidth filter. */
@@ -130,3 +147,46 @@ static uint8_t protoview_subghz_tpms2_async_regs[][2] = {
{0, 0},
};
/* Parameters that should work well for the TPMS PVM C210 sensor. */
static uint8_t protoview_subghz_tpms3_async_regs[][2] = {
/* GPIO GD0 */
{CC1101_IOCFG0, 0x0D}, // GD0 as async serial data output/input
/* Frequency Synthesizer Control */
{CC1101_FSCTRL1, 0x06}, // IF = (26*10^6) / (2^10) * 0x06 = 152343.75Hz
/* Packet engine */
{CC1101_PKTCTRL0, 0x32}, // Async, continious, no whitening
{CC1101_PKTCTRL1, 0x04},
// // Modem Configuration
{CC1101_MDMCFG0, 0x00},
{CC1101_MDMCFG1, 0x02}, // 2 is the channel spacing exponet: not used
{CC1101_MDMCFG2, 0x10}, // GFSK without any other check
{CC1101_MDMCFG3, 0x93}, // Data rate is 20kBaud
{CC1101_MDMCFG4, 0x59}, // Rx bandwidth filter is 325 kHz
{CC1101_DEVIATN, 0x34}, // Deviation 19.04 Khz, works well with TPMS
/* Main Radio Control State Machine */
{CC1101_MCSM0, 0x18}, // Autocalibrate on idle-to-rx/tx, PO_TIMEOUT is 64 cycles(149-155us)
/* Frequency Offset Compensation Configuration */
{CC1101_FOCCFG,
0x16}, // no frequency offset compensation, POST_K same as PRE_K, PRE_K is 4K, GATE is off
/* Automatic Gain Control */
{CC1101_AGCCTRL0, 0x80},
{CC1101_AGCCTRL1, 0x58},
{CC1101_AGCCTRL2, 0x87},
/* Wake on radio and timeouts control */
{CC1101_WORCTRL, 0xFB}, // WOR_RES is 2^15 periods (0.91 - 0.94 s) 16.5 - 17.2 hours
/* Frontend configuration */
{CC1101_FREND0, 0x10}, // Adjusts current TX LO buffer
{CC1101_FREND1, 0x56},
/* End */
{0, 0},
};