Replies: 2 comments 4 replies
-
Hmm, I'm not sure this can be recovered from on the library side. Essentially, the problem is that there are two packets saved in the FIFO. So the real question is: do we want
Right now it's option 1, I think that's mostly for consistency with other modules like SX127x, which do not allow to manually change the read pointer. |
Beta Was this translation helpful? Give feedback.
4 replies
-
Resolved by merging #1185 - thank you very much @GUVWAF for this fix! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I’ve been debugging a strange issue when receiving short packets quickly after each other using an SX1262 running Meshtastic. I found that I was getting packets with a different payload length than was transmitted, and sometimes twice the same packet with different payload length. Finally I found it was caused due to that we were not calling
readData()
fast enough after theRX_DONE
interrupt, probably caused by e-ink updates. Since the Rx buffer pointer of the radio didn’t get reset to 0 before receiving the next packet usingsetBufferBaseAddress()
, the radio appended the next packet after the previous one in the buffer. However,readBuffer()
is only called with an offset of 0.I verified this by printing the
rxStartBufferPointer
(first byte of the last packet received according to the datasheet) just before callingreadData()
. Normally it’s 0, but when I got the wrong payload length, the pointer was exactly equal to the expected payload length.I’m posting this here mostly as an observation, because we should really fix our issue of slow interrupt handling in Meshtastic when using e-ink screens. However, I was wondering if it would make sense to try to recover from this state in Rx continuous mode? E.g. we could check whether the
rxStartBufferPointer
was really 0, and if not, we can read from 0 till this pointer. Then in the nextreadData()
, we should be reading from therxStartBufferPointer
with the new packet length. This wouldn’t require an additional SPI read, because the pointer is already returned when callinggetPacketLength()
.Anyway, just a thought because it would be mostly a band-aid solution for something that shouldn't be happening at all.
Edit: Recovering both packets can't be done reliably, because you also don't know the IRQ status for e.g. the CRC check. However, to match the data with the packet length, I believe it would make sense to use the
rxStartBufferPointer
as offset forreadBuffer()
.Beta Was this translation helpful? Give feedback.
All reactions