Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8609

SDK • Problems with SPI Example

$
0
0
Being totally new to the PI pico, I've installed the VS code & extension on a windows machine and also the command line SDK on a debian machine.
On the windows machine the blink.c example loads compiles and runs ok, giving me reasonable confidence in the installation.
However the SPI example raises (several) errors. The most notable of these is in loading the SPI.h header file which cannot be found.

On the Debian machine, I also get errors trying to compile the spi_master example.
I've located the offending spi.h file on the debian machine, and relocated this to the project directory, suitably changing the #include statement.
However, make is still showing the following errors:
mike@thorin:~/pico/test/build$ make
[ 2%] Built target bs2_default
[ 5%] Built target bs2_default_library
[ 6%] Linking CXX executable test.elf
/usr/lib/gcc/arm-none-eabi/12.2.1/../../../arm-none-eabi/bin/ld: CMakeFiles/test.dir/main.c.o: in function `main':
/home/mike/pico/test/main.c:66: undefined reference to `spi_init'
/usr/lib/gcc/arm-none-eabi/12.2.1/../../../arm-none-eabi/bin/ld: /home/mike/pico/test/main.c:86: undefined reference to `spi_write_read_blocking'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/test.dir/build.make:1384: test.elf] Error 1
make[1]: *** [CMakeFiles/Makefile2:1782: CMakeFiles/test.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Examining the spi.h file, the spi_init and spi_read_write_blocking (horrible name) functions are declared.
Declaring these in main.c as external xxx() also has no effect.

Any Ideas as to what to try next? Getting the SPI function working is particularly important to me.

Statistics: Posted by MikeD2 — Sat May 10, 2025 2:28 am



Viewing all articles
Browse latest Browse all 8609

Trending Articles