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

Screen only works with -DUSE_DMA_TRANSFERS=OFF #125

Open
golgobot opened this issue Jan 26, 2020 · 5 comments
Open

Screen only works with -DUSE_DMA_TRANSFERS=OFF #125

golgobot opened this issue Jan 26, 2020 · 5 comments

Comments

@golgobot
Copy link

Setup

  • Pi Zero W
  • 1.54" 240x240 ST7789
  • Stock Raspbian OS
  • Compiling on the Pi

/boot/config.txt

hdmi_group=2
hdmi_mode=87
hdmi_cvt=240 240 60 1 0 0 0
hdmi_force_hotplug=1

Build Command

When compiling with DMA transfers OFF the screen works great for about 30 seconds, then, very suddently, it suddenly turns into static.

image

cmake \
    -DST7789=ON \
    -DGPIO_TFT_RESET_PIN=24 \
    -DGPIO_TFT_DATA_CONTROL=25 \
    -DSPI_BUS_CLOCK_DIVISOR=40 \
    -DUSE_DMA_TRANSFERS=OFF \
    -DDISPLAY_ROTATE_180_DEGREES=ON \
    ..

When compiling with the option turned on, there's just a black screen (the backlight is on though). There are no errors from running sudo ./fbcp-ili9341

image

cmake \
    -DST7789=ON \
    -DGPIO_TFT_RESET_PIN=24 \
    -DGPIO_TFT_DATA_CONTROL=25 \
    -DSPI_BUS_CLOCK_DIVISOR=40 \
    -DUSE_DMA_TRANSFERS=ON \
    -DDISPLAY_ROTATE_180_DEGREES=ON \
    ..

I've tried playing around with RX and TX channels, but I'm not really sure what those are, so I tried different numbers for both. Always had the black screen. I've also played around with clock divisor testing numbers from 8 to 50 all with exactly the same results in both cases above.

@WeiDongGitHub
Copy link

Running into the same issue on Pi Zero w https://learn.adafruit.com/2-0-inch-320-x-240-color-ips-tft-display

@jessa0
Copy link

jessa0 commented Oct 18, 2020

I didn't dig too far, but I noticed with the Pi Zero & Zero W, ALL_TASKS_SHOULD_DMA is enabled, which enables a bunch of optimizations. I got this ST7789 working with DMA by removing ALL_TASKS_SHOULD_DMA from config.h.

@DrJaymz
Copy link

DrJaymz commented Apr 21, 2021

I also using pizero and nope doesn't work if ALL_TASKS_SHOULD_DMA enabled.

@DrJaymz
Copy link

DrJaymz commented Apr 21, 2021

I didn't dig too far, but I noticed with the Pi Zero & Zero W, ALL_TASKS_SHOULD_DMA is enabled, which enables a bunch of optimizations. I got this ST7789 working with DMA by removing ALL_TASKS_SHOULD_DMA from config.h.

That 'fixed' my problem but did it actually turn it off?

@jessa0
Copy link

jessa0 commented Apr 21, 2021

That 'fixed' my problem but did it actually turn it off?

ALL_TASKS_SHOULD_DMA is activated here:

#define ALL_TASKS_SHOULD_DMA

IIRC, it seemed like some of the code that ALL_TASKS_SHOULD_DMA enabled wasn't actually related to DMA, but rather other optimizations geared toward getting acceptable performance on the Pi Zero for example. I didn't test whether they were the cause for sure, but they seemed suspiciously dangerous/sketchy to me.

Edit: this is the hand-written optimized asm I'm referring to:

#ifdef ALL_TASKS_SHOULD_DMA

It seems the ALL_TASKS_SHOULD_DMA functionality could be written in C without the hand-written ASM.

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

4 participants