Thanks for this series. I couldn't find many UA-cam Videos that talk about ARM assembly language on PI. In my college they are only teaching how to program M0 on Keil. But doing it on an actual board seems a lot more fun.
You are the best David I truly appreciate and love your work. Especially Assembler. I am an old timer who grew up learning 6502 Assembler for my first programming language.
Yes, I put in a long delay. While I was debugging, the only feedback I had was blinking lights; so I added long delays so I could see them blink. Look at the program in Github, and you'll see the blink subroutine.
My first visit to your channel... I'm massively into assembly language... in recent years doing a lot of AVR... I've been having lustful thoughts about the 4020's PIO for a while.... I think there might be some good stuff here. I love your desk set... I feel like I'm watching TV in the 1980s :) When you show program and datasheet extracts... It'd be better if you were more zoomed in... my eyesight isn't what it was AND I'm watching on a phone.
Welcome aboard! I hope you find it challenging enough. I was into assembly back on the 70's and I'm getting back into it now with ARM. I've got a few more things planned on assembly. Regarding the zooming of the program and data sheet, it's difficult to get everything in context. I try to optimize it for someone on a computer. I try to make it bigger than most UA-cam channels, but it's tough to get everything on a phone. I'll try to make it a little bigger in the future.
Love these seies. Found them because i was trying to find a way to drive a 16x300 neopixel array using 16 channels to drive the 16 rows, then use graphics primative libraries mainly to draw text to the array. I found someone using a 74HC 8 bit serial to parallel shift register and PIO to provide 8 row channels. Thats easily adapted to 16 channels but the challenge is transposing the bits in the frame. Circuit Python has a quick transpose routine, but only handles transposing 8 bits at a time. I need 16. I could probably do that in C but would it be fast enough to transpose 14K of a frame buffer before i show the results? Or if the transposer is fast enough, perhaps with a 2nd PIO, transpose 16 pixels (48 bytes, since each pixels is 24 bits, offset by row size) in time?
I don't know if you checked out my "PIO Chronicles" series? I did a high speed AWG where I could generate up to a 25 mHz (with poor resolution) sine wave using PIO (ua-cam.com/video/8ByDgh5-O2U/v-deo.html). I also did VGA video using PIO (ua-cam.com/video/ZEBkM5FQ86Q/v-deo.html. Maybe those will give you a few more ideas. Sounds interesting. Good luck and have fun!
@@LifewithDavid1 Yes, it is with these during my search for answers that I came across your channel. Didn't get through all of them yet but gave me hope with my large Neopixel array. Since I found Adafruit C libraries that I likely can adapt, writing an array transpose function in C: likely will be fast enough to get a decent framerate.
Yes you can. I could have replaced the jump with a wrap. This would save one space in PIO memory and also save the instruction execution time for the jump instruction since the wrap doesn't use any time. See my PIO episode 4 for more information. I used the jump because I wanted to slow things down. Thanks for watching!
Hey, David. Great series! Any chance of getting back to the 6502 and PIO? You seem to have mastered the pico. It would be cool to see you connect the PIO to the 6502 and use the pico for ram and rom.
I'm hoping to do several videos where I design a 6502 emulator on the Pico. I've made some good progress and I hope to have something to present in a couple weeks. Thanks for the comment!
@@LifewithDavid1 thanks for the reply! An emulator would be neat, but I was thinking more along the lines that you originally started with, i.e., a real 6502 (or 65C02) hooked up to the PIO. Actually, you could use a few pico/6502 “units” together to make a pretty interesting multi-cpu project. Unified memory architecture. Just a thought. Nobody has done that that I’m aware of. You certainly have the know-how!
@@jonathanstein6056 That would be an interesting project. Not sure when I'll get to it; I've only just scratched the surface of what the Pico can do. I would also like to revisit VGA video. So much to do and so little time!
It'd be nice to define a bunch of macros so you could write PIO assembly instructions in your ARM code and they'd emit the correct .word directives... I don't know if this is possible but the idea tickled my "wouldn't it be cool if...".
Interesting. It's operation would be similar to pioasm. If we used the C/C++ SDK then we could call pioasm to generate the .word directives. Thanks for the comment!
I thought the same thing: can't we use a PIO assembler to generate the opcodes? Probably could be done in Python but I hate using Python as helper programs. I've often felt it has been overused in today's programs, making them much slower than they need to be. My first thought was using a spreadsheet. I did that for generating machine code from opcodes for Ben Eater's 8 bit processor I built and modified.
In "Bare Metal Adventures"; I started out using the GCC assembler (ASM) and the RP2040 C/C++ SDK. However, in Chapter 4, I ditched the SDK, and used the GCC assembler and linker; as well as Make. I would suggest looking at the other videos in the "Bare Metal Adventures". Everything I wrote is located in Github with links in the videos' descriptions. Good luck and thanks for watching!
@@LifewithDavid1 Thanks. I've used GCC a little bit, with the STM32F407G Discovery board, but only in C++. I've mostly just stuck to Arduino and the Earle Philhower core, for the RP2040. I'll slowly work my way through your other videos :)
@@TooSlowTube Your statement/thought is wrong. You NEVER used ANYTHING OTHER than GCC. Guess what Arduino uses as its toolchain for your STM32? Or Avr? Or RPi? You get it ...:) There is nothing wrong using the Arduino(-"IDE"). It is just a fancy Make, coupled with a rudimentary editor and package manager, hiding most things that happen under the hood from the user. If you need flexibility, use your own toolchain or build system and editor. Nobody holds you back (only the limited time we have on this earth). Have fun!:)
PIO processed digital data, either converting to serial, or inputting or outputting multiple bits to GPIO. Converting from analog requires the ADC which is a slow process. I haven't tried it, but you might be able to string DMA together with PIO to automate the process. Good luck!
@@LifewithDavid1 Thank you for your answer. You mean that the analog signal is sampled with an ADC and the sampled data is transferred to PIO with a DMA channel to output parallel data. Is that correct?
Yes, that's what I was thinking. However; I have not done any research into this; so I have no clue if it will work. If you find out; let us know. Thanks for watching!
Thanks for this series. I couldn't find many UA-cam Videos that talk about ARM assembly language on PI. In my college they are only teaching how to program M0 on Keil. But doing it on an actual board seems a lot more fun.
And it only cost a few bucks! Thanks for watching.
ARM assembly is compatible across all the ARM processors and MCUs. The PI uses an M0+ an enhanced version of the M0.
awesome work!
Thanks for the visit
I'm loving this series, amazing work. I always love seeing how these things work under the hood and you do a great job of explaining. Keep it up!
Thank you!. Glad you enjoyed it and thanks for watching!
You are the best David I truly appreciate and love your work. Especially Assembler. I am an old timer who grew up learning 6502 Assembler for my first programming language.
Thanks. My next project combines assembly for both the
RP2040 and the 6502.
@@LifewithDavid1 can't wait David!
Just what I was looking for!
Fantastic! Hope it helps.
Nice work! I was surprised how long it took to load PIO program, you must have put a delay in there, load one word with each flash. I'd missed that.
Yes, I put in a long delay. While I was debugging, the only feedback I had was blinking lights; so I added long delays so I could see them blink. Look at the program in Github, and you'll see the blink subroutine.
I thought the same thing, why so slow to load the PIO program? Then I remembered you used the blink routine
I hope you make 1000 more videos in Assembler for the Pico.
I'm working on it. Thanks for the support.
My first visit to your channel... I'm massively into assembly language... in recent years doing a lot of AVR... I've been having lustful thoughts about the 4020's PIO for a while.... I think there might be some good stuff here.
I love your desk set... I feel like I'm watching TV in the 1980s :)
When you show program and datasheet extracts... It'd be better if you were more zoomed in... my eyesight isn't what it was AND I'm watching on a phone.
Welcome aboard! I hope you find it challenging enough. I was into assembly back on the 70's and I'm getting back into it now with ARM. I've got a few more things planned on assembly.
Regarding the zooming of the program and data sheet, it's difficult to get everything in context. I try to optimize it for someone on a computer. I try to make it bigger than most UA-cam channels, but it's tough to get everything on a phone. I'll try to make it a little bigger in the future.
Love these seies. Found them because i was trying to find a way to drive a 16x300 neopixel array using 16 channels to drive the 16 rows, then use graphics primative libraries mainly to draw text to the array.
I found someone using a 74HC 8 bit serial to parallel shift register and PIO to provide 8 row channels. Thats easily adapted to 16 channels but the challenge is transposing the bits in the frame. Circuit Python has a quick transpose routine, but only handles transposing 8 bits at a time. I need 16.
I could probably do that in C but would it be fast enough to transpose 14K of a frame buffer before i show the results?
Or if the transposer is fast enough, perhaps with a 2nd PIO, transpose 16 pixels (48 bytes, since each pixels is 24 bits, offset by row size) in time?
I don't know if you checked out my "PIO Chronicles" series? I did a high speed AWG where I could generate up to a 25 mHz (with poor resolution) sine wave using PIO (ua-cam.com/video/8ByDgh5-O2U/v-deo.html). I also did VGA video using PIO (ua-cam.com/video/ZEBkM5FQ86Q/v-deo.html. Maybe those will give you a few more ideas. Sounds interesting. Good luck and have fun!
@@LifewithDavid1 Yes, it is with these during my search for answers that I came across your channel. Didn't get through all of them yet but gave me hope with my large Neopixel array.
Since I found Adafruit C libraries that I likely can adapt, writing an array transpose function in C: likely will be fast enough to get a decent framerate.
Can you use the wrap target instead of a jmp?
Yes you can. I could have replaced the jump with a wrap. This would save one space in PIO memory and also save the instruction execution time for the jump instruction since the wrap doesn't use any time. See my PIO episode 4 for more information. I used the jump because I wanted to slow things down. Thanks for watching!
Hey, David. Great series! Any chance of getting back to the 6502 and PIO? You seem to have mastered the pico. It would be cool to see you connect the PIO to the 6502 and use the pico for ram and rom.
I'm hoping to do several videos where I design a 6502 emulator on the Pico. I've made some good progress and I hope to have something to present in a couple weeks. Thanks for the comment!
@@LifewithDavid1 thanks for the reply! An emulator would be neat, but I was thinking more along the lines that you originally started with, i.e., a real 6502 (or 65C02) hooked up to the PIO. Actually, you could use a few pico/6502 “units” together to make a pretty interesting multi-cpu project. Unified memory architecture. Just a thought. Nobody has done that that I’m aware of. You certainly have the know-how!
@@jonathanstein6056 That would be an interesting project. Not sure when I'll get to it; I've only just scratched the surface of what the Pico can do. I would also like to revisit VGA video. So much to do and so little time!
@@LifewithDavid1 I hear ya. Keep up the great work 👍🏻
Hi David, may I ask you to show us a way to interact with z80 bus via the PIOs in order to use a Pico to emulate a rom ?
Thanks for the suggestion. I will add it to my list of interesting projects. It might be a while; probably after I try emulating a full Apple II.
It'd be nice to define a bunch of macros so you could write PIO assembly instructions in your ARM code and they'd emit the correct .word directives... I don't know if this is possible but the idea tickled my "wouldn't it be cool if...".
Interesting. It's operation would be similar to pioasm. If we used the C/C++ SDK then we could call pioasm to generate the .word directives. Thanks for the comment!
I thought the same thing: can't we use a PIO assembler to generate the opcodes?
Probably could be done in Python but I hate using Python as helper programs. I've often felt it has been overused in today's programs, making them much slower than they need to be.
My first thought was using a spreadsheet. I did that for generating machine code from opcodes for Ben Eater's 8 bit processor I built and modified.
What software did you have to install to be able to assemble it?
In "Bare Metal Adventures"; I started out using the GCC assembler (ASM) and the RP2040 C/C++ SDK. However, in Chapter 4, I ditched the SDK, and used the GCC assembler and linker; as well as Make. I would suggest looking at the other videos in the "Bare Metal Adventures". Everything I wrote is located in Github with links in the videos' descriptions. Good luck and thanks for watching!
@@LifewithDavid1 Thanks. I've used GCC a little bit, with the STM32F407G Discovery board, but only in C++. I've mostly just stuck to Arduino and the Earle Philhower core, for the RP2040. I'll slowly work my way through your other videos :)
@@TooSlowTube Your statement/thought is wrong. You NEVER used ANYTHING OTHER than GCC. Guess what Arduino uses as its toolchain for your STM32? Or Avr? Or RPi? You get it ...:) There is nothing wrong using the Arduino(-"IDE"). It is just a fancy Make, coupled with a rudimentary editor and package manager, hiding most things that happen under the hood from the user. If you need flexibility, use your own toolchain or build system and editor. Nobody holds you back (only the limited time we have on this earth). Have fun!:)
Thanks David. I want to sample ANALOGUE Signal with PIO. Can you give Idee. Please
PIO processed digital data, either converting to serial, or inputting or outputting multiple bits to GPIO. Converting from analog requires the ADC which is a slow process. I haven't tried it, but you might be able to string DMA together with PIO to automate the process. Good luck!
@@LifewithDavid1 Thank you for your answer. You mean that the analog signal is sampled with an ADC and the sampled data is transferred to PIO with a DMA channel to output parallel data. Is that correct?
Yes, that's what I was thinking. However; I have not done any research into this; so I have no clue if it will work. If you find out; let us know. Thanks for watching!