Quantcast
Viewing all articles
Browse latest Browse all 4938

Bare metal, Assembly language • Using SPI3-6 on RPi4 bare metal

The BCM2711 device has five SPI interfaces: SPI0, SPI3, SPI4, SPI5 & SPI6, and two additional mini SPI interfaces (SPI1 and SPI2).

I think SPI0 and SPI3-6 are the same type of device.

My bare metal code runs fine on SPI0 , but has issues running on SPI3-6.

The MOSI line of SPI3-6 remains high and no signal, but clock line and cs line are working normally.
Image may be NSFW.
Clik here to view.
Image

I only modified the gpio pin and function, reconnect the wires. No other parts of the code have been changed. And It works fine on SPI0 but not on SPi3-6.

All gpio have been set up normally.

Code:

case raspberrypi_SPI0:    raspberrypi_gpio_set_function(7, GPIO_AF0);      //CS1    raspberrypi_gpio_set_pull(7, GPIO_PULL_NONE);    raspberrypi_gpio_set_function(8, GPIO_AF0);      //CS0    raspberrypi_gpio_set_pull(8, GPIO_PULL_NONE);    raspberrypi_gpio_set_function(9, GPIO_AF0);      //MISO    raspberrypi_gpio_set_function(10, GPIO_AF0);     //MOSI    raspberrypi_gpio_set_function(11, GPIO_AF0);     //SCLK    break; case raspberrypi_SPI3:    raspberrypi_gpio_set_function(24, GPIO_AF5);     //CS1    raspberrypi_gpio_set_pull(24, GPIO_PULL_NONE);    raspberrypi_gpio_set_function(0, GPIO_AF3);      //CS0    raspberrypi_gpio_set_pull(0, GPIO_PULL_NONE);    raspberrypi_gpio_set_function(1, GPIO_AF3);      //MISO    raspberrypi_gpio_set_function(2, GPIO_AF3);      //MOSI    raspberrypi_gpio_set_function(3, GPIO_AF3);      //SCLK    break;

Is there any undocumented configuration of SPI3-6?

Statistics: Posted by yangn0 — Mon Jul 01, 2024 3:28 am



Viewing all articles
Browse latest Browse all 4938

Trending Articles