-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers: spi: RPi Pico PIO SPI code size and byte order.
Use minimized PIO code for 3-wire operation. Input and output buffers are conventionally stored in bus byte order. For 16 and 32 bit transfers, this is effectively big-endian, so txbuf and rxbuf need to be read as such. Those pointers also need to be declared uint8_t * instead of void *. In addition, tx_count and rx_count are based on dts, and refer to whole transfers (8, 16, or 32 bits), not bytes. Added rpi_pico.overlay to samples/sensor/magn_polling to demonstrate 32-bit word size, and updated the README.rst to make it independent of the specific sensor. Clean up compliance check failures. Fix typos. Synchronize 3-wire TX and RX cycles. Signed-off-by: Steve Boylan <[email protected]>
- Loading branch information
1 parent
aca152a
commit bf2842d
Showing
3 changed files
with
114 additions
and
126 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,35 @@ | ||
.. _magn-polling-sample: | ||
|
||
BMC150 Magnetometer Sample | ||
########################## | ||
Magnetometer Sample | ||
################### | ||
|
||
Overview | ||
******** | ||
|
||
Sample application that periodically reads magnetometer (X, Y, Z) data from | ||
the first available device that implements SENSOR_CHAN_MAGN_* (predefined array | ||
of device names). | ||
|
||
Board-specific overlays | ||
*********************** | ||
|
||
TMAG5170 via Raspberry Pi Pico | ||
============================== | ||
|
||
The Zephyr driver for the :dtcompatible:`ti,tmag5170`` requires an SPI driver | ||
that supports 32-bit SPI_WORD_SIZE. On the :ref:`rpi_pico`, the | ||
:dtcompatible:`raspberrypi,pico-spi-pio` SPI driver provides this support, | ||
demonstrated with the | ||
:zephyr_file:`samples/sensor/magn_polling/boards/rpi_pico.overlay`. | ||
|
||
The GPIO pin assignments in the overlay file are arbitrary. The PIO SPI | ||
driver allows using any four GPIO pins for the SPI bus. Just keep in mind | ||
that the pin assignments in the pinctrl block and the pio0_spi0 block | ||
must match. | ||
|
||
With the sensor wired to the desired pins, build and flash with: | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/sensor/magn_polling | ||
:goals: build flash | ||
:board: rpi_pico |
Oops, something went wrong.