[Solved] How Set DataRate manually

Hi friends,
I’m developing a firmware based on RAK811. I want to do Uplink with a specific DR. I’ve disabled ADR and set datarate manually by “g_lora_config.def_tx_dr = LORAWAN_TX_DATARATE;” before “rw_LoadUsrConfig();” function.
but, DR is 0 in some uplinks.

in function “LoRaMacQueryTxPossible”
// Verify if the fOpts and the payload fit into the maximum payload
if( ValidatePayloadLength( size, datarate, fOptLen ) == false )
{
e_printf(“PAYLOAD IS DROPPED: SIZE: %d, DATARATE: %d, FOPTLEN:%d\r\n”, size, datarate, fOptLen);
return LORAMAC_STATUS_LENGTH_ERROR;
}
the output is:
PAYLOAD IS DROPPED: SIZE: 216, DATARATE: 0, FOPTLEN:0

Hi @king,

You can use our latest firmware for RAK811:
https://downloads.rakwireless.com/en/LoRa/WisNode/Firmware/
according to this document:

In this firmware, there are two AT commands which can be used to control ADR and DR:
image
image

thank you for reply
It was an overflow issue, the “AppData” array size was 64 but I wanted to send 200 bytes through lorawan network. I changed its size and the issue is solved.