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

Study the different way to know there is an ongoing communication #2

Open
tperale opened this issue Oct 7, 2020 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@tperale
Copy link
Owner

tperale commented Oct 7, 2020

So far two methods are documented to know if there is an ongoing communication.

  • Using MODEMSTAT
uint8_t status;
spi_read_register(__sx1272_dev.spi, REG_LR_MODEMSTAT, &status, 1);
if (status & (0x04 | 0x01)) {
  sx1272_rx_internal_set(&__sx1272_dev, sx1272_rx_receiving);
}
  • Using interrupt on DIO3
if (sx1272_read_register(SX1272_DEV.spi, REG_LR_IRQFLAGS) & RFLR_IRQFLAGS_VALIDHEADER) {
  SX1272_DEV.receiv_timestamp = RTIMER_NOW(); // - US_TO_RTIMERTICKS(439)
  sx1272_write_register(SX1272_DEV.spi, REG_LR_IRQFLAGS, RFLR_IRQFLAGS_VALIDHEADER);
  sx1272_rx_internal_set(&SX1272_DEV, sx1272_rx_receiving);
  LOG_DBG("Receiving packet\n");
}

I only managed to make the second one work. I should try to implement the first one and study which one detect an incoming packet faster to reduce the time the radio must spend listening for incoming messages.

@tperale tperale added the enhancement New feature or request label Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant