Skip to content

Commit

Permalink
fix: Increase the priority of the LoRa DIO interrupt task to 10 & DIO…
Browse files Browse the repository at this point in the history
…3 voltage is set to 2.4V.
  • Loading branch information
Wvirgil123 committed Jan 16, 2025
1 parent 55d1df4 commit 38854d0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
4 changes: 4 additions & 0 deletions components/lora/bsp_sx126x.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once

#include "bsp_board.h"
#include "sx126x.h"

#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -16,6 +18,8 @@ extern "C" {
#define ESP32_RADIO_SCLK GPIO_NUM_41
#define ESP32_EXPANDER_IO_INT GPIO_NUM_42

#define SX126X_TCXO_CTRL_VOLTAGE TCXO_CTRL_2_4V

extern io_expander_ops_t *indicator_io_expander;

spi_device_handle_t bsp_sx126x_spi_handle_get(void);
Expand Down
6 changes: 3 additions & 3 deletions components/lora/sx126x_sensecap_board.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void SX126xIoInit( void )
} else {
g_have_tcxo = false;
}
printf("TCXO:%d\r\n", g_have_tcxo );
printf("TCXO:%d,VOLTAGE:%d\r\n", g_have_tcxo, SX126X_TCXO_CTRL_VOLTAGE);
}


Expand Down Expand Up @@ -232,7 +232,7 @@ void SX126xIoIrqInit( DioIrqHandler dioIrq )
io_conf.pull_up_en = 1;
gpio_config(&io_conf);
gpio_evt_queue = xQueueCreate(10, sizeof(TimerTime_t));
xTaskCreate(expander_io_int, "expander_io_int", GPIO_QUEUE_STACK, NULL, 0, NULL);
xTaskCreate(expander_io_int, "expander_io_int", GPIO_QUEUE_STACK, NULL, 10, NULL);

gpio_install_isr_service(0);
gpio_isr_handler_add(ESP32_EXPANDER_IO_INT, gpio_isr_handler, (void*)ESP32_EXPANDER_IO_INT);
Expand All @@ -249,7 +249,7 @@ void SX126xIoDbgInit( void )
void SX126xIoTcxoInit( void )
{
if( g_have_tcxo ) {
SX126xSetDio3AsTcxoCtrl(TCXO_CTRL_1_8V, SX126xGetBoardTcxoWakeupTime()<<6);
SX126xSetDio3AsTcxoCtrl(SX126X_TCXO_CTRL_VOLTAGE, SX126xGetBoardTcxoWakeupTime()<<6);
}

CalibrationParams_t calibParam;
Expand Down
2 changes: 1 addition & 1 deletion components/smtc_ral/bsp/sx126x/smtc_shield_sx1262mb1cas.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ const smtc_shield_sx126x_pa_pwr_cfg_t smtc_shield_sx1262mb1cas_pa_pwr_cfg_table[
*/
smtc_shield_sx126x_xosc_cfg_t smtc_shield_sx1262mb1cas_xosc_cfg = {
.tcxo_is_radio_controlled = false,
.supply_voltage = SX126X_TCXO_CTRL_1_8V,
.supply_voltage = SX126X_TCXO_CTRL_VOLTAGE,
.startup_time_in_tick = 300,
};

Expand Down
15 changes: 14 additions & 1 deletion examples/console/components/cmd_lora/cmd_lora.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static int lora_cw_test(int argc, char **argv)
ESP_LOGI(TAG, "Start Tx Continuous Wave");

Radio.SetChannel( freq );
Radio.SetTxContinuousWave( freq, freq, -1 );
Radio.SetTxContinuousWave( freq, power, -1 );
return 0;
}

Expand Down Expand Up @@ -276,6 +276,19 @@ static int lora_tx_test(int argc, char **argv)
break;
}
}

//wait last tx done
while(__g_tx_done_flag == false) {
vTaskDelay(20 / portTICK_PERIOD_MS);
recv_len = uart_read_bytes(0, &quit, 1, 1 / portTICK_PERIOD_MS);
if( recv_len > 0) {
if( quit==0x3) { //Ctrl+C
break;
}
}
};
vTaskDelay( 1000 / portTICK_PERIOD_MS);

Radio.Standby();
ESP_LOGI(TAG, "End of send!");
return 0;
Expand Down

0 comments on commit 38854d0

Please sign in to comment.