ok-home wrote: ↑Sat Nov 30, 2024 2:03 am
Hi
you can try
the code works with packet data
Code: Select all
#define MAX_HBS_PACKET_SIZE 26
typedef struct {
hbs_packet_hdr_t packet_hdr;// hbs packet header
hbs_item16_t packet_data[MAX_HBS_PACKET_SIZE];// hbs packet data
} hbs_packet_t;
encoding/decoding inside
timings are configurable in code
at least 25 bytes encoded in 22 bits it accepts in one packet
https://github.com/ok-home/hbs_rmt_serial/
In test it not show any error, but in the real like it show error, device from manufacturer from Japan.
Do you give me hint to improve the decode?
Code: Select all
E (69947) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=105
W (70365) P1P2 RCV: 241130 21:22:24.066 : 00 00 10: 00 62 02 19 00 51 00 00 00 00 00 00 00 80 40 01 00 00 00 00
E (70416) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=98
E (70416) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=106
E (70637) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=98
E (70638) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=106
W (71105) P1P2 RCV: 241130 21:22:24.806 : 00 00 10: 00 62 02 19 00 51 00 00 00 00 00 00 00 80 40 01 00 00 00 00
E (71156) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=99
E (71156) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=105
W (71765) P1P2 RCV: 241130 21:22:25.466 : 00 00 10: 00 62 02 19 00 51 00 00 00 00 00 00 00 80 40 01 00 00 00 00
E (71816) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=98
E (71816) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=106
W (72285) P1P2 RCV: 241130 21:22:25.986 : 00 00 10: 00 62 02 19 00 51 00 00 00 00 00 00 00 80 40 01 00 00 00 00
E (72336) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=98
E (72336) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=105
W (72605) P1P2 RCV: 241130 21:22:26.306 : 00 f0 30: 20 2b b0 00 20 10 20 10 02 82 00 6c da 70 0d 00 52 cc 28 22
I (72622) HBS RMT: Sent Data at: 241130 21:22:26.323 for 30
W (73145) P1P2 RCV: 241130 21:22:26.846 : 00 00 10: 00 62 02 19 00 51 00 00 00 00 00 00 00 80 40 01 00 00 00 00
E (73196) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=99
E (73196) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=105
E (73417) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=99
E (73417) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=105
W (73885) P1P2 RCV: 241130 21:22:27.586 : 00 00 10: 00 62 02 19 00 51 00 00 00 00 00 00 00 80 40 01 00 00 00 00
E (73935) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=99
E (73936) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=105
W (74545) P1P2 RCV: 241130 21:22:28.246 : 00 00 10: 00 62 02 19 00 51 00 00 00 00 00 00 00 80 40 01 00 00 00 00
E (74595) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=98
E (74596) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=105
W (75065) P1P2 RCV: 241130 21:22:28.766 : 00 00 10: 00 62 02 19 00 51 00 00 00 00 00 00 00 80 40 01 00 00 00 00
E (75115) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=98
E (75116) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=106
W (75379) P1P2 RCV: 241130 21:22:29.079 : 00 00 11: 00 00 00 00 00 18 e4 00 00 00 00 40 00 00 a0
I (75380) HBS RMT: Main controller temperature: 24.89 Count: 13
E (75426) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=99
E (75427) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=103
W (75845) P1P2 RCV: 241130 21:22:29.546 : 00 00 10: 00 62 02 19 00 51 00 00 00 00 00 00 00 80 40 01 00 00 00 00
E (75895) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=99
E (75896) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=105
E (76117) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=99
E (76118) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=105
W (76585) P1P2 RCV: 241130 21:22:30.286 : 00 00 10: 00 62 02 19 00 51 00 00 00 00 00 00 00 80 40 01 00 00 00 00
E (76635) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=99
E (76636) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=105
W (77225) P1P2 RCV: 241130 21:22:30.926 : 00 00 10: 00 62 02 19 00 51 00 00 00 00 00 00 00 80 40 01 00 00 00 00
E (77275) HBS RMT: receive frame err START bit 0 lvl=0, bit_in=0,dur=99
E (77276) HBS RMT: receive frame err START bit 1 lvl=1, bit_in=1,dur=105
And if running both TX and RX in real time, send data after receive 30ms, the data receive on other side wrong, It is ok if send slow without receive and send only.
Example when send only the other side can receive the data
Code: Select all
00 f0 38: 01 00 62 02 1b 00 17 02 1b 00 14 01 00 08 10 c0 38 18 c7
But after active both send and receive the other side only receive:
Code: Select all
fd fd ff: fc f8 fb f0 e3 80 f1 e0 e3 80 0a 01 00 08 10 c0 38 18 c7
or
37 fe f8: f0 f6 e0 e3 80 f1 e0 e3 80 0a 01 00 08 10 c0 38 18 c7
81 1b 00: 17 02 1b 00 14 01 00 08 10 c0 38 18 c7
And random with other wrong data.