Skip to content

Commit 181af28

Browse files
STM32CubeWL: 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.
1 parent b7752d7 commit 181af28

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/STM32CubeWL/LoRaWAN/Mac/LoRaMac.c

+5
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,11 @@ static void ProcessRadioRxDone( void )
10701070
AddressIdentifier_t addrID = UNICAST_DEV_ADDR;
10711071
FCntIdentifier_t fCntID;
10721072

1073+
MW_LOG( TS_ON, VLEVEL_M, "RX: ");
1074+
for (size_t i = 0; i < RxDoneParams.Size; ++i)
1075+
MW_LOG( TS_ON, VLEVEL_M, "%02x", RxDoneParams.Payload[i]);
1076+
MW_LOG( TS_ON, VLEVEL_M, "\r\n");
1077+
10731078
#if ( defined( LORAMAC_VERSION ) && ( LORAMAC_VERSION == 0x01000400 ))
10741079
LoRaMacRadioEvents.Events.RxProcessPending = 0;
10751080
#endif /* LORAMAC_VERSION */

src/STM32CubeWL/SubGHz_Phy/stm32_radio_driver/radio.c

+26
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,18 @@ static void RadioSetRxConfig( RadioModems_t modem, uint32_t bandwidth,
830830
#if (RADIO_SIGFOX_ENABLE == 1)
831831
uint8_t modReg;
832832
#endif
833+
//Disabled, too much influence on RX timing
834+
/*
835+
MW_LOG( TS_ON, VLEVEL_M,
836+
"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",
837+
modem == MODEM_FSK ? "MODEM_FSK" : (modem == MODEM_LORA ? "MODEM_LORA" : "?"),
838+
(unsigned)bandwidth, (unsigned)datarate, (unsigned)coderate,
839+
(unsigned)bandwidthAfc, (unsigned)preambleLen,
840+
(unsigned)symbTimeout, (unsigned)fixLen, (unsigned)payloadLen,
841+
(unsigned)crcOn, (unsigned)freqHopOn, (unsigned)hopPeriod,
842+
(unsigned)iqInverted, (unsigned)rxContinuous
843+
);
844+
*/
833845
SubgRf.RxContinuous = rxContinuous;
834846
RFW_DeInit(); /* ST_WORKAROUND: Switch Off FwPacketDecoding by default */
835847
if( rxContinuous == true )
@@ -1012,6 +1024,15 @@ static void RadioSetTxConfig( RadioModems_t modem, int8_t power, uint32_t fdev,
10121024
uint8_t hopPeriod, bool iqInverted, uint32_t timeout )
10131025
{
10141026
RFW_DeInit(); /* ST_WORKAROUND: Switch Off FwPacketDecoding by default */
1027+
MW_LOG( TS_ON, VLEVEL_M,
1028+
"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",
1029+
modem == MODEM_FSK ? "MODEM_FSK" : (modem == MODEM_LORA ? "MODEM_LORA" : "?"),
1030+
(int)power, (unsigned)fdev, (unsigned)bandwidth,
1031+
(unsigned)datarate, (unsigned)coderate, (unsigned)preambleLen,
1032+
(unsigned)fixLen, (unsigned)crcOn, (unsigned)freqHopOn,
1033+
(unsigned)hopPeriod, (unsigned)iqInverted, (unsigned)timeout
1034+
);
1035+
10151036
switch( modem )
10161037
{
10171038
case MODEM_FSK:
@@ -1272,6 +1293,11 @@ static void RadioSend( uint8_t *buffer, uint8_t size )
12721293
IRQ_RADIO_NONE );
12731294
/* ST_WORKAROUND_END */
12741295

1296+
MW_LOG( TS_ON, VLEVEL_M, "TX:");
1297+
for (size_t i = 0; i < size; ++i)
1298+
MW_LOG( TS_ON, VLEVEL_M, " %02x", buffer[i]);
1299+
MW_LOG( TS_ON, VLEVEL_M, "\r\n");
1300+
12751301
/* ST_WORKAROUND_BEGIN : Set the debug pin and update the radio switch */
12761302
/* Set DBG pin */
12771303
DBG_GPIO_RADIO_TX( SET );

0 commit comments

Comments
 (0)