Close

Notes on bcm2835 - SPI

A project log for Raspberry Pi Zero Breakout

A break out board for the Raspberry Pi Zero for use with 5v signalling, and featuring a full size USB-A socket

david-brownDavid Brown 07/25/2016 at 17:050 Comments

Some working notes regarding using bcm2835 for SPI control, as the CE1 line is used as an I/O line the following lines need to be commented out to prevent it being taken out of service;

File bcm2835.h;
line 329 => //BCM2835_SPI_CS1 = 1, ///< Chip Select 1
line 330 => //BCM2835_SPI_CS2 = 2, ///< Chip Select 2 (ie pins CS1 and CS2 are asserted)

File bcm2835.c;
line 330 => //bcm2835_gpio_fsel(RPI_GPIO_P1_26, BCM2835_GPIO_FSEL_ALT0); // CE1
line 347 => //bcm2835_gpio_fsel(RPI_GPIO_P1_26, BCM2835_GPIO_FSEL_INPT); // CE1

I'll add instructions when this has been tested fully. There may be a more elegant way of implementing this.

I need to check and see if the option to setup with (BCM2835_SPI_CS_NONE) and then call CS manually in the code would be an alternative.

Discussions