1

I'd like to configure the clock phase, polarity, etc. of the SPI peripheral on my Raspberry Pi. While I can just try stuff and observe the results on an oscilloscope, I'm partial to reading SDK documentation and datasheets to find out this information. So far, all I've found in the way of documentation is the source code for the kernel module:

#define SPI_CS_LEN_LONG     0x02000000
#define SPI_CS_DMA_LEN      0x01000000
#define SPI_CS_CSPOL2       0x00800000
#define SPI_CS_CSPOL1       0x00400000
#define SPI_CS_CSPOL0       0x00200000
#define SPI_CS_RXF      0x00100000
#define SPI_CS_RXR      0x00080000
#define SPI_CS_TXD      0x00040000
#define SPI_CS_RXD      0x00020000
#define SPI_CS_DONE     0x00010000
#define SPI_CS_LEN      0x00002000
#define SPI_CS_REN      0x00001000
#define SPI_CS_ADCS     0x00000800
#define SPI_CS_INTR     0x00000400
#define SPI_CS_INTD     0x00000200
#define SPI_CS_DMAEN        0x00000100
#define SPI_CS_TA       0x00000080
#define SPI_CS_CSPOL        0x00000040
#define SPI_CS_CLEAR_RX     0x00000020
#define SPI_CS_CLEAR_TX     0x00000010
#define SPI_CS_CPOL     0x00000008
#define SPI_CS_CPHA     0x00000004
#define SPI_CS_CS_10        0x00000002
#define SPI_CS_CS_01        0x00000001

Source code is not documentation, but even so, the source code doesn't even have comments defining which clock polarity is rising edge and which is falling edge, for instance.

Where should I look for this kind of documentation?

2

In Pi terms these are peripherals.

BCM2835 ARM Peripherals

For the main SPI see from page 148.

For the auxiliary SPI see from page 20.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.