FORUM

LLCC68 transmission configuration for basic transmission

Hi Guys,
I am trying to get transmission configuration using semtech LLCC68 driver available on github.

configuration:

/* configure gpio pins and spi interface for lora module */
_lora.CS_port = LORA_CS_GPIO_Port;
_lora.CS_pin = LORA_CS_Pin;
_lora.reset_port = LORA_RST_GPIO_Port;
_lora.reset_pin = LORA_RST_Pin;
_lora.DIO0_port = LORA_DI1_GPIO_Port;
_lora.DIO0_pin = LORA_DI1_Pin;
_lora.hSPIx = &hspi1;

/* configure lora module parameters */
_lora.frequency = 433;          
_lora.spredingFactor = LLCC68_LORA_SF7;           
_lora.bandWidth = LLCC68_LORA_BW_125;   
_lora.crcRate = LLCC68_LORA_CR_4_5;       
_lora.power = 20; //POWER_20db;  
_lora.overCurrentProtection = 100;    
_lora.preamble = 10;            

    // variables init
llcc68_status_t ret = LLCC68_STATUS_OK;
llcc68_mod_params_lora_t lora_mod_para;
llcc68_pkt_params_lora_t lora_pkt_params;
llcc68_pa_cfg_params_t pa_cfg_params;
llcc68_irq_mask_t local_irq_tx_status = 0;
uint8_t tx_buffer[LLCC68_RX_TX_MAX_BUF_SIZE];

for(int i = 0; i <LLCC68_RX_TX_MAX_BUF_SIZE; i++) tx_buffer[i] = i; // fill buffer as per index

lora_pkt_params.crc_is_on = 0; 					// CRC		ON:1 OFF:0
lora_pkt_params.header_type = 0; 				// length 	variable:0 fixed:1
lora_pkt_params.invert_iq_is_on = 0; 			// IQ		standard:0 inverted:1, inverted have more data lose at long range
lora_pkt_params.pld_len_in_bytes = 5; 			// 0x05 for Preamble detector length 16 bits
lora_pkt_params.preamble_len_in_symb = 16; 		// PreambleLength 0x0 to 0xFFFF // The preamble length is a 16-bit value

lora_mod_para.bw = _lora->bandWidth;
lora_mod_para.cr = _lora->crcRate;
lora_mod_para.ldro = 0;
lora_mod_para.sf = _lora->spredingFactor;


	//Table 13-21: PA Operating Modes with Optimal Settings:
// Output Power = +22 dBm, paDutyCycle = 0x04, hpMax = 0x07, deviceSel = 0x00, paLut = 0x01
// current config set for 20 dBm
pa_cfg_params.device_sel = 0x00;
pa_cfg_params.hp_max = 0x05;
pa_cfg_params.pa_duty_cycle = 0x03;
pa_cfg_params.pa_lut = 0x01;

Code:

//	1. go to Standby mode
	llcc68_set_standby(_lora, LLCC68_CHIP_MODE_STBY_RC);
	HAL_Delay(3);

//	2. Define the lora protocol
llcc68_set_pkt_type(_lora, LLCC68_PKT_TYPE_LORA);

//	3. Define the RF frequency
llcc68_set_rf_freq(_lora, _lora->frequency);

//	4. Define the Power Amplifier configuration
llcc68_set_pa_cfg(_lora, &pa_cfg_params);

//	5. Define output power and ramping time
llcc68_set_tx_params(_lora,  20,(const llcc68_ramp_time_t) LLCC68_RAMP_800_US); // Power = 22 Dbm, ramp time = 800 us

//	6. Define where the data payload will be stored
llcc68_set_buffer_base_address(_lora, LLCC68_TX_BASE_ADDRESS , LLCC68_RX_BASE_ADDRESS);

//	7. Send the payload to the data buffer
llcc68_write_buffer(_lora, LLCC68_TX_BASE_ADDRESS, tx_buffer, LLCC68_RX_TX_MAX_BUF_SIZE);

//	8. Define the modulation parameter according to the chosen protocol 
llcc68_set_lora_mod_params(_lora, &lora_mod_para);

//	9. Define the frame format to be used
llcc68_set_lora_pkt_params(_lora, &lora_pkt_params);

//	10. Configure DIO and IRQ: use the command SetDioIrqParams(...) to select TxDone IRQ and map this IRQ to a DIO (DIO1, DIO2 or DIO3)
//    to select the IRQ RxDone and map this IRQ to a DIO(DIO1 or DIO2 or DIO3), set IRQ Timeout as well.
/* by default all IRQ are masked.
   ref. source: datasheet llcc68, Table 13-29: IRQ Registers
   FYI: llcc68_clear_irq_status, llcc68_get_irq_status, llcc68_set_dio2_as_rf_sw_ctrl, llcc68_set_dio3_as_tcxo_ctrl
*/
llcc68_set_dio_irq_params(_lora, LLCC68_IRQ_ALL, LLCC68_IRQ_TX_DONE, LLCC68_IRQ_TX_DONE, LLCC68_IRQ_NONE); // for now only dio01 IRQ has been set

//	11. Define Sync Word value: use the command WriteReg(...) to write the value of the register via direct register access
llcc68_set_lora_sync_word(_lora, 0x12);

//	12. Set the circuit in transmitter mode to start transmission with the command SetTx(). Use the parameter to enable	Timeout
llcc68_set_tx(_lora, 1000); // timeout of  1 second

//	13. Wait for the IRQ TxDone or Timeout: once the packet has been sent the chip goes automatically to STDBY_RC mode
while(local_irq_tx_status == 0)
{
	HAL_Delay(1000);
	llcc68_get_and_clear_irq_status(_lora, &local_irq_tx_status);
	llcc68_set_tx(_lora, 2000);// timeout of  2 second
}
HAL_Delay(100);

//	14. Clear the IRQ TxDone flag
if( LLCC68_STATUS_OK == ret)
	ret = llcc68_clear_irq_status(_lora, local_irq_tx_status); // not needed just for consistency

if( LLCC68_STATUS_OK == ret)
	return LORA_OK;
else
	return LORA_NOT_FOUND;

note:

  1. hal_ok is checked for every instruction in actual code but not shown here for code readability
  2. when using get command I get beck whichever packege type I select so spi is working fine

Update 22Jun, 2023

at set_tx command step 12, I get “LLCC68_CMD_STATUS_CMD_EXEC_FAILURE” and “LLCC68_CHIP_MODE_STBY_XOSC”

which means due to some configuration conflict my lora module llcc68 not set in tx mode