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
Diversity 2.4GHz (SX1280) Rx... aka Medley #1555
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JyeSmith
commented
May 23, 2022
JyeSmith
commented
May 23, 2022
pkendall64
approved these changes
May 26, 2022
My changes are only niceties. I have tested the branch on regular hardware i.e. not tested the dual RX at all. |
@pkendall64 I have rebased after Frank was merged and added some new generic targets. Another once over might be required. |
Busy 2 is crapping out on freq changes
- FLRC CRC fixed - BusyDelay timeout now based on measured busy periods - dioISR added for both radios - SX12XX_RX_SYNCWORD_ERROR checking added
The var name of currFreq is incorrect and causes confusion. This is actually the register value.
This removes the delay seen in NSS going low and the SPI transfer beginning.
AlessandroAU
approved these changes
Jun 6, 2022
bkleiner
pushed a commit
to bkleiner/ExpressLRS
that referenced
this pull request
Jun 12, 2022
* sx1280 lib optimisations and minor dual radio additions * more dual radio additions Busy 2 is crapping out on freq changes * fixes - updated busy to only wait for the required radio - fix radio.begin to use SX1280_MODE_STDBY_RC - fix TXnb to set non unused radio to FS mode. * remove unnecessary RXnb in HandleFHSS() * Lots of additions. Check the description... - FLRC CRC fixed - BusyDelay timeout now based on measured busy periods - dioISR added for both radios - SX12XX_RX_SYNCWORD_ERROR checking added * change SX1280_Radio_Number_t to be mask based * fix freq reg write The var name of currFreq is incorrect and causes confusion. This is actually the register value. * replace NOP() with micro() in WaitOnBusy() This removes the delay seen in NSS going low and the SPI transfer beginning. * fix 900 targets * add comment about removing SX1280Driver::SetMode() guard * adds target 'ELRS 2.4 Medley' * remove var gotPacketThisInterval * add back the SX1280Hal::reset() delay * fix GPIO_PIN_RST toggling * add missing ICACHE_RAM_ATTR * spelling * adds setNss() * adds power_rxen_2 and power_txen_2 * add missing defines * fix defines and add pins after rebase * remove diversity 8285 target * add generic diversity and diversity+vtx targets * clean up old target * add missing pin config * minor optimisation Co-authored-by: Jye <JyeSmith@users.noreply.github.com>
Hi @brandonrc any progress with Atto Duo target ? |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR not only adds sx1280 diversity radios, but also has a LOT of other changes to the sx1280 lib I found a long the way. Hopefully Ill remember them all and describe below.
Diversity
Each radio can be called individually or together with the enum SX1280_Radio_Number_t. Multiple radios can and/or together to group SPI transactions. The idea is to make life easier if this is ever expanded to 3-4 radios.
When a packet is received it is processes as normal. If successful then all radio irqStatus are cleared. Subsequent interrupts for the same packet will then not be processed since that radio returns a blank GetIrqStatus().
If a packets is processed and fails e.g. bad sync word or crc, then only that radios irqStatus is cleared. Subsequent interrupts for the same OTA packet will then be processed as normal as its irqStatus has not been cleared.
Below is an trace of radio #1 failing HW CRC, then radio #2 having a successful packet processed.
Successful packet track is done by the variableThis has been done.gotPacketThisInterval
. Ideally instance->RXnbISR() would return true/false but I couldn't figure out how to do this. Happy for someone to make a commit here and I will test it.This PR supersedes #1304
Other Changes
New target category of 'ELRS' to move away from 'DIY'. These targets can of course be DIYed by users, but the majority of users will have commercial hardware and this naming will look more professional in Lua. We should consider this for all new targets going into V3.
The FLRC CRC reg was accidentally being set to 0, resulting in no HW CRC check. This has been fixed.
Added SX12XX_RX_SYNCWORD_ERROR to rx_status. SX1280 packets will no longer be processed if the failed status is returned in irqStatus.
SPI transactions have been reordered to minimise latency. Packet stats are only retrieved after a successfully being processed and RC data sent to the FC. ClearIrqStatus is also now done after RC data is processed and sent.
WaitOnBusy() has been changed to replace NOP with micros(). Micros() takes for ever to called and adding it after digitalRead means it may not need to be called at all. If it does need to be called then there is no need to waste time with a NOP, but instead waste time called micros(). There is a HUGE benefit here is reducing the delay and jitter in the first NSS call after an interrupt. Compare the above trace to the below. The delay between NSS going low and transaction beginning is gone.
Timing between the rx interrupt, and NSS going high after packet processing, is now a consistent 49us. Before there was some jitter.