RE: https://oldbytes.space/@thelastpsion/116345290344668595
And the results are in!
So, what am I going to do? Well, I'm leaning towards porting the existing Arduino C code to the Pico C SDK. I'm currently using one class for encapsulation and abstraction, but I could replace that with structs and static functions. I'm not a great C programmer, but I'm pretty comfortable with it, so it makes sense
However, before I do that, I see a bigger challenge of getting a good setup without using VS Code. I've been using #NeoVim for a while now, and I'd like to get a comfortable setup using that on #Linux.
So, I'm going to try to build Blinky projects for at least Pico C, Rust and Free Pascal, using Linux and NeoVim. Hopefully this will give me a better feel for how well these languages actually suit me. I've never done any Rust before, either, so that's going to be quite the learning curve!
If I have time, I'm going to give Yarg a go, too, because I think the premise is really cool. If I'm on a roll, I'll try #MicroZig too.
And if I really feel like I have the capacity, I'll port the code to one of these other languages.
I'm acutely aware of all the other projects I've given myself to do, such as the SIBO SDK and other small Psion-related projects, not to mention $dayjob and $reallife. So we'll see how things go!
#Pascal #FreePascal #ObjectPascal #RustLang #YargLang #RaspberryPiPico #PiPico #PiPico2 #RP2040 #RP2350
RE: https://oldbytes.space/@thelastpsion/116345290344668595
Only a couple of hours left for this poll.
C is clearly out in front for my embedded project, but Rust and Pascal aren't far behind!
PIO on the Raspberry Pi Pico – Part 2
Having got all the theory out of the way in PIO on the Raspberry Pi Pico now is the time to actually start programming. Whilst I have the option of using the C/C++ SDK or one of the Python variants, I’m particularly interested in getting it going from within the Arduino environment, just because that is where I do pretty much all of my other microcontroller messing about.
I’m not using the official Arduino for Pico support though, I’m using Earl Philhower’s version from here: https://github.com/earlephilhower/arduino-pico
Pico Arduino Getting Started
Before getting too far into PIO land, there are a few things to note about using the unofficial Arduino Pico core with the Raspberry Pi Pico.
On first boot, hold down the BOOT switch and the Pico will be detected as a “UF2 Board”. This will allow the first upload to take place (more here). I’ve selected “Raspberry Pi Pico” or “Raspberry Pi Pico 2” as appropriate for the board.
Prior to the first download, the configuration should set the Debug Port to Serial. Then once the first sketch is downloaded the board can be redetected via a serial link which will allow both Serial.print() and automatic reset on download of new sketches.
Aside: there are three serial ports (more here):
Here is a simple starter program to make sure everything is working:
void setup() {Assuming everything is working, every second the LED will flash on or off and the counter value will be printed to the serial monitor.
Hello PIO
I’m starting off with a simple pulse on a GPIO pin and will be using the online PIO assembler from https://wokwi.com/tools/pioasm to build it.
My PIO Source:
.program pulseThe online assembler turns the above into the following, which is pasted into a pulse_pio.h file within an Arduino sketch.
// -------------------------------------------------- //Adding the appropriate additional PIO initialisation code to my previous test sketch now gives me the following complete code:
#include <PIOProgram.h>Notes:
The PIO and state machine used are allocated dynamically by the system using pio_claim_free_sm_and_add_program(). The first version had hard-coded PIO 0, state machine 0:
PIO pio = pio0;The final result can be seen on the oscilloscope trace below.
Conclusion
I’ve now been through the theory and a real, albeit simple, application and am feeling like I understand a lot more what is going on now. I still am somewhat bewildered by the huge array of API calls and do feel like they could be grouped together somehow to make them more accessible to people who haven’t swallowed the entire chip datasheet and SDK guidebooks…
But yes, I’m slowly starting to feel like I’m getting to grips with PIO a bit more now. I want to do something that now grabs some input from the GPIO and sticks it into memory, ideally using the DMA system, so that is probably where I’ll go next.
Kevin
#pio #raspberryPiPico #rp2040 #rp2350Simulating the AVR8 for a browser-based Arduino emulator
It has come to my attention that this exists.
https://github.com/tabemann/zeptoforth
I can't update my poll without resetting the results. But, uh, I guess it's an option now?
Poll for a bit of fun. Feel free to boost!
I've got a #RaspberryPiPico project written in #Arduino C. It talks to a Psion SSD and dumps the contents over USB serial. It can (theoretically) act as a full controller to tag an SSD, too.
I feel like I should port it to the proper Pico SDK. But I also know there are other options. And I'm intrigued to know what Fedi would do.
What should I rewrite this firmware in?