Skip to content

sx127x configuration overrides LoRa mode when setting Standby mode #146

@RPadial

Description

@RPadial

I modified sx127x_set_pkt_type function in order to write 0x01 with 0x80 value (only set bit 7) when okt_type is SX127X_PKT_TYPE_LORA and int seems to change to LoRa mode. However, in the next configuration it sets Standby mode but it overrides LoRa mode.

Data: h01 | h00, h00 | h00,
Data: h01 | h00, h00 | h00,
Data: h81 | h00, h00 | h00, Sleep
Data: h01 | h00, h00 | h00,
Data: h81 | h00, h80 | h00, LoRa mode
Data: hC0 | h00, h00 | h00, h00 | h30,
Data: h86 | h00, hD9 | hD9, h06 | h13, h66 | h33,
Data: h09 | h00, h00 | h7E, h00 | h09,
Data: h4D | h00, h00 | h04,
Data: h89 | h00, h7E | h7E, h09 | h09,
Data: hCD | h00, h04 | h04,
Data: h1D | h00, h00 | h72, h00 | h70,
Data: h26 | h00, h00 | h04,
Data: h9D | h00, h72 | h72, hC0 | h70,
Data: hA6 | h00, h08 | h04,
Data: h31 | h00, h00 | hC3,
Data: hB1 | h00, h03 | hC3,
Data: hB7 | h00, h0A | h0A,
Data: h01 | h00, h00 | h80, Check radio is in LoRa mode
Data: h81 | h00, h01 | h80, For any reason library overrides LoRa mode in the next frame

I changed sx127x_status_t sx127x_set_op_mode to read SX127X_REG_COMMON_OP_MODE register before setting op_mode.

static sx127x_status_t sx127x_set_op_mode( sx127x_t* radio, const uint8_t op_mode )
{
sx127x_status_t status = SX127X_STATUS_OK;
uint8_t local_op_mode = 0;

if( sx127x_read_register( radio, SX127X_REG_COMMON_OP_MODE, &local_op_mode, 1 ) != SX127X_STATUS_OK )
{   
    status        = SX127X_STATUS_ERROR;
    return SX127X_STATUS_ERROR;
}

if( status == SX127X_STATUS_OK )
{
    local_op_mode = ( local_op_mode & SX127X_REG_COMMON_OP_MODE_MODE_MASK ) | op_mode;
    status        = sx127x_write_register( radio, SX127X_REG_COMMON_OP_MODE, &local_op_mode, 1 );
}
return status;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions