Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with pico SDK 2.0 or 2.1 #2

Open
patricksurry opened this issue Dec 29, 2024 · 4 comments
Open

Not working with pico SDK 2.0 or 2.1 #2

patricksurry opened this issue Dec 29, 2024 · 4 comments

Comments

@patricksurry
Copy link

I cloned the repo and was able to build the vga_hello example with SDK v2.1 after one adding one include to vga_mode.cpp due to this change:

pico/stdlib.h no longer declares set_sys_clock_ functions. You must include hardware/clocks.h explicitly

I get a few warnings about unused variables and comparison between different signed types, but nothing that looks very serious

However the resulting uf2 file doesn't seem to emit any useful signals on the GPIO pins - the color bits all seem permanently low, and the sync signal permanently high with no sign of regular clock-like pulse. I confirmed that some generic PIO-baed pico-examples work, like squarewave so I think my board and build system are OK.

Have you tried picovga with the new SDK? I'm completely new to Pico so not sure where to start debugging. I might try reverting to an old SDK and see if that works.

@codaris
Copy link
Owner

codaris commented Dec 30, 2024

I have not tested it with the new SDK; I didn't even know there was a new SDK!

There are quite a few warnings about unused variables so that is "normal".

I can probably grab the latest SDK and give it a build but you might be better off trying with the older version.

@patricksurry
Copy link
Author

I just rebuilt everything with pico-sdk 1.5.1 and now I get a working vga_hello! Clear signals on the scope and it drives my monitor correctly. It looks like it spits out a disassembly so I'll see if anything obvious looks different when I build with 2.1 instead

@codaris
Copy link
Owner

codaris commented Dec 30, 2024

That's good to know! This project is pretty complicated and originally designed not to use the SDK at all that it might take some work to figure out what went wrong. Looking at the SDK release notes it seems like there was a lot of changes around all the areas that this project uses (clock frequency, DMA, etc) though it could easily just be something simple.

@patricksurry patricksurry changed the title Compatible with pico SDK 2.x? Not working with pico SDK 2.0 or 2.1 Jan 1, 2025
@patricksurry
Copy link
Author

I confirmed it fails with both 2.0 and 2.1. I did some basic debugging of vga_hello via USB printf so I could watch everything starting up apparently correctly, and see if the VgaLine interrupt routine was repeating correctly.

With SDK 1.5 (working) you get a trace like below. But with SDK 2.x the VgaLine routine only gets called four times and then stops so no output appears on the gpio pins.

I don't understand the DMA => PIO details but perhaps the PIO doesn't start consuming the data the same way (tho i don't see any error or notes of changing behavior in the 2.x release notes), or there's some race condition than means the IRQ stops firing? I'll poke around a bit more but someone who understands the code better like @Panda381 might have a better idea of what to look for.

Initializing...
StartVgaCore done
VgaCore starting on Core1
Starting PLL clock freq 1452000000, divisors 6 and 2
VgaInit on core1
VgaPioInit on core1
VgaBufInit on core1
VgaDMAInit on core1
VgaLine(1) took 7 us, #cbuf 4 
VgaLine(2) took 2 us, #cbuf 4
VgaLine(3) took 2 us, #cbuf 4 
VgaLine(4) took 2 us, #cbuf 4 
VgaInit starting state machines on core1
[  
  # SDK 1.5 only. With 2.x VgaLine is only called four times, and this output is missing 
  VgaLine(5) took 2 us, #cbuf 4      
  VgaLine(6) took 2 us, #cbuf 4 
  VgaLine(7) took 2 us, #cbuf 4 
  ...
]
VgaInit done on core1
VgaInitReg done
Writing text from core0..
[  
  # SDK 1.5 only. With 2.x VgaLine is only called four times, and this output is missing 
  VgaLine(1) took 5 us, #cbuf 8       <= I print the first 8 calls of every 64k, rolling a u16
  VgaLine(2) took 5 us, #cbuf 8 
  VgaLine(3) took 5 us, #cbuf 8 
  VgaLine(4) took 5 us, #cbuf 8 
  VgaLine(5) took 2 us, #cbuf 4 
  VgaLine(6) took 2 us, #cbuf 4 
  VgaLine(7) took 2 us, #cbuf 4 
  ...
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants