[riot-notifications] [RIOT-OS/RIOT] cpu/sam0_common: SPI: MOSI only operation & fix for adafruit-itsybitsy-m4 (#15846)

benpicco notifications at github.com
Sun Jan 24 18:01:57 CET 2021


### Contribution description

 - If no MISO is configured, don't enable it. This is useful for devices like APA102 LEDs that don't have a back-channel
 - On `adafruit-itsybitsy-m4` I would not get a signal on MOSI unless I also would mux the pin on `acquire`. Without this, MOSI would just go low during the transmission with no output. I can't really explain it, in `tests/periph_spi` with MISO & MOSI connected I would see
     - `init 0 0 0`
     - `send test` -> no reply
     - `spi_gpio 0`
     - `send test` -> got reply

I narrowed this down to the second `gpio_init_mux()` fixing SPI. Turns out a late `gpio_init_mux()` on `spi_aquire()` would also do.

Also, why are MISO and CLK configured as output gpio? Shouldn't this not be necessary if we mux them to SERCOM mode anyway?

### Testing procedure

`tests/periph_spi` should still work.
Pay attention to changes in power draw with SPI devices attached, I didn't see a difference on a quick test on `samr21-xpro` after putting the radio to sleep.


### Issues/PRs references

<!--
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
-->

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/15846

-- Commit Summary --

  * cpu/sam0_common: SPI: allow to only configure MOSI/CLK
  * cpu/sam0_common: SPI: only mux MISO on spi_acquire()

-- File Changes --

    M cpu/sam0_common/periph/spi.c (18)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/15846.patch
https://github.com/RIOT-OS/RIOT/pull/15846.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15846
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210124/3ed15bf0/attachment.htm>


More information about the notifications mailing list