raspberrypi / pico-playground

BSD 3-Clause "New" or "Revised" License
450 stars 98 forks source link

How to add usb printf to flash-stream dma example? #36

Open sandric opened 1 year ago

sandric commented 1 year ago

I want to draw 640x320 display while also monitoring capacitive touch panel every ~5ms via i2c, so I tried to elaborate on flash-stream example, but failed just to print out smth through usb.

I tried adding second core entry to output usb string with 1 second delay, or vice versa - to move vga routine to second core, while outputting string in main one: in first case its just halts, in second while moving vga to second core - it manages to draw pictures normally but usb tty device not even recognized.

After debugging a bit - I found out that everything works just fine right until __no_inline_not_in_flash_func(flash_bulk_read) function is reached, and its first line ssi_hw->ssienr = 0; breaks it. I'm a newbie to pico and not familiar with this code.

So does anyone knows if its possible to use usb cdc for communication in this large pictures dma example and how to do it, or it is because pico uses all its resources to render images and have no compute power for usb stack (and potentially my i2c touch panel routine on top of it too)? Thx.

sandric commented 1 year ago

I also not sure how to use even UART though - since vga uses all pins with uart buses using gpio0-gpio17, here's my pinout I took from pico documentation:

Screenshot 2023-01-01 at 18-46-29 Hardware design with RP2040

Can someone share schematic to use UART communication with vga 5-5-5 DAC?

lurch commented 1 year ago

Can someone share schematic to use UART communication with vga 5-5-5 DAC?

See section 3.3.1. in https://datasheets.raspberrypi.com/rp2040/hardware-design-with-rp2040.pdf

sandric commented 1 year ago

@lurch thanks, I was able to use 20 and 21 pins for UART. It didn't helped much though making it work with vga output. I wasn't been able to run even blinking led loop normally with video output, its either no video or loop simply hangs, so I believe its just inherently broke in some way or pico power is just not enough for anything except rendering 640x480 image. Not sure if issue should be closed, mb some update will be made on this in future.

lurch commented 1 year ago

I've personally not run any of these VGA examples, so can't offer help with those, but...

or pico power is just not enough for anything except rendering 640x480 image

Raspberry Pi Pico is powerful enough to run doom :grinning:

sandric commented 1 year ago

@lurch idk maybe if you write it in assembly or with pio for everything, which I'm not able to, and I'm still waiting to get simple answer how to get basic usb communication with this exact example and not seeing it..