No one even mentioned the new Raspberry Pi Pico?

Anything not related to STM32
feluga
Posts: 64
Joined: Wed Mar 18, 2020 2:50 am

Re: No one even mentioned the new Raspberry Pi Pico?

Post by feluga »

I started playing with RP2040 a couple weeks ago.
I use the C SDK and decided to create my own VGA driver for it.

I tried the VGA examples from GitHub (from pico-playground project) but none works for me... The VGA Monitor doesn't lock on sync signals and reading the code makes me think it isn't standard VGA compatible. I looked into the their demo videos and it sounds like they are using old CRT VGA monitors that may support out of specs VGA signals.

Anyway, I successfully made my Pico generate VGA 640x480 60Hz correctly. So far, it produces 256x240 pixels with 256 colors (8bpp).

I decided to port Adafruit GFX to the Pico and use both cores. I don't use PIO for the VGA driver, but instead, a plain Bitbang :lol:
So I also decided to make one core deal with the VGA driver while the second core draws to the VGA RAM Video buffer.
I coded the demo based on CBM80Amiga work on the Pico, but instead of TFT, it drives the VGA --> https://www.youtube.com/watch?v=YLf2WXjunyg

Pico is Fast! I managed to draw the most complex 3D object in the demo in just 14 ms.... running Pico at 125MHz

What I had to do in order to make it work:
1- It used both Cores as said. Each core has its own NVIC, thus I could make a specific Core to handle timing IRQs.
2- I used PWM functionality to drive IRQ at certain time frame for VGA, as well as, to generate HSync signal correctly - this is a crucial point for VGA signal.
3- I bitbang the pixels on the screen with a single for(;;), which produces almost equally sized pixels - it was impressive. Pico has a Flash Cache acceleration very similar to STM32 ART, seen on STM32F4 upwards series. But I run IRQ routine from SRAM for better performance.
4- In the first test the VGA frames have a lot of jitter. I had to use a double screen frame buffer in order to draw more complex 3D objects because it takes the whole time of a VGA Frame (16.6ms). Because of it, with a single VGA frame buffer, while it was drawing the 3D objects in the buffer, it was at the same time sending the scanlines to the VGA monitor - a race visible in the screen. But even using double buffer there was jittery - thus I had to set a register in order to make Core 1 to have a higher AHB access priority. By doing it jitter is gone. Core 1 sends pixels to the VGA monitor and it was racing access to SRAM with core 0, causing the jitter. Now the image is crystal clear.
5- Core 0 draws in the not used frame buffer and its both cores work in sync using semaphores, similar to a multitasking OS.

I liked the dual core stuff!
The next step will be to make the scanline to be sent using PIO and DMA.
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: No one even mentioned the new Raspberry Pi Pico?

Post by mrburnette »

+1

Great effort.
feluga
Posts: 64
Joined: Wed Mar 18, 2020 2:50 am

Re: No one even mentioned the new Raspberry Pi Pico?

Post by feluga »

Something I liked about Pico and its RP2040 microcontroller is that it is really flexible.
You can control almost everything, from plain CPU speed to any sort of crazy protocol for GPIOs with PIO, defining priority over buses, etc.

PIO has 8 State Machines running in parallel with the dual ARM M0+ cores. Each has its own programming space with a sort of PIO ASM.
It has many ways to make it run data transfers in parallel with the CPU, using a very flexible AHB connection matrix.
DMA can be connected to anything and PIO can raise Interrupt or even wait for Interrupts to be cleared.

It's almost like a "LEGO microcontroller" :lol: .
Very impressive for $5. Something I hadn't seen before...

Maybe some of you have seen other MCUs with a similar architecture!
BennehBoy
Posts: 135
Joined: Sat Jan 04, 2020 2:38 am
Answers: 1

Re: No one even mentioned the new Raspberry Pi Pico?

Post by BennehBoy »

Love to see a vid of your pico doing vga/3d gfx.
DiTBho
Posts: 12
Joined: Fri Mar 12, 2021 7:55 pm

Re: No one even mentioned the new Raspberry Pi Pico?

Post by DiTBho »

For me, it looks too complex. I don't like complex things.
feluga
Posts: 64
Joined: Wed Mar 18, 2020 2:50 am

Re: No one even mentioned the new Raspberry Pi Pico?

Post by feluga »

BennehBoy wrote: Fri Mar 19, 2021 5:51 pm Love to see a vid of your pico doing vga/3d gfx.
I just published the video: https://www.youtube.com/watch?v=E25eQBNbPDQ
BennehBoy
Posts: 135
Joined: Sat Jan 04, 2020 2:38 am
Answers: 1

Re: No one even mentioned the new Raspberry Pi Pico?

Post by BennehBoy »

Nice, thanks. Maybe port Elite to it :D
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: No one even mentioned the new Raspberry Pi Pico?

Post by fpiSTM »

Very nice! Great work! ;)
feluga
Posts: 64
Joined: Wed Mar 18, 2020 2:50 am

Re: No one even mentioned the new Raspberry Pi Pico?

Post by feluga »

BennehBoy wrote: Sat Mar 20, 2021 2:17 pm Nice, thanks. Maybe port Elite to it :D
Is this Elite you're taking about?
https://www.youtube.com/watch?v=vusGo64sDFk
BennehBoy
Posts: 135
Joined: Sat Jan 04, 2020 2:38 am
Answers: 1

Re: No one even mentioned the new Raspberry Pi Pico?

Post by BennehBoy »

Ha yeah :D But they're doing hardware emulation.
Post Reply

Return to “Off topic”