Hello.
I am trying to send a JSON payload to an end device via the TTN schedule downlink. I place a breakpoint in function OnRxData (in lora_app.c) at the appropriate fport location. The code breaks at the case equal to the fport but the remaining elements of the structure show 0 for BufferSize and 0 for Buffer. Iâve tried to copy a downlink message that I am pushing from Cayenne LPP to TTN after turning the value to 1. Can anyone give me ideas as to why the other parameters would show up as 0 for their fields?
Running the debugger on the STM code base is detailed stuff!
However as youâve conflated the two sorts of payload format and possibly, with the mashup you have, not got a payload encoder, itâs likely that nothing useful is being queued at the LNS.
Go to the docs and look at the JSON formats that are supported. Or for a very very very simple test, just send a sequence of bytes.
It is also about 9,000,000,000 times easier to drop an APP_PRINTF in to the code rather than have the debugger run and potentially upset timings which are super critical to downlink reception.
Thank you for the response.
I will preface this with Iâm trying to learn this and well being new to this I am pretty sure Iâve messed things upâŠExcuse the long explanation but I am trying to be as clear as I know how here.
Basically I took a github repo for an end node in WLE5, modified it slightly for a custom board I spun, loaded the code and was fortunate enough to see payloads coming into TTN. I then created a webhook to Cayenne LPP (which I enabled on the end node) and yup I see data coming through. I then went into the tx section of FW and dropped in the command CayenneLppAddDigitalOutput which was nice enough to push itself up through the gateway and over to Cayenne so that I could create a digital button with on / off. I press this button and see that my application end point gets a received downlink message on TTN, but the LED on the node does not turn on as expected (ie Cayenne shows button on). The JSON message shows a lot of cryptic stuff but I do see a key / value pair âdecoded_payloadâ : { âvalue_1â : 1} which does seem to change back and forth from 0 to 1 when I press the button in Cayenne.
I then proceed to open the message and copy the json section labeled âdataâ . I take that into the end node downlink message, set this to JSON and paste. Now two things that stick out. Firstly if I change the JSON âf_portâ value from 99 to 2 (which seems to be the switch case that the RX section of FW wants to see) AND secondly change the Messaging Downlink in TTN FPort from 1 to 2 then at least the code breaks within the FW albeit the other data (Buffer Size and Buffer) seems to be 0.
So getting to the issue :
First I donât have a serial port wired to the board.
Second I have no clue what Bytes I need to send down to see if the code is workingâŠSure I can send the 02 01 01 (Port, BufferSize, LED On) but that doesnât work as the FW doesnât get as far as the above where I modified the JSON and sent it down. Clearly there are more bytes that need to be sent itâs just that after looking at the JSON I donât have a clue given that much of the message looks encodedâŠie âcorrelation_idsâ key, âfrm_payloadâ keyâŠ
I suggested above that you compare & contrast what you have entered against what the documentation says.
Between your implied assumption that the Cayenne dashboard on/off would automagically send the right info to the LoRa-E5, given that nothing in the code processes incoming LPP, and the above statement, I think youâre redefining âtravelling hopefulâ. JSON is part of the LoRaWAN toolkit so itâs not a topic you can skip over. The same with Base64, the frm_payload you are sending is 010064FF which is NOT LPP format.
The code in OnRxData looks for f_port 2 as you have described and then takes the first byte - so the payload only needs to be one byte.
But as I explained above, your mish-mash of JSON is probably resulting in nothing - something you could look at in the console for the device to see what is being queued - and you could just put 00 or 01 in for the payload. Your use of 02 01 01 bears no resemblance to any TTS documentation or the device code. There is clearly an entry box for the port and no entry box for the length which can be calculated from the payload entry.
You could also look at the device console & gateway to see if any MAC commands are being sent - as those will trigger OnRxData but not provide a user payload.
But without a serial port, you are doing this with both hands tied behind your back.
Thanks for the help! I was able to simply and at least prove (based on your above commment)
Your use of 02 01 01 bears no resemblance to any TTS documentation or the device code. There is clearly an entry box for the port and no entry box for the length which can be calculated from the payload entry.
that the FW is workingâŠie send a 1 turn an LED on, send a 0 turn an LED off. I will have to investigate the Cayenne pushing to TTN and trying to understand that piece