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

chips: nrf52: spi: auto disable when unused #3466

Merged
merged 1 commit into from
Jun 14, 2023

Conversation

bradjc
Copy link
Contributor

@bradjc bradjc commented Jun 2, 2023

Pull Request Overview

This pull request fixes the issues I was having with using nrfjprog to read the external flash on the nRF52840dk boards. The root issue is the main nrf52840 mcu was driving the MOSI pin to the flash chip low. Since the MOSI pin is the LSB pin when the flash is in Quad SPI mode, the LSB was always reading 0.

I'm guessing that when the SPIM peripheral is enabled it is actively driving the MOSI pin. This PR then only enables the SPIM peripheral when it is busy, aka when a read/write is actually happening.

The driver wasn't really using the initialized flag, and since I don't think we should have init() functions in our HILs (#1112) I removed that in favor of just setting the interrupt and enabling when the peripheral is used.

Testing Strategy

I verified the nonvolatile storage test app works, as well as the nrfjprog --memrd 0x12000000 --n 32 command.

TODO or Help Wanted

n/a

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

@github-actions github-actions bot added the nrf Change pertains to the nRF5x family of MCUs. label Jun 2, 2023
lschuermann
lschuermann previously approved these changes Jun 2, 2023
@brghena
Copy link
Contributor

brghena commented Jun 2, 2023

Woah, that's really tricky. How did you debug that?

It fully explains the behavior we saw too. Your board and Hudson's were probably running Tock, while mine had some class Arduino stuff loaded on it.

@bradjc
Copy link
Contributor Author

bradjc commented Jun 2, 2023

Woah, that's really tricky. How did you debug that?

It fully explains the behavior we saw too. Your board and Hudson's were probably running Tock, while mine had some class Arduino stuff loaded on it.

Yeah when I had a board that I could read successfully from with the same UICR settings as one that didn't work, and flashing tock seemed to break it, it occurred to me the issue is likely with something that Tock is running, and not any of the jlink/nrfjprog tools/infrastructure.

alistair23
alistair23 previously approved these changes Jun 5, 2023
@lschuermann
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 14, 2023

Merge conflict.

@lschuermann lschuermann merged commit 829cde6 into master Jun 14, 2023
@bors bors bot deleted the nrf52-spi-autodisable branch June 14, 2023 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nrf Change pertains to the nRF5x family of MCUs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants