SPI display stops working after selecting non-dummy dac

Hi! I’m new here and I hope I’m writhing in the right category and don’t break any rules.

I’ve decided to hack together a zynthian with what I have laying around and faced quite strange problem. I’m using ILI9341 based SPI display, which I made working using this guide, the only thing is each time I change configuration I need to edit /etc/modules as OS seems to overwrite my changes, but I can live with that. The problem I face is whenever I choose non-dummy DAC, the display stops working after reboot, and it’s not because /etc/modules. I have tried 2 i2s DACs (both usually work with dtoverlay=hifiberry-dacon regular rasbian) a and one cheap Chinese generic USB dongle and the result is always the same. Does anybody know what can cause this and how to fix it?

this happens because your screen use raspberry pin number 12 (GPIO 18) for the backlight, pin that is used by i2s (the protocol that make your raspberry “speech” to the dac).

sudo modprobe fbtft_device custom=1 name=fb_ili9341 gpios=reset:25,dc:24,led:18 speed=16000000 bgr=1

if you connect the screen directly on the rasp header with a 2x13 female header, I’m afraid that there will be no solution. Otherwise, if you connect the screen with wires (like on the tutorial you’ve given), you can connect the wire that should go on pin number 12 on a another one that is free, like pin 32 (GPIO 12) and use:

sudo modprobe fbtft_device custom=1 name=fb_ili9341 gpios=reset:25,dc:24,led:12 speed=16000000 bgr=1
1 Like

Thanks for the answer. Yeah, I forgot to mention that I was switching display to gpio-12 while I was using gpio-18 for DAC. The display was working until I set the DAC up in the config. I thought that there might be some conflict with these pins, that’s why I tried generic USB card which led to the same result…

Ok, I see. it’s really strange
some dmesg output, Xorg.log may help …

1 Like

Zynthian configuration system overwrites some /etc files, and /etc/modules is certainly modified. Could you check if your custom configuration is still there?

Also, did you try to make them work together under regular raspbian ?

Ok, it’s definitely about GPIO-18 even when using USB DAC
Here’s a screenshot of a part of dmesg

@jofemodo I didn’t try to make them work on a regular raspbian yet, I’ll try a little later, and will get back with the results

dmesg above show that the screen is still configured to use GPIO 18 for backlight.

I guess that the problem is somewhere in this spi-bcm2835 or fbtft_device in /etc/modules because I have a display hooked up to gpio-12 with dummy-dac and it works, but as soon as I switch dac to generic usb it stops working and I get the same message in dmesg about pin 18.

Just to make everything clear, I have spi-bcm2835 and fbtft_device in /etc/modules and options fbtft_device name=fb_ili9341 gpios=reset:25,dc:24,led:12 speed=16000000 bgr=1 rotate=90 custom=1 in /etc/modprobe.d/fbtft.conf and even with this config dmesg argues about gpio18.

If there’s no spi-bcm2835 or fbtft_device in /etc/modules I can make display work even with dac with sudo modprobe fbtft_device custom=1 name=fb_ili9341 gpios=reset:25,dc:24,led:12 speed=16000000 bgr=1 but I have no idea how show zynthian UI on it. Maybe I need to try to configure it without adding anything to /etc/modules

I guess that the problem is somewhere in this spi-bcm2835 or fbtft_device in /etc/modules because I have a display hooked up to gpio-12 with dummy-dac and it works, but as soon as I switch dac to generic usb it stops working and I get the same message in dmesg about pin 18.

That’s totaly crazy !

you can try to boot with the working config for the screen and no usb dac attached. UI should show you an error message. From the command line:

  • systemctl stop zyntian
  • Plug the usb dac,
  • aplay -L will give you the hardware name.
  • Edit /etc/systemd/system/jack2.service with the right settings
  • systemctl reload-daemon (or daemon-reload)
  • systemctl restart jack2
  • cd /zynthian/zynthian-ui
  • startx ./zynthian.sh

It’s geting late here. I hope that you will be able to get out from this mess.

1 Like

Thanks a lot, I’ll try that tomorrow, it’s also quite late here :slight_smile:

Also, you Can configure zynthian (with the webconf tool) to use the raspberry built in codec.

After some investigations I realized that following that tutorial was not the right thing to do in the first place. All this modprobe stuff is good to check if the display works, but what I really need is proper dtoverlay, seems like I didn’t use the right one and it was causing all the conflicts. I didn’t find the one that fits my case yet, but I’ve found some mentions that people use modified pitft for this kind of displays.
@le51 thanks for all your suggestions, it helped me get some understanding of how zynthian works

I got the 1.8" SPI 128*160 display based on ST7735S working (see this topic). It is now a display option in Zynthian:

This may not work but might be worth a try. You may find the topic useful if you want to progress things. (The overlay I created for this is suboptimal, e.g. rotation doesn’t work but does the job mostly.)

1 Like

Thanks! Seems like a lot of useful info in that topic, will definitely check it out

I got it working! Thanks for help everybody.

I’ve edited rpi-display-overlay, removed all the stuff related to touch, and changed pins a little and made sure gpio-18 is not in use. Compiled it on the PI using this command

sudo dtc -@ -I dts -O dtb -o /boot/overlays/foo.dtbo foo-overlay.dts

After that I’ve changed to my new overlay in webconfig and it worked. The only thing is for some reason I still had issues with using generic usb dac, display worked this time, but UI didn’t show up. Anyway I just used my i2s dac and it worked perfectly.

Here’s the source code of my dtoverlay in case anybody needs it
ili9341-overlay.dts (1.3 KB)

And here’s the display I used

Next stop: wiring the encoders :slight_smile:


Yes :+1:, that’s great ! I was considering buying one of these cheap lcd screen but your problems have frightened me a bit.

Are you sure that touch capability has to be removed ?

I’m not sure touch HAS to be removed, but this screen does not have touch, so I removed it just in case. At the moment I’m using keyboard with touchpad, but I hoped to make it usable with just encoders and without touch…

Ok, I see, screen has pins for touch control but the U1 chip isn’t populated

sure it is !

Indeed most functionality is designed around the encoders and touch is an after thought with some interface elements being suboptimal. We aspire to improve touch interface but it is not high on the agenda. The main thing that touch gives is the X-Y controller panel but the rest of Zynthian is completely controllable via four encoder switches.