Beginners Guide to SPI on the Raspberry Pi Pico (BMP280 Example)

preview_player
Показать описание
This video covers the basics of the SPI communication protocol and how to use it on your Raspberry Pi Pico. We use a Visual Studio Code project to program the brand-new Raspberry Pi Pico microcontroller board in C. We created a project which uses the BMP280 temperature and pressure sensor to read values of temperature over SPI and print them to a serial monitor over a USB connection to a PC.

This video provides the fundamental background of the SPI communication protocol and explains how to correctly wire an SPI compatible device to the Pico. It explains which functions in the Pico SDK to use in order to communicate with this device. We also cover how to configure the Raspberry Pi Pico correctly, in both the CMakeLists file and the C file, in order to enable SPI communication.

As an example, the BMP280 breakout board from Adafruit is used to demonstrate writing to, and reading from, registers on a peripheral device. This video also shows you where to find the required information in your particular peripheral device’s datasheet in order to get your peripheral device functioning correctly.

BMP280 Breakout board is available at Amazon (Affiliate):

Timestamps
00:00 Introduction
00:53 SPI Basics
02:41 Pico Wiring
03:49 SPI Protocol
05:11 Pico SDK I2C Functions
06:12 Read/Write Operations
07:02 Programming Example
13:38 Conclusion

If this video helped you, please consider leaving a like and subscribing, thank you!

-- Equipment I use regularly --
The following links are affiliate links where I may make a small percentage on qualifying sales through these links. Use the respective UK or US links listed.

All videos and tutorials on this channel and mentioned websites are for educational purposes only.
Рекомендации по теме
Комментарии
Автор

A very nice and clean introduction and a great overview of SPI in conjunction with the Pi Pico. I think it's great that you make the effort to show not only the code but also diagrams and tables. Absolutely great! Thank you very much.

matthiassuess
Автор

What a perfect introduction in this protocol - thx

daCount
Автор

This is extremely helpful. I'll be watching it sooo many more times.

scottduede
Автор

Excellent explanation, your videos are necessary and required to see to understand what we do with SPI devices. Thanks.

marvicdigital
Автор

Is there any advantage on using spi_write_blocking() and spi_read_blocking (line 72 and 73) separately over spi_write_read_blocking()?

javjsky
Автор

WOW! Really good tutorial. Will you have tutorials on STM32 or ESP32? Maybe RTOS?

iliyannaydenov
Автор

Love your C Pico tutorials. Quite RARE! Will you be doing one on a TFT ST7735 display?

mytechnotalent
Автор

Do you have recommendations for which breadboards are good ones, and where to buy them? I've bought quite a few that are semi junk, and can only grip thick wires, or that it's hard to push components into because the contacts don't line up with the holes well. The power rails are usually the worst part, especially for not gripping thinner jumper wires / bell wire.

TooSlowTube
Автор

Thank you for the movie. It would be great if you made a movie explaining how to use a SPI display with a Pico using MicroPython. Especially the XC3728 OLED that is used by Arduino. I found another movie however they do not provide any code, just a demonstration. Thank you

seanudal
Автор

This is really good! Thanks.
Just to make sure a beginner like me dont get 1 week stuck think why i didnt work.
You need to solder the boards 🙂😅

alfonsosamuel
Автор

This absolutely incredible, I am so happy I have found your channel. Extremely helpful!

taotechnique
Автор

Can we communicate with 2 raspberry Pi pico with the pin of UART

hirakjyotiburagohain
Автор

Thanks a lot.
But now please, explain it again in Circuit-Python too ... 😉✌️

hwj
Автор

because you do not init the function of cs pin as spi, it can work fine as any gpio?

samueldavies
Автор

Why are there specific labels for CS if the CS can be wired to any GPIO pin? Also, what's the advantage of having separate busses, simply speed?

larrybud
Автор

Did you have to download any extra drivers to get SPI working or was everything already included in the operating install?

samihawasli
Автор

Hi,
I want understand what you did at 10:25
Why did you write 0x27 to 0xF4 ?? what's the purpose behind it ??

I'm new to SPI

robotboy
Автор

The part about the MSB of the register is a bit confusing. Is there a max of 127 registers? Would seem so since your are forcing the MSB to a 1 or 0. Seems like the upper nibble of the register address would be an 0x8 and not a 0xF.

dave_dennis
Автор

Nice video, thanks for this tutorial. Are you planning to make video's for MicroPython on the Pico?

christiaang
Автор

can you post new video with bmp388 i2c using the raspberry pi pico board (and c++ sdk like you did here)? thank you

NokiAll