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

Crash on DIY E28 dual board when diversity is disabled. #245

Open
brad112358 opened this issue Dec 13, 2024 · 10 comments
Open

Crash on DIY E28 dual board when diversity is disabled. #245

brad112358 opened this issue Dec 13, 2024 · 10 comments

Comments

@brad112358
Copy link
Contributor

When I use mLRS-bw.lua to switch from diversity to antenna 1 or antenna 2 and power cycle, it seems to be crashing very quickly after power-up, leaving the red LED on solid. Changing other settings and power cycling seems fine. The SWUART debug port works fine in diversity mode and I see a "." printed every second, but when I power cycle after selecting antenna 1 or antenna 2, I'm not getting anything at all on the debug port, just the solid red LED. Note also that if I disconnect JRPIN5 it powers up OK and the red LED flashes as it should.

This issue does not appear when DEVICE_HAS_DIVERSITY is not defined.

@brad112358
Copy link
Contributor Author

It works in branch v1.3

@brad112358
Copy link
Contributor Author

I ran a git bisect. It took about 8 steps.
~/git/mlrs$ git bisect bad
1ebfbc6 is the first bad commit
commit 1ebfbc6
Author: olliw42 [email protected]
Date: Sun Sep 22 15:09:12 2024 +0200

tx,rx, make rf power changeable without save/store

lua/mLRS.lua | 9 ++++-
mLRS/Common/rf_power.h | 61 ++++++++++++++++++++++++++++++++++
mLRS/Common/sx-drivers/sx126x_driver.h | 6 ++++
mLRS/Common/sx-drivers/sx127x_driver.h | 6 ++++
mLRS/Common/sx-drivers/sx128x_driver.h | 6 ++++
mLRS/Common/sx-drivers/sx12xx_driver.h | 1 +
mLRS/CommonRx/mlrs-rx.cpp | 4 +++
mLRS/CommonTx/mlrs-tx.cpp | 6 +++-
8 files changed, 97 insertions(+), 2 deletions(-)
create mode 100644 mLRS/Common/rf_power.h

@jlpoltrack
Copy link
Collaborator

On E28 Dual, if I set to Antenna1 to end up in a crash state, then comment out the sx2.UpdateRfPower line here and flash things seem to work: 1ebfbc6#diff-d442ec9fc39334fee02e97533bc34e173409b31ffbd4f4e056bfd97b76cbb18cR50-R51

Some extra logic needed here?

@olliw42
Copy link
Owner

olliw42 commented Dec 13, 2024

good catch
one probably needs to check the antenna setting and only call which had been inited

something like this https://github.com/olliw42/mLRS/blob/main/mLRS/CommonTx/mlrs-tx.cpp#L720-L721 or this https://github.com/olliw42/mLRS/blob/main/mLRS/CommonTx/mlrs-tx.cpp#L860-L861 (don't know from scratch which)
I would not want this logic be in in the power lib, one probably needs to either change the init/config or change the call

(it's not clear to me from scratch why it's not needed here https://github.com/olliw42/mLRS/blob/main/mLRS/CommonTx/mlrs-tx.cpp#L848-L849)

@olliw42
Copy link
Owner

olliw42 commented Dec 14, 2024

@brad112358 @jlpoltrack

it appears that's again one of the strange things. Tried to reproduce on my dualE28 diy receiver, and it didn't gave issues...

anyway, here is a branch with a suggested change: https://github.com/olliw42/mLRS/tree/owpr-rfpower-antenna

pl check it out if it removes the issue for you
... and that it works correctly otherwise too, i.e. sets the power on the respective antenna correctly, etc pp

@jlpoltrack
Copy link
Collaborator

jlpoltrack commented Dec 14, 2024

Ah, perhaps one difference - Brad and I were testing the E28 Dual board as a Tx, not a receiver.

My test with that fork:

  • Switch to Antenna1 in Lua, save, then power cycle - all good. This would previously crash, much better.
  • Switch to Antenna 2, save, then power cycle - looks good. However, when I go into the Lua the Tx power reports as 9 dBm (min) and the Sensitivity as -104 dBm (FLRC) when I'm set to 50 Hz. RF Power meter shows that the original power settings are still there for Antenna 2, so this seems to just be a Lua/reporting issue?

@olliw42
Copy link
Owner

olliw42 commented Dec 14, 2024

Switch to Antenna 2, save, then power cycle - looks good. However, when I go into the Lua the Tx power reports as 9 dBm (min) and the Sensitivity as -104 dBm (FLRC) when I'm set to 50 Hz. RF Power meter shows that the original power settings are still there for Antenna 2, so this seems to just be a Lua/reporting issue?

shouldn't this be a bug which should have existed before, and also should exist then for the rx side?

maybe the latter, i.e. what happens with a rx, could be tested too

@brad112358
Copy link
Contributor Author

I only have one of these and I was only using it on the Tx side. In addition, I only saw the crash when the Tx was actually installed in a radio handset. Powering up the Tx without Jr pin 5 connected did not crash. Do we understand why it matters if Jr pin 5 is connected?

@olliw42
Copy link
Owner

olliw42 commented Dec 17, 2024

Do we understand why it matters if Jr pin 5 is connected?

that's indeed a very good question. I guess we would want to. :)

@jlpoltrack
Copy link
Collaborator

jlpoltrack commented Dec 17, 2024

Would think it has something to do with channel data being read, does this trigger the update power function?

shouldn't this be a bug which should have existed before, and also should exist then for the rx side?

Just for completeness, this also appears to work on 1.3 Branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants