Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SX1276Lib by
Revision 19:8b8d591025bf, committed 2015-09-16
- Comitter:
- modtronix
- Date:
- Wed Sep 16 05:16:16 2015 +0000
- Parent:
- 18:71a47bb03fbb
- Commit message:
- Fixed bug where received data became out of sync after receive errors
Changed in this revision
sx1276/sx1276.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/sx1276/sx1276.cpp Wed Aug 12 14:34:03 2015 +0000 +++ b/sx1276/sx1276.cpp Wed Sep 16 05:16:16 2015 +0000 @@ -1151,6 +1151,13 @@ { this->settings.State = IDLE; } + // For Continuous reception, we remain in Receive mode. Delete current packet, it can contain corrupt data. + else { + //Get start address of next packet + uint8_t startAddNxtPckt = Read(REG_LR_FIFORXBYTEADDR); + //Set SPI pointer to address of next packet we will receive = Delete current packet! + Write(REG_LR_FIFOADDRPTR, startAddNxtPckt); + } rxTimeoutTimer.detach( ); if( ( rxError != NULL ) ) @@ -1199,6 +1206,11 @@ } } + // Ensure we read the last packet received. Without doing this, the bytes read can get out of sync + // with the last packet received after errors occur! + // RegFifoRxCurrentAddr contains start address of last packet received. + Write(REG_LR_FIFOADDRPTR, Read(REG_LR_FIFORXCURRENTADDR)); + this->settings.LoRaPacketHandler.Size = Read( REG_LR_RXNBBYTES ); ReadFifo( rxBuffer, this->settings.LoRaPacketHandler.Size );