2025-10-10 4:35 AM
Hi everyone,
I have custom stm32wle board that is configured as dc-dc supply, and external 32MHz crystal with 6.8pF capacitors.
I can read and write to/from radio registers but i can't transmit any data. Indeed even transmit interrupt (HAL_SUBGHZ_TxCpltCallback) is fired after i call sx126x_set_tx() function.
void send_data(){
err += loradio_reset(p);
err += sx126x_set_pkt_type(p, SX126X_PKT_TYPE_LORA);
struct loradio_params_str radio_params;
radio_params.bw = LORADIO_BW_125;
radio_params.cr = LORADIO_CR_4_5;
radio_params.sf = LORADIO_SF7;
radio_params.ldro = 0;
radio_params.preamble_len_in_symb = 8;
radio_params.header_type = LORADIO_LORA_PKT_EXPLICIT;
radio_params.payload_length = 23;
radio_params.crc_enabled = true; //true
radio_params.invert_iq_enabled = true; //true
radio_params.radio_freq = 915000000;
err += loradio_set_lora_params(p, radio_params); // it is a function firstly set lora mod params and then paket params
err += sx126x_set_reg_mode(p, SX126X_REG_MODE_DCDC); //LDO
err += sx126x_cal(p, SX126X_CAL_ALL);
err += sx126x_set_standby(p, SX126X_STANDBY_CFG_RC);//SX126X_STANDBY_CFG_RC //rc
sx126x_pa_cfg_params_t *pa1_cfg = malloc(sizeof(sx126x_pa_cfg_params_t));
pa1_cfg->device_sel = 0x00;
pa1_cfg->hp_max = 0x02; //0x02
pa1_cfg->pa_duty_cycle = 0x02; //2
pa1_cfg->pa_lut = 0x01;
err += sx126x_set_pa_cfg(p, pa1_cfg);
err += sx126x_set_tx_params(p, 0x0e, SX126X_RAMP_10_US);
err += sx126x_set_lora_sync_word(p, 0x34); //0x12 for private network, 0x34 for public network
err += sx126x_set_dio_irq_params(p, SX126X_IRQ_ALL, SX126X_IRQ_TX_DONE, SX126X_IRQ_NONE, SX126X_IRQ_RX_DONE);
err += sx126x_clear_irq_status(p, SX126X_IRQ_ALL);
sx126x_pkt_type_t pkt_type = 8;
sx126x_get_pkt_type(p, &pkt_type); // ic an read it as LORA_PACKET
uint8_t rxbuff[255], tx_buff[255];
memcpy(tx_buff, "blablalbalbalbalba", 16);
sx126x_set_buffer_base_address(p, 0, 0);
sx126x_write_buffer(p, 0, tx_buff, 255);
sx126x_read_buffer(p, 0, rxbuff, 255); // i can read blablalbalbalbalba in rxbuff
while(1){
RF_SWITCH_CONTROL(true);
sx126x_set_tx(p, 0);
HAL_Delay(6000);
}
}
PS: I have been scanning with esp32 and sx1262 which succesfully can scan lora packets from another system.
Also i run it same code with stm32f429-sx1262 module which has txco config with DC-DC supply and it succesfully transmit data and i can see it with esp32-sx1262 system.
Another things i am using HAL_SUBGHZ functions with stm32wle and also using HAL_SPI functions with stm32f429 in low-layer communication and there is no any issue with that because in both sitiation i can write and read.
Can you help me? Thanks...