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

If CS is asserted between transfers then consider bus to be busy for all but owning device #12604

Merged
merged 3 commits into from May 10, 2023

Conversation

SteveCEvans
Copy link
Member

May fix #12583.

This PR checks if CS is asserted between transfers and then consider the SPI bus to be busy for all but the device which asserted CS.

@SteveCEvans SteveCEvans changed the title If CS is asserted between transfers then consider bus to be busy for … If CS is asserted between transfers then consider bus to be busy for all but owning device Mar 31, 2023
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@blckmn
Copy link
Member

blckmn commented Mar 31, 2023

AUTOMERGE: (FAIL)

  • github identifies PR as mergeable -> FAIL
  • assigned to a milestone -> PASS
  • cooling off period lapsed -> PASS
  • commit count less or equal to three -> PASS
  • Don't merge label NOT found -> PASS
  • at least one RN: label found -> PASS
  • Tested label found -> FAIL
  • assigned to an approver -> PASS
  • approver count at least three -> FAIL

Copy link
Member

@freasy freasy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested on MAMBAG4 which has a shared SPI bus for flash and OSD

before: OSD locks up and blackbox stops working
after: OSD works perfect, blackbox logs as expected

edit://
its not fixed, i dont know why it worked once here

edit2://
DMA resource mapping must be done manual, if BUS is shared! So i can declare this as tested on 2 G4 boards.

Copy link
Member

@haslinghuis haslinghuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SteveCEvans is this ready to merge?

EDIT - SPI DMA: If bus is shared we need to assign manual:

#define SPI_RX_DMA_OPT 6
#define SPI_TX_DMA_OPT 7
#define SPI_RX_DMA_OPT 8
#define SPI_TX_DMA_OPT 9

@SteveCEvans
Copy link
Member Author

I need to fix an issue with the MAMBAG4 build to complete testing.

@SteveCEvans
Copy link
Member Author

@SteveCEvans is this ready to merge?

EDIT - SPI DMA: If bus is shared we need to assign manual:

#define SPI_RX_DMA_OPT 6
#define SPI_TX_DMA_OPT 7
#define SPI_RX_DMA_OPT 8
#define SPI_TX_DMA_OPT 9

These definitions are meaningless.

@haslinghuis
Copy link
Member

@SteveCEvans I got those lines from @freasy .
Should be

#define SPI1_RX_DMA_OPT 6
#define SPI1_TX_DMA_OPT 7
#define SPI2_RX_DMA_OPT 8
#define SPI2_TX_DMA_OPT 9

Updated in config repo.

@freasy
Copy link
Member

freasy commented May 2, 2023

@SteveCEvans is this ready to merge?

EDIT - SPI DMA: If bus is shared we need to assign manual:

#define SPI_RX_DMA_OPT 6
#define SPI_TX_DMA_OPT 7
#define SPI_RX_DMA_OPT 8
#define SPI_TX_DMA_OPT 9

These definitions are meaningless.

@haslinghuis copied wrong 😅

@github-actions
Copy link

github-actions bot commented May 2, 2023

Do you want to test this code? Here you have an automated build:
Assets
WARNING: It may be unstable. Use only for testing! See: https://www.youtube.com/watch?v=I1uN9CN30gw for instructions for unified targets!

@haslinghuis haslinghuis merged commit 9ff4723 into betaflight:master May 10, 2023
19 checks passed
haslinghuis pushed a commit to haslinghuis/betaflight that referenced this pull request May 10, 2023
…all but owning device (betaflight#12604)

* If CS is asserted between transfers then consider bus to be busy for all but owning device

* Track if MAX7456 is mid DMA transfer, not simply that the SPI bus is busy

* Enable SPI DMA TX/RX together
haslinghuis added a commit that referenced this pull request May 12, 2023
…usy for … (#12784)

If CS is asserted between transfers then consider bus to be busy for all but owning device (#12604)

* If CS is asserted between transfers then consider bus to be busy for all but owning device

* Track if MAX7456 is mid DMA transfer, not simply that the SPI bus is busy

* Enable SPI DMA TX/RX together

Co-authored-by: Steve Evans <SteveCEvans@users.noreply.github.com>
AkankshaJjw pushed a commit to AkankshaJjw/betaflight that referenced this pull request May 29, 2023
…all but owning device (betaflight#12604)

* If CS is asserted between transfers then consider bus to be busy for all but owning device

* Track if MAX7456 is mid DMA transfer, not simply that the SPI bus is busy

* Enable SPI DMA TX/RX together
@Star4fish
Copy link

Star4fish commented Jun 4, 2023

#define SPI1_RX_DMA_OPT 6
#define SPI1_TX_DMA_OPT 7
#define SPI2_RX_DMA_OPT 8
#define SPI2_TX_DMA_OPT 9

not working for speedybee f405 v3

edit
update to 4.5.0 doesn't resolve the issue

davidbitton pushed a commit to davidbitton/betaflight that referenced this pull request Feb 5, 2024
…all but owning device (betaflight#12604)

* If CS is asserted between transfers then consider bus to be busy for all but owning device

* Track if MAX7456 is mid DMA transfer, not simply that the SPI bus is busy

* Enable SPI DMA TX/RX together
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: COMPLETED
Development

Successfully merging this pull request may close these issues.

Blackbox logging issue on SpeedyBee F405 V3, possibly due to sharing SPI bus with analog OSD
6 participants