Compare commits

...

6 Commits

Author SHA1 Message Date
Matthijs Kooijman 234459a1b3
Merge 9735e00c0c into 139e8d28bc 2025-03-12 02:30:53 +01:00
Rania JMAI 139e8d28bc [HAL] Upload new fixes 2025-03-10 13:28:25 +01:00
Matthijs Kooijman 9735e00c0c Fix signed vs unsigned comparison warning 2022-12-19 13:00:25 +01:00
Matthijs Kooijman 17482cea0d Add additional debug output
This adds some more details about RX and TX bytes and TX config. There
is also some code for RX config, but to minimize the impact on RX
timing, that is commented out.
2022-12-15 20:28:25 +01:00
Matthijs Kooijman 1c17e31589 Fix printf format warnings
These warnings are caused because frequencies are stored as `uint32_t`,
which is `unsigned long`, while the printf format expects `int`. In
practice, this does not actually cause problems, since on STM32 gcc
`long` and `int` are both 32-bits and frequencies are never large enough
to cause signed vs unsigned ambiguity.

Since printf has no format specifiers for e.g. uint32_t (libc does have
some macros for this, but those really hurt readability), this is tricky
to fix in a portable way (other architectures or compilers might have
`uint32_t` equal to `unsigned int` instead of `unsigned long`), this fix
just casts the frequency to `unsigned` before passing it to printf (and
for good measure, also convert the specifier from `%d` to `%u`). This
does mean this printing will break if `int` is not at least 32-bits
(e.g. on AVR), but given the scope of this library, that should be
acceptable.
2022-12-15 20:27:13 +01:00
Matthijs Kooijman 8372970ad4 Fix comments in LoRaMacCallback_t
It seems the comment for GetDevAddress was copied from GetUniqueId, but
not changend sufficiently to be correct.
2022-12-15 08:53:55 +01:00
6 changed files with 40 additions and 9 deletions

@ -1 +1 @@
Subproject commit 8188d40505f5f77cb6ff9cea404b661d445acbd2
Subproject commit a496d1eebd7394fb880ebfdd56fdcb5f2cce687b

View File

@ -1137,6 +1137,11 @@ static void ProcessRadioRxDone( void )
#endif /* LORAMAC_VERSION */
Mlme_t joinType = MLME_JOIN;
MW_LOG( TS_ON, VLEVEL_M, "RX: ");
for (size_t i = 0; i < RxDoneParams.Size; ++i)
MW_LOG( TS_ON, VLEVEL_M, "%02x", RxDoneParams.Payload[i]);
MW_LOG( TS_ON, VLEVEL_M, "\r\n");
#if (defined( LORAMAC_VERSION ) && (( LORAMAC_VERSION == 0x01000400 ) || ( LORAMAC_VERSION == 0x01010100 )))
LoRaMacRadioEvents.Events.RxProcessPending = 0;
#endif /* LORAMAC_VERSION */

View File

@ -3131,15 +3131,15 @@ typedef struct sLoRaMacCallback
*/
int16_t ( *GetTemperatureLevel )( void );
/*!
* \brief Get the board 64 bits unique ID
* \brief Get the board 64 bits unique ID (for OTAA)
*
* \param [out] id unique
*/
void ( *GetUniqueId )(uint8_t *id);
/*!
* \brief Get the 64 bits unique Device address
* \brief Get the 32 bits Device address (for ABP)
*
* \param [out] id unique
* \param [out] id devaddr
*/
void ( *GetDevAddress )(uint32_t *devAddr);
/*!

View File

@ -656,7 +656,7 @@ void RegionCommonRxBeaconSetup( RegionCommonRxBeaconSetupParams_t* rxBeaconSetup
1, 0, 10, rxBeaconSetupParams->SymbolTimeout, true, rxBeaconSetupParams->BeaconSize, false, 0, 0, false, rxContinuous );
Radio.Rx( rxBeaconSetupParams->RxTime );
MW_LOG(TS_ON, VLEVEL_M, "RX_BC on freq %d Hz at DR %d\r\n", rxBeaconSetupParams->Frequency, rxBeaconSetupParams->BeaconDatarate );
MW_LOG(TS_ON, VLEVEL_M, "RX_BC on freq %u Hz at DR %d\r\n", (unsigned)rxBeaconSetupParams->Frequency, rxBeaconSetupParams->BeaconDatarate );
}
void RegionCommonCountNbOfEnabledChannels( RegionCommonCountNbOfEnabledChannelsParams_t* countNbOfEnabledChannelsParams,
@ -790,15 +790,15 @@ void RegionCommonRxConfigPrint(LoRaMacRxSlot_t rxSlot, uint32_t frequency, int8_
{
if ( rxSlot < RX_SLOT_NONE )
{
MW_LOG(TS_ON, VLEVEL_M, "RX_%s on freq %d Hz at DR %d\r\n", EventRXSlotStrings[rxSlot], frequency, dr );
MW_LOG(TS_ON, VLEVEL_M, "RX_%s on freq %u Hz at DR %d\r\n", EventRXSlotStrings[rxSlot], (unsigned)frequency, dr );
}
else
{
MW_LOG(TS_ON, VLEVEL_M, "RX on freq %d Hz at DR %d\r\n", frequency, dr );
MW_LOG(TS_ON, VLEVEL_M, "RX on freq %u Hz at DR %d\r\n", (unsigned)frequency, dr );
}
}
void RegionCommonTxConfigPrint(uint32_t frequency, int8_t dr)
{
MW_LOG(TS_ON, VLEVEL_M, "TX on freq %d Hz at DR %d\r\n", frequency, dr );
MW_LOG(TS_ON, VLEVEL_M, "TX on freq %u Hz at DR %d\r\n", (unsigned)frequency, dr );
}

View File

@ -781,7 +781,7 @@ STATIC uint16_t lr_fhss_payload_interleaving( const uint8_t *data_in, uint16_t d
lr_fhss_set_bit_in_byte_vector( data_out, 0 + out_row_index, 0 ); // guard bits
lr_fhss_set_bit_in_byte_vector( data_out, 1 + out_row_index, 0 ); // guard bits
for( uint32_t j = 0; j < in_row_width; j++ )
for( int32_t j = 0; j < in_row_width; j++ )
{
lr_fhss_set_bit_in_byte_vector( data_out, j + 2 + out_row_index,
lr_fhss_extract_bit_in_byte_vector( data_in, pos ) ); // guard bit

View File

@ -868,6 +868,18 @@ static void RadioSetRxConfig( RadioModems_t modem, uint32_t bandwidth,
#if (RADIO_SIGFOX_ENABLE == 1)
uint8_t modReg;
#endif
//Disabled, too much influence on RX timing
/*
MW_LOG( TS_ON, VLEVEL_M,
"Setting RX Config: modem=%s, bandwidth=%u, datarate=%u, coderate=%u bandwithAfc=%u, preambleLen=%u, symbTimeout=%u, fixLen=%u, payloadLen=%u, crcOn=%u, freqHopOn=%u, hopPeriod=%u, iqInverted=%u, rxContinuous=%u\r\n",
modem == MODEM_FSK ? "MODEM_FSK" : (modem == MODEM_LORA ? "MODEM_LORA" : "?"),
(unsigned)bandwidth, (unsigned)datarate, (unsigned)coderate,
(unsigned)bandwidthAfc, (unsigned)preambleLen,
(unsigned)symbTimeout, (unsigned)fixLen, (unsigned)payloadLen,
(unsigned)crcOn, (unsigned)freqHopOn, (unsigned)hopPeriod,
(unsigned)iqInverted, (unsigned)rxContinuous
);
*/
SubgRf.RxContinuous = rxContinuous;
RFW_DeInit();
if( rxContinuous == true )
@ -1057,6 +1069,15 @@ static void RadioSetTxConfig( RadioModems_t modem, int8_t power, uint32_t fdev,
SubgRf.lr_fhss.is_lr_fhss_on = false;
#endif /* RADIO_LR_FHSS_IS_ON == 1 */
RFW_DeInit();
MW_LOG( TS_ON, VLEVEL_M,
"Setting TX Config: modem=%s, power=%u, fdev=%u, bandwidth=%u, datarate=%u, coderate=%u preambleLen=%u, fixLen=%u, crcOn=%u, freqHopOn=%u, hopPeriod=%u, iqInverted=%u, timeout=%u\r\n",
modem == MODEM_FSK ? "MODEM_FSK" : (modem == MODEM_LORA ? "MODEM_LORA" : "?"),
(int)power, (unsigned)fdev, (unsigned)bandwidth,
(unsigned)datarate, (unsigned)coderate, (unsigned)preambleLen,
(unsigned)fixLen, (unsigned)crcOn, (unsigned)freqHopOn,
(unsigned)hopPeriod, (unsigned)iqInverted, (unsigned)timeout
);
switch( modem )
{
case MODEM_FSK:
@ -1315,6 +1336,11 @@ static radio_status_t RadioSend( uint8_t *buffer, uint8_t size )
IRQ_RADIO_NONE,
IRQ_RADIO_NONE );
MW_LOG( TS_ON, VLEVEL_M, "TX:");
for (size_t i = 0; i < size; ++i)
MW_LOG( TS_ON, VLEVEL_M, " %02x", buffer[i]);
MW_LOG( TS_ON, VLEVEL_M, "\r\n");
/* Set DBG pin */
DBG_GPIO_RADIO_TX( SET );