pull/18/head
Xael South 2021-01-28 14:26:50 +00:00
rodzic 4098aa84bb
commit 6d92d1b3f1
3 zmienionych plików z 16 dodań i 2 usunięć

Wyświetl plik

@ -2,6 +2,9 @@
rtl-wmbus is a software defined receiver for Wireless-M-Bus. It is written in plain C and uses RTL-SDR (https://github.com/osmocom/rtl-sdr) to interface with RTL2832-based hardware.
It can also use LimeSDR or other SDR receiver through rx_sdr (see https://github.com/rxseger/rx_tools),
which in turn is using SoapySDR to interface with underlying hardware in a vendor-neutral way.
Wireless-M-Bus is the wireless version of M-Bus ("Meter-Bus", http://www.m-bus.com), which is an European standard for remote reading of smart meters.
The primary purpose of rtl-wmbus is experimenting with digital signal processing and software radio. rtl-wmbus can be used on resource constrained devices such Raspberry Pi Zero or Raspberry PI B+ overclocked to 1GHz. Any Android based tablet will do the same too.
@ -49,6 +52,10 @@ Before building Android version the SDK and NDK have to be installed. See androi
* rtl_sdr -f 868.95M -s 1600000 - 2>/dev/null | build/rtl_wmbus
To run continuously with rx_sdr (or even with a higher sampling and decimation rate)
* rx_sdr -f 868.95M -s 1600000 - 2>/dev/null | build/rtl_wmbus
* rx_sdr -f 868.95M -s 4000000 - 2>/dev/null | build/rtl_wmbus -d 5
To count "good" (no 3 out of 6 errors, no checksum errors) packets:
* cat samples.bin | build/rtl_wmbus 2>/dev/null | grep "[T,C]1;1;1" | wc -l

Wyświetl plik

@ -447,6 +447,7 @@ static void time2_algorithm(unsigned bit, unsigned rssi, struct time2_algorithm
static int opts_run_length_algorithm_enabled = 1;
static int opts_time2_algorithm_enabled = 1;
static unsigned decimation_rate = 2u;
int show_used_algorithm = 0;
static void print_usage(const char *program_name)
{
@ -454,13 +455,14 @@ static void print_usage(const char *program_name)
fprintf(stdout, "\t-r 0 to disable run length algorithm\n");
fprintf(stdout, "\t-t 0 to disable time2 algorithm\n");
fprintf(stdout, "\t-d 2 set decimation rate to 2 (defaults to 2 if omitted)\n");
fprintf(stdout, "\t-s show used algorithm in the output\n");
}
static void process_options(int argc, char *argv[])
{
int option;
while ((option = getopt(argc, argv, "d:r:t:")) != -1)
while ((option = getopt(argc, argv, "d:r:st:")) != -1)
{
switch (option)
{
@ -489,6 +491,9 @@ static void process_options(int argc, char *argv[])
case 'd':
decimation_rate = strtoul(optarg, NULL, 10);
break;
case 's':
show_used_algorithm = 1;
break;
default:
print_usage(argv[0]);
exit(EXIT_FAILURE);

Wyświetl plik

@ -661,6 +661,8 @@ static inline uint32_t get_serial(const uint8_t *const packet)
return serial;
}
extern int show_used_algorithm;
static void t1_c1_packet_decoder(unsigned bit, unsigned rssi, struct t1_c1_packet_decoder_work *decoder, const char *algorithm)
{
decoder->current_rssi = rssi;
@ -682,7 +684,7 @@ static void t1_c1_packet_decoder(unsigned bit, unsigned rssi, struct t1_c1_packe
decoder->crc_ok = check_calc_crc_wmbus(decoder->packet, decoder->L) ? 1 : 0;
}
algorithm = ""; // uncomment of want to see which algorithm is executed right now
if (!show_used_algorithm) algorithm = "";
fprintf(stdout, "%s%s;%u;%u;%s;%u;%u;%08X;", algorithm, decoder->c1_packet ? "C1": "T1",
decoder->crc_ok,
decoder->err_3outof^1,