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.
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.
Yes I will! I plan to start a series on STM32 beginning with some basic PCB design videos then going into programming tutorials. I will also have RTOS videos to cover pretty much all the devices I use (Pico, STM32, ESP32 etc) from now on.
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
Dear Sir. In your video the CS pin is made by simple GPIO. This is clear and usefull, but, in case of only one SPI periferal, I guess that would be good to have the CS pin control by the same SPI function. Therefore, I have a question: Do the Pico library have one SPI R/W function which automatically manage the CS pin? Congratulation for your channel.
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.
To force the MSB to a 1 and leaving the remainder unaltered, you would OR the byte value with 0x80. To force to a zero, you would AND the byte value with 0x7F.
I want to learn how to program my BLE module. I just purchased a BL651 from Laird connectivity. Sorry I'm a beginner self learning. I would love to have some guidance on how to interface the BL651 and send and receive the data using SPI protocol.
J Meng, the BL651 is way too advance. first you'll need to read the datasheet, make sense of it and write your own peripheral driver like the .h and the .c file which are the most complicated parts and then you can start with your main.c file to interface with it. try starting with something simple. there are many arduino and python bluetooth projects on online
I need help with a project I am developing for my college degree... I am trying to connect 2 sensors (they need 5V and 170mA each) to my Raspberry Pi via SPI. They are both energised, and connected to the same miso, mosi and clock, as they should be. The problem comes with connecting the SS. I need two more wires for each radar: 1 for the SlaveSelect and another one for PinTurnOn. Is it mandatory that I use GPIO 24 and GPIO26 as SlaveSelect? Or I can use any I want? The thing is I am using any GPIO (free of course) I want at this moment and the radars work ONLY when the other radar is DISconnected. If I connect both, the screen just doesnt show anything, but as soon as I unplug one of them, the other one starts working... Any idea? I can give more dets if you were willing to help, thank you very much
People, PLEASE learn C/C++ for microcontroller programming. Python is incredibly slow compared to compiled code. Python is really only useful to learn the basics of programming. To actually make the most of the hardware, switch to a proper compiled language. It's like taking the training wheels off!
@@Stabby666 Yes, but does it really matter? Speed? Only, if you really need it. These interpreter languages like Python have their justification, especially since speed is compensated more and more with fast processors and libraries that implement the critical parts. These are a big step forward with abstraction layers of all languages like step from real binary coding to mnemonics and later compilers and linkers. We're no longer living in times of basic.
@@Stabby666 It's true it's also just a bit like going into a living nightmare of move semantics and a bowl of brace/bracket/paren pasta 🤣 c++ and python have their place! Often projects don't need a super tight loop, instead reacting to inputs on a human timescale. Why should you pay the heavy performance tax that writing performant C++ code incurs if you don't have a use for it and you don't have a boss breathing down your neck about the cost of 100s of thousands of units. Oh and one more thing: remember C coders are rolling their eyes at C++ programmers for using such "bloated" executables from an "overengineered" language, and behind those guys the assembler coders are sniffing at this C nonsense coming between them and the instruction set.
@@bakedbeings if your boss is breathing down your neck leading you to using a language that’s literally hundreds to thousands of times slower then a compiled language, get another job - he’s going out of business. If you can implement a project using a cheap 1 MHz part in C instead of getting the same performance using a 200mhz part with 100 times the flash, because you’re dicking around with python, then you’re losing money on every unit shipped due to laziness. It’s like they say, when all you have is a hammer, everything looks like a nail. I use ASM, C, C++, JavaScript, and used to spend most of my time writing Java, Perl, PHP and yes even Python. I’m not a language snob, but a professional should have more than one language in their toolkit and know which is appropriate. And to the previous guy, Python IS the modern version of BASIC. Indeed that’s the reason it was chosen as the default on the Raspberry pi, according to the founder.
Pls help me I Using python in my laptop. And I want to send data from python to AVR. Could you tell me What type connecting wire is appropriate ? Thanks you
Hello bro I like your videos for raspberry pico Actually I try to make a library in .cpp and I cant do this .. You can explain how to make a library for this platform? Thanks for read my cm
I also asking myself. I need to connect an encoder to it. I know it should work with stm32´s via a resistor between mosi and miso, but no clues if the rp2040 is capable. Did you find the answer?
I’m really trying to understand this new world of microcontrollers “New to Me” GOD gives me everything I need when God intends. Your explanations are right on cue. Good Job 👍
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.
Thank you very much for the feedback on this video, I appreciate it! I am glad you found it useful and educational!
What a perfect introduction in this protocol - thx
This is extremely helpful. I'll be watching it sooo many more times.
Excellent explanation, your videos are necessary and required to see to understand what we do with SPI devices. Thanks.
Is there any advantage on using spi_write_blocking() and spi_read_blocking (line 72 and 73) separately over spi_write_read_blocking()?
Great tutorial thanks!
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 🙂😅
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.
This absolutely incredible, I am so happy I have found your channel. Extremely helpful!
Very happy to help!
So i am.
WOW! Really good tutorial. Will you have tutorials on STM32 or ESP32? Maybe RTOS?
Yes I will! I plan to start a series on STM32 beginning with some basic PCB design videos then going into programming tutorials. I will also have RTOS videos to cover pretty much all the devices I use (Pico, STM32, ESP32 etc) from now on.
Is this the same as how to wire up the bme680 and the corresponding set up code in pico sdk?
Very well documented! Thank you.
You're very welcome!
Very nice video, TNX.
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
Love your C Pico tutorials. Quite RARE! Will you be doing one on a TFT ST7735 display?
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
can you post new video with bmp388 i2c using the raspberry pi pico board (and c++ sdk like you did here)? thank you
Nice video, thanks
Dear Sir. In your video the CS pin is made by simple GPIO. This is clear and usefull, but, in case of only one SPI periferal, I guess that would be good to have the CS pin control by the same SPI function. Therefore, I have a question: Do the Pico library have one SPI R/W function which automatically manage the CS pin? Congratulation for your channel.
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?
because you do not init the function of cs pin as spi, it can work fine as any gpio?
Did you have to download any extra drivers to get SPI working or was everything already included in the operating install?
Nice video, thanks for this tutorial. Are you planning to make video's for MicroPython on the Pico?
Yes I am! The videos are currently in planning but they take a little bit of time for me to produce, hopefully they will be out soon!
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.
To force the MSB to a 1 and leaving the remainder unaltered, you would OR the byte value with 0x80. To force to a zero, you would AND the byte value with 0x7F.
I want to learn how to program my BLE module. I just purchased a BL651 from Laird connectivity. Sorry I'm a beginner self learning. I would love to have some guidance on how to interface the BL651 and send and receive the data using SPI protocol.
J Meng, the BL651 is way too advance.
first you'll need to read the datasheet, make sense of it and write your own peripheral driver like the .h and the .c file which are the most complicated parts
and then you can start with your main.c file to interface with it.
try starting with something simple. there are many arduino and python bluetooth projects on online
I need help with a project I am developing for my college degree...
I am trying to connect 2 sensors (they need 5V and 170mA each) to my Raspberry Pi via SPI. They are both energised, and connected to the same miso, mosi and clock, as they should be.
The problem comes with connecting the SS. I need two more wires for each radar: 1 for the SlaveSelect and another one for PinTurnOn. Is it mandatory that I use GPIO 24 and GPIO26 as SlaveSelect? Or I can use any I want?
The thing is I am using any GPIO (free of course) I want at this moment and the radars work ONLY when the other radar is DISconnected. If I connect both, the screen just doesnt show anything, but as soon as I unplug one of them, the other one starts working... Any idea? I can give more dets if you were willing to help, thank you very much
You can use any free GPIO pin for SS. Are you only selecting one device at a time via the SS pin?
Can we communicate with 2 raspberry Pi pico with the pin of UART
Yes this is possible, I add this suggestion to a list of upcoming videos.
Do you have any idea on how to write data in a microsd file connected via spi?
Thanks a lot.
But now please, explain it again in Circuit-Python too ... 😉✌️
Or MicroPython please 👍
People, PLEASE learn C/C++ for microcontroller programming. Python is incredibly slow compared to compiled code. Python is really only useful to learn the basics of programming. To actually make the most of the hardware, switch to a proper compiled language. It's like taking the training wheels off!
@@Stabby666 Yes, but does it really matter? Speed? Only, if you really need it. These interpreter languages like Python have their justification, especially since speed is compensated more and more with fast processors and libraries that implement the critical parts. These are a big step forward with abstraction layers of all languages like step from real binary coding to mnemonics and later compilers and linkers. We're no longer living in times of basic.
@@Stabby666 It's true it's also just a bit like going into a living nightmare of move semantics and a bowl of brace/bracket/paren pasta 🤣 c++ and python have their place! Often projects don't need a super tight loop, instead reacting to inputs on a human timescale. Why should you pay the heavy performance tax that writing performant C++ code incurs if you don't have a use for it and you don't have a boss breathing down your neck about the cost of 100s of thousands of units. Oh and one more thing: remember C coders are rolling their eyes at C++ programmers for using such "bloated" executables from an "overengineered" language, and behind those guys the assembler coders are sniffing at this C nonsense coming between them and the instruction set.
@@bakedbeings if your boss is breathing down your neck leading you to using a language that’s literally hundreds to thousands of times slower then a compiled language, get another job - he’s going out of business. If you can implement a project using a cheap 1 MHz part in C instead of getting the same performance using a 200mhz part with 100 times the flash, because you’re dicking around with python, then you’re losing money on every unit shipped due to laziness. It’s like they say, when all you have is a hammer, everything looks like a nail. I use ASM, C, C++, JavaScript, and used to spend most of my time writing Java, Perl, PHP and yes even Python. I’m not a language snob, but a professional should have more than one language in their toolkit and know which is appropriate.
And to the previous guy, Python IS the modern version of BASIC. Indeed that’s the reason it was chosen as the default on the Raspberry pi, according to the founder.
I have a problem because CS goes to 1 before it finishes transferring the read_blocking and the data is then invalid. :(
Hi, where did you purchased your breadboard ??
whats the connections on the hardware ?
Good job
Thank you!
@@LearnEmbeddedSystems hope to use this in migrating code from zero to pico...
Hello Sir. Can You show how to use mcp3008 and mcp3208 using SPI?
like yours tutos
Pls help me
I Using python in my laptop.
And I want to send data from python to AVR.
Could you tell me What type connecting wire is appropriate ?
Thanks you
Can we have a video on PWM?
Thank you for the suggestion!
Hello bro I like your videos for raspberry pico
Actually I try to make a library in .cpp and I cant do this ..
You can explain how to make a library for this platform?
Thanks for read my cm
Is the pico spi interface bidirectional?
I also asking myself. I need to connect an encoder to it. I know it should work with stm32´s via a resistor between mosi and miso, but no clues if the rp2040 is capable. Did you find the answer?
master and slave terminology being ruled out! Is there a technical advantage to this or is it ideological?
I’m really trying to understand this new world of microcontrollers “New to Me” GOD gives me everything I need when God intends.
Your explanations are right on cue.
Good Job 👍
There is nothing wrong with using word slave.
Slave device is subordinate to it's master so the terminology still works here. Why do we have to be politically correct for everything?
Because people are weak
Because it actually hurts people and it takes freaking zero effort to use other terminology. Don't be a douche.
Exactly. Master/Slave has been around forever, at least as long as hard drives came into existence.