Tae Eun
Posts: 2
Joined: Wed Jul 12, 2017 6:25 am

SPI initialization of Raspberry pi 4

Fri Sep 24, 2021 5:21 am

Hello.

I am trying to initialize SPI using 'pigpio library'.
Although 'pigpio library' uses SPI0 by default, I want to use SPI6.

So, I tried changing the existing 'SPI_BASE'.
Old (SPI0): 0x7e204000 -> Changed (SPI6): 0x7e204c00
>> #define SPI_BASE (0x7e204c00)

If I change it, I get the following error:
2021-09-24 05:30:39 initPeripherals: mmap spi failed (Invalid argument)

What causes the error?
How to use SPI6 using 'pigpio library'?

cleverca22
Posts: 4686
Joined: Sat Aug 18, 2012 2:33 pm

Re: SPI initialization of Raspberry pi 4

Fri Sep 24, 2021 5:23 am

its recommended to use the proper SPI api in linux now, enable it with a dtoverlay, and then use an SPI library that just opens a node like /dev/spi0.0

direct hw access can cause stability issues

Return to “C/C++”