Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stm32duino changes #58

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Middlewares/Third_Party/LoRaWAN/Mac/LoRaMac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,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 */
Expand Down
6 changes: 3 additions & 3 deletions Middlewares/Third_Party/LoRaWAN/Mac/LoRaMacInterfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
/*!
Expand Down
8 changes: 4 additions & 4 deletions Middlewares/Third_Party/LoRaWAN/Mac/Region/RegionCommon.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,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,
Expand Down Expand Up @@ -696,15 +696,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 );
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver/radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 );

Expand Down