Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT publish received from broker - truncated and CRC error #50

Open
swarozyn opened this issue Feb 4, 2019 · 0 comments
Open

MQTT publish received from broker - truncated and CRC error #50

swarozyn opened this issue Feb 4, 2019 · 0 comments

Comments

@swarozyn
Copy link

swarozyn commented Feb 4, 2019

Hi

I'm using esp-link with El-Client for IBM Bluemix Watson IOT Platform. Many things works OK, but I've got a problem with PUBLISH request received from IOT broker (not: publish send from device).

This request arrives to ESPLink ok:

603991> MQTT: Recv type=PUBLISH id=0000 len=136; Pend type=NULL id=00
603991> MQTT: Recv PUBLISH qos=0 iotdm-1/mgmt/custom/TM1638/display{"reqId":"e8994312-e116-4e0bbc97-9cff22bb2340","d":{"fields":[{"field":"text","value":"Test"}]}}0 �
603992> MQTT Client: Received topic: iotdm-1/mgmt/custom/TM1638/display, data: {"reqId":"e8994312-e116-4e0b-bc97-9cff22bb2340","d":{"fields":[{"field":"text","value":"Test"}]}}
603993> MQTT: Data cb=0x000004f2 topic=iotdm-1/mgmt/custom/TM1638/display{"reqId":"e8994312-e116-4e0b-bc97-9cff22bb2340","d":{"fields":[{"field":"text","value":"Test"}]}}0 � len=97
603993> cmdResponse: cmd=3 val=1266 argc=2

but is altered during transfer to arduino-side (ElClient). The data is truncated and CRC is invalid (I changed ElClient code not to discard bad-crc packets):

ELC: got 128 @5AD: 3 4F2 2 22 0 69 6F 74 64 6D 2D 31 2F 6D 67 6D 74 2F 63 75 73 74 6F 6D 2F 54 4D 31 36 33 38 2F 64 69 73 70 6C 61 79 61 0 7B 22
 72 65 71 49 64 22 3A 22 65 38 39 39 34 33 31 32 2D 65 31 31 36 2D 34 65 30 62 2D 62 63 39 37 2D 39 63 66 66 32 32 62 62 32 33 34 30 22 2C 22 64
 22 3A 6F 74 64 6D 2D 31 2F 6D 67 6D 74 2F 63 75 73 74 6F 6D 2F 54 4D 31 36 33 38 2F 64 69 73 70
ELC: Invalid CRC
47215
28787
ELC: Process anyway...
RESP_CB: 1266 2
com_mqttDataCb
  s:iotdm-1/mgmt/custom/TM1638/display
  t:{"reqId":"e8994312-e116-4e0b-bc97-9cff22bb2340","d":otdm-1/mgmt/custom/TM1638/disp␒␎␏␐ ␁␀␀ ␃␀␀␀

so - the original request:
iotdm-1/mgmt/custom/TM1638/display{"reqId":"e8994312-e116-4e0bbc97-9cff22bb2340","d":{"fields":[{"field":"text","value":"Test"}]}}

is changed/truncated to:
3 4F2 2 22 0 69 6F 74 64 6D 2D 31 2F 6D 67 6D 74 2F 63 75 73 74 6F 6D 2F 54 4D 31 36 33 38 2F 64 69 73 70 6C 61 79 61 0 7B 22 72 65 71 49 64 22 3A 22 65 38 39 39 34 33 31 32 2D 65 31 31 36 2D 34 65 30 62 2D 62 63 39 37 2D 39 63 66 66 32 32 62 62 32 33 34 30 22 2C 22 64 22 3A 6F 74 64 6D 2D 31 2F 6D 67 6D 74 2F 63 75 73 74 6F 6D 2F 54 4D 31 36 33 38 2F 64 69 73 70
which is:
iotdm-1/mgmt/custom/TM1638/display{"reqId":"e8994312-e116-4e0b-bc97-9cff22bb2340","d":otdm-1/mgmt/custom/TM1638/disp

so the CRC is also bad, which prevents this message from being accepted by ELClient::protoCompletedCb(void)

I wonder what should I change in order to have this working. Could You help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant