Payload[Not provided] in application data


(Pbloraiot) #1

Hi All,

My application no payload. I would like to show a picture below. Could you please help me?

1

2


(Arjan) #2

Your node is using port 0 for the uplink. That is not allowed for uplinks.


(Pbloraiot) #3

I using STM32 Discovery kit. I setup LORAWAN_APP_PORT 2 and Cayenne PORT 99.

29-8-2561%2011-11-25


(Arjan) #4

The images in your first post show port 0, next to counter 81, so probably something is wrong in your node.


(Pbloraiot) #5

I understanding first uplink port 0 for check ADR right.


(Arjan) #6

I don’t understand what you’re trying to say, but ADR is not related to the LoRaWAN port 0. If a node wants to enable ADR, then it sets a bit in a regular uplink message. That uplink should not be sent to port 0.


(flabbergast) #7

According to the spec port 0 is for mac commands (up and down link) with no payload.

LoRaWAN 1.1 Specification (page 29):

A single data frame can contain any sequence of MAC commands, either piggybacked in the
FOpts field or, when sent as a separate data frame, in the FRMPayload field with the FPort
field being set to 0.

ADRRequest are always downlinks mostly piggybacked on Acknowledgements and not from the node, so the uplink cannot be an ADRRequest.

Can you post the function that prepares your uplinkdata?

You need to find the location where the Tx data is prepared, the function is most likely in your main.c assuming the stack hasn’t changed much.


(Pbloraiot) #8

Hi,

@arjanvanb Thank you for your answer.
I would like to show my uplinkdata function below. When the first uplink is OK but second uplink is not OK because second uplink no payload. I am use 1.2.0 Icubewan from STMicrotronics.

Link :

https://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/i-cube-lrwan.html

31-8-2561%2015-24-08


(Arjan) #9

Please don’t post text as images. (See How do I format my forum post? to help posting code.)

LPP_APP_PORT is unrelated to LORAWAN_APP_PORT that you showed in an earlier post. (The first is just one of the many details that, in my opinion, cause unneeded overhead in the Cayenne LPP protocol. But that’s unrelated to your problems.)


(flabbergast) #10

Ok , you also need to set your AppData.BuffSize, where did you set this? should be the length of your buffer.


(Pbloraiot) #11

My function Send

uint8_t cchannel=0;
temperature = ( int16_t )( sensor_data.temperature * 10 );     /* in ฐC * 10 */
pressure    = ( uint16_t )( sensor_data.pressure * 100 / 10 );  /* in hPa / 10 */
humidity    = ( uint16_t )( sensor_data.humidity * 2 );        /* in %*2     */
uint32_t i = 0;
batteryLevel = HW_GetBatteryLevel( );                     /* 1 (very low) to 254 (fully charged) */
AppData.Port = LPP_APP_PORT;
AppData.Buff[i++] = cchannel++;
AppData.Buff[i++] = LPP_DATATYPE_BAROMETER;
AppData.Buff[i++] = ( pressure >> 8 ) & 0xFF;
AppData.Buff[i++] = pressure & 0xFF;
AppData.Buff[i++] = cchannel++;
AppData.Buff[i++] = LPP_DATATYPE_TEMPERATURE; 
AppData.Buff[i++] = ( temperature >> 8 ) & 0xFF;
AppData.Buff[i++] = temperature & 0xFF;
AppData.Buff[i++] = cchannel++;
AppData.Buff[i++] = LPP_DATATYPE_HUMIDITY;
AppData.Buff[i++] = humidity & 0xFF;
AppData.Buff[i++] = cchannel++;
AppData.Buff[i++] = 0x88;
AppData.Buff[i++] = 0x02;
AppData.Buff[i++] = 0x17;
AppData.Buff[i++] = 0xD5;
AppData.Buff[i++] = 0x0F;
AppData.Buff[i++] = 0x5D;
AppData.Buff[i++] = 0x6A;
AppData.Buff[i++] = 0x00;
AppData.Buff[i++] = 0x03;
AppData.Buff[i++] = 0xE8;
AppData.Buff[i++] = cchannel++;
AppData.Buff[i++] = 0x02;
AppData.Buff[i++] = 0x27;
AppData.Buff[i++] = 0x10;

This my frame. Total 27 bytes for send to my gateway.


(Arjan) #12

This is just the formatting of the payload and does not show how that’s actually sent.

(Also please see how I changed your post for the formatting of the code.)


(Pbloraiot) #13

I edited my code below I already can send my payload to TTN.

‘’’ My function
batteryLevel = HW_GetBatteryLevel( );
GetTempADC = HW_GetADCTemperature(); /* 1 (very low) to 254 (fully charged) */
Temperature = ComputeTemperature(GetTempADC);

AppData.Port = LPP_APP_PORT;

AppData.Buff[i++] = cchannel++;
AppData.Buff[i++] = LPP_DATATYPE_TEMPERATURE;
AppData.Buff[i++] = ( Temperature >> 8 ) & 0xFF;
AppData.Buff[i++] = Temperature & 0xFF;
AppData.Buff[i++] = cchannel++;
AppData.Buff[i++] = LPP_DATATYPE_ANALOG_INPUT;
AppData.Buff[i++] = ( batteryLevel >> 8 ) & 0xFF;
AppData.Buff[i++] = batteryLevel & 0xFF;

AppData.BuffSize = i;

LORA_send( &AppData, LORAWAN_DEFAULT_CONFIRM_MSG_STATE);
‘’’


(flabbergast) #14

Is that your complete function? you have to initialize i -> uint32_t i = 0 did you do that?


(Arjan) #15

So, problem solved? If not, where is LORA_send defined?

(And for formatting your code here on the forum, note that “backticks” are not the same as single quotes.)


(Pbloraiot) #16

I solved my function below.

‘’’ My function for send information ‘’’
static void Send( void )
{
/* USER CODE BEGIN 3 */
uint16_t Temperature;
uint16_t GetTempADC;

 if ( LORA_JoinStatus () != LORA_SET)
 {
      /*Not joined, try again later*/
      LORA_Join();
      return;
 }

 TimerInit( &TxLedTimer, OnTimerLedEvent );
 TimerSetValue(  &TxLedTimer, 200);

 LED_On( LED_RED1 ) ;

 TimerStart( &TxLedTimer );  

 uint8_t cchannel=0;
 uint32_t i = 0;

 GetTempADC  = HW_GetADCTemperature();	/* 1 (very low) to 254 (fully charged) */
 Temperature = ComputeTemperature(GetTempADC);
 batteryLevel = HW_GetBatteryLevel( );
 batteryLevel = (batteryLevel/255.00)*10000;

 AppData.Port = LPP_APP_PORT;

 AppData.Buff[i++] = cchannel++;
 AppData.Buff[i++] = LPP_DATATYPE_TEMPERATURE; 
 AppData.Buff[i++] = ( Temperature >> 8 ) & 0xFF;
 AppData.Buff[i++] = Temperature & 0xFF;
 AppData.Buff[i++] = cchannel++;
 AppData.Buff[i++] = LPP_DATATYPE_ANALOG_INPUT;
 AppData.Buff[i++] = ( batteryLevel >> 8 ) & 0xFF;
 AppData.Buff[i++] = batteryLevel & 0xFF;

 AppData.BuffSize = i;

 LORA_send( &AppData, LORAWAN_DEFAULT_CONFIRM_MSG_STATE);

 /* USER CODE END 3 */

}
‘’’