Skip to content

Commit 0ba12ab

Browse files
matthijskooijmanfpistm
authored andcommitted
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 7cf00e9 commit 0ba12ab

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

src/STM32CubeWL/LoRaWAN/Mac/LoRaMac.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,11 @@ static void ProcessRadioRxDone( void )
11531153
#endif /* LORAMAC_VERSION */
11541154
Mlme_t joinType = MLME_JOIN;
11551155

1156+
MW_LOG( TS_ON, VLEVEL_M, "RX: ");
1157+
for (size_t i = 0; i < RxDoneParams.Size; ++i)
1158+
MW_LOG( TS_ON, VLEVEL_M, "%02x", RxDoneParams.Payload[i]);
1159+
MW_LOG( TS_ON, VLEVEL_M, "\r\n");
1160+
11561161
#if (defined( LORAMAC_VERSION ) && (( LORAMAC_VERSION == 0x01000400 ) || ( LORAMAC_VERSION == 0x01010100 )))
11571162
LoRaMacRadioEvents.Events.RxProcessPending = 0;
11581163
#endif /* LORAMAC_VERSION */

src/STM32CubeWL/SubGHz_Phy/stm32_radio_driver/radio.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,18 @@ static void RadioSetRxConfig( RadioModems_t modem, uint32_t bandwidth,
871871
#if (RADIO_SIGFOX_ENABLE == 1)
872872
uint8_t modReg;
873873
#endif
874+
//Disabled, too much influence on RX timing
875+
/*
876+
MW_LOG( TS_ON, VLEVEL_M,
877+
"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",
878+
modem == MODEM_FSK ? "MODEM_FSK" : (modem == MODEM_LORA ? "MODEM_LORA" : "?"),
879+
(unsigned)bandwidth, (unsigned)datarate, (unsigned)coderate,
880+
(unsigned)bandwidthAfc, (unsigned)preambleLen,
881+
(unsigned)symbTimeout, (unsigned)fixLen, (unsigned)payloadLen,
882+
(unsigned)crcOn, (unsigned)freqHopOn, (unsigned)hopPeriod,
883+
(unsigned)iqInverted, (unsigned)rxContinuous
884+
);
885+
*/
874886
SubgRf.RxContinuous = rxContinuous;
875887
RFW_DeInit();
876888
if( rxContinuous == true )
@@ -1060,6 +1072,15 @@ static void RadioSetTxConfig( RadioModems_t modem, int8_t power, uint32_t fdev,
10601072
SubgRf.lr_fhss.is_lr_fhss_on = false;
10611073
#endif /* RADIO_LR_FHSS_IS_ON == 1 */
10621074
RFW_DeInit();
1075+
MW_LOG( TS_ON, VLEVEL_M,
1076+
"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",
1077+
modem == MODEM_FSK ? "MODEM_FSK" : (modem == MODEM_LORA ? "MODEM_LORA" : "?"),
1078+
(int)power, (unsigned)fdev, (unsigned)bandwidth,
1079+
(unsigned)datarate, (unsigned)coderate, (unsigned)preambleLen,
1080+
(unsigned)fixLen, (unsigned)crcOn, (unsigned)freqHopOn,
1081+
(unsigned)hopPeriod, (unsigned)iqInverted, (unsigned)timeout
1082+
);
1083+
10631084
switch( modem )
10641085
{
10651086
case MODEM_FSK:
@@ -1318,6 +1339,11 @@ static radio_status_t RadioSend( uint8_t *buffer, uint8_t size )
13181339
IRQ_RADIO_NONE,
13191340
IRQ_RADIO_NONE );
13201341

1342+
MW_LOG( TS_ON, VLEVEL_M, "TX:");
1343+
for (size_t i = 0; i < size; ++i)
1344+
MW_LOG( TS_ON, VLEVEL_M, " %02x", buffer[i]);
1345+
MW_LOG( TS_ON, VLEVEL_M, "\r\n");
1346+
13211347
/* Set DBG pin */
13221348
DBG_GPIO_RADIO_TX( SET );
13231349

0 commit comments

Comments
 (0)