pygame displaying on /dev/fb0

860 views
Skip to first unread message

Mark A. Yoder

unread,
Sep 10, 2020, 12:16:18 PM9/10/20
to BeagleBoard
I have a ili9341 2.4" TFT display wired to SP1 on my BeagleBone Black and it's working fine when I run fbi to display images, or mplayer to play movies.

I'm unable to get pygame to display on it.  I'm trying to get my clock.py[1] to work and all I get is:
pygame 1.9.4.post1
Hello from the pygame community. https://www.pygame.org/contribute.html
Driver: fbcon failed.
Driver: directfb failed.
Driver: svgalib failed.
Traceback (most recent call last):
  File "./clock.py", line 142, in <module>
    clock = pyclock()
  File "./clock.py", line 38, in __init__
    raise Exception('No suitable video driver found!')
Exception: No suitable video driver found!

/opt/scripts/tools/version.sh is here[2].  There are no messages in dmesg.

This worked a couple of years ago.  Any ideas how to get this pup running again?

---Mark


[2]
git:/opt/scripts/:[ef16ffa8c27225005cc2b2c974a83da3dee6c1ef]
eeprom:[A335BNLT0A5A1513BBBK3586]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-08-31]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2019.04-00002-gc9b3922522]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0]
kernel:[4.19.94-ti-r50]
nodejs:[v10.21.0]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[uboot_overlay_pru=AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20200814.0-0~buster+20200814]
pkg:[bb-wl18xx-firmware]:[1.20200813.1-0~buster+20200813]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.5-git20200715.0-0~buster+20200716]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm tty kmem dialout cdrom floppy audio dip video plugdev users systemd-journal input bluetooth netdev i2c gpio admin spi iio docker tisdk weston-launch xenomai cloud9ide pwm eqep remoteproc]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[   67.629755] remoteproc remoteproc0: wkup_m3 is available
[   67.697686] remoteproc remoteproc0: powering up wkup_m3
[   67.697720] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168
[   67.697999] remoteproc remoteproc0: remote processor wkup_m3 is now up
[   69.600373] remoteproc remoteproc1: 4a334000.pru is available
[   69.602641] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[   69.600373] remoteproc remoteproc1: 4a334000.pru is available
[   69.600538] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[   69.602641] remoteproc remoteproc2: 4a338000.pru is available
[   69.602818] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
dmesg | grep pinctrl-single
[    0.925809] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[    0.939434] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

Robert Nelson

unread,
Sep 10, 2020, 12:21:35 PM9/10/20
to Beagle Board
On Thu, Sep 10, 2020 at 11:16 AM Mark A. Yoder <mark.a...@gmail.com> wrote:
>
> I have a ili9341 2.4" TFT display wired to SP1 on my BeagleBone Black and it's working fine when I run fbi to display images, or mplayer to play movies.
>
> I'm unable to get pygame to display on it. I'm trying to get my clock.py[1] to work and all I get is:
> pygame 1.9.4.post1
> Hello from the pygame community. https://www.pygame.org/contribute.html
> Driver: fbcon failed.

I'd expect it to use fbcon..

But why didn't it pick it up...

Regards,

--
Robert Nelson
https://rcn-ee.com/

Mark A. Yoder

unread,
Sep 10, 2020, 1:00:12 PM9/10/20
to BeagleBoard
Yup, I think before it would grap fbcon, but not now.

--Mark

jonnymo

unread,
Sep 10, 2020, 2:07:47 PM9/10/20
to Beagle Board

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/d43c767e-987b-49a5-91d2-ffc8f95132cen%40googlegroups.com.

Mark A. Yoder

unread,
Sep 10, 2020, 2:10:31 PM9/10/20
to BeagleBoard
Yes, I've tried it with and without sudo.  Same results.

--Mark

jonnymo

unread,
Sep 10, 2020, 2:30:36 PM9/10/20
to Beagle Board
Have you checked the output of the following command?

   "fbset -i -fb /dev/fb0"

Have you tried to force the video driver to fbcon as an environment variable such as:
 SDL_VIDEODRIVER="fbcon"  

I suppose you could try to force it in your pygame code as such:
   os.putenv('SDL_VIDEODRIVER', 'fbcon')

Cheers,

Jon

Robert Nelson

unread,
Sep 10, 2020, 2:38:08 PM9/10/20
to Beagle Board
On Thu, Sep 10, 2020 at 12:00 PM Mark A. Yoder <mark.a...@gmail.com> wrote:
>
> Yup, I think before it would grap fbcon, but not now.

Was it with v4.14.x before? i wonder if the new tinydrm driver in
v4.19.x is causing a fun issue?

Mark A. Yoder

unread,
Sep 10, 2020, 2:50:16 PM9/10/20
to BeagleBoard
I tried the 4.14 and 5.6 kernels, but no luck.

--Mark

jonnymo

unread,
Sep 10, 2020, 3:00:00 PM9/10/20
to Beagle Board
Have you tried running it as root? Not 'sudo' but su to root and try it there.  It could still be a permission issue.

Cheers,

Jon

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.

jonnymo

unread,
Sep 10, 2020, 5:15:32 PM9/10/20
to Beagle Board
Just a thought, is your user part of the 'video' group?  I would suspect it is since you were able to run the fbi stuff but it wouldn't hurt to check.

Cheer,

Jon

Mark A. Yoder

unread,
Sep 10, 2020, 8:51:47 PM9/10/20
to BeagleBoard
su gives the same results.

Mark A. Yoder

unread,
Sep 10, 2020, 8:52:14 PM9/10/20
to BeagleBoard
Good idea, but I'm in group video.

jonnymo

unread,
Sep 11, 2020, 1:09:11 AM9/11/20
to Beagle Board
If you run 'lsmod" does the fbcon module show in the output?

If not, try to load it manually:
  # modprobe fbcon

Does this show an error?

Check  

Mark A. Yoder

unread,
Sep 11, 2020, 7:56:43 AM9/11/20
to BeagleBoard
bone$ lsmod
Module                  Size  Used by
fb_ili9341             16384  3
fbtft_device           49152  0
fbtft                  45056  2 fbtft_device,fb_ili9341
pru_rproc              28672  0
irq_pruss_intc         20480  1 pru_rproc
pruss                  16384  1 pru_rproc
pm33xx                 16384  0
wkup_m3_ipc            16384  1 pm33xx
wkup_m3_rproc          16384  1
remoteproc             57344  3 pru_rproc,wkup_m3_rproc,wkup_m3_ipc
virtio                 16384  1 remoteproc
virtio_ring            28672  1 remoteproc
pruss_soc_bus          16384  0
usb_f_acm              16384  2
u_serial               20480  3 usb_f_acm
usb_f_ncm              28672  2
uio_pdrv_genirq        16384  0
usb_f_mass_storage     53248  2
uio                    20480  1 uio_pdrv_genirq
usb_f_rndis            32768  4
u_ether                20480  2 usb_f_ncm,usb_f_rndis
libcomposite           65536  18 usb_f_acm,usb_f_ncm,usb_f_mass_storage,usb_f_rndis
spidev                 20480  0

bone$ sudo modprobe fbcon
sudo: unable to resolve host ece434: No address associated with hostname
modprobe: FATAL: Module fbcon not found in directory /lib/modules/4.19.94-ti-r50

Are you sure there is a fbcon module?

Dennis Lee Bieber

unread,
Sep 11, 2020, 1:56:51 PM9/11/20
to Beagleboard
On Fri, 11 Sep 2020 04:56:42 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user "Mark A. Yoder"
<mark.a.yoder-Re5J...@public.gmane.org> wrote:


>
>Are you sure there is a fbcon module?

https://www.kernel.org/doc/html/latest/fb/fbcon.html#a-configuration

... seems to imply it may not have been built for the standard release BBB
kernels.



--
Dennis L Bieber

jonnymo

unread,
Sep 11, 2020, 2:00:30 PM9/11/20
to Beagle Board
There is a fbcon module as is referenced in the pygame script you listed from Adafruit.  I would suspect that none of the drivers listed in the script ('fbcon', 'directfb', 'svgalib') would be loadable on your system.  From what I have gathered, fbcon is enabled by enabling the Framebuffer console feature in the kernel as in the .config.  I'm not 100% sure how to do this with the BB kernel.

When my BBBlue was still alive (R.I.P.), I did connect a ili9341 display to it and had to run the following to get a QT app to run on the screen:
   # <qt_program> -platform linuxfb:fb=/dev/fb0

This is the example I followed which was posted by Jason.

Perhaps something similar would work for the BB Black and pygame.  


Cheers,

Jon

Robert Nelson

unread,
Sep 11, 2020, 2:24:14 PM9/11/20
to Beagle Board
It's enabled:

│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ [*] Framebuffer Console support
│ │
│ │ -*- Map the console to the primary display device
│ │
│ │ [*] Framebuffer Console Rotation
│ │
│ │ [ ] Framebuffer Console Deferred Takeover │

jonnymo

unread,
Sep 11, 2020, 6:23:45 PM9/11/20
to Beagle Board
In my config, BBAI running 4.14 kernel, I found two instances of fbcon:
$ sudo find / -name fbcon
 /sys/devices/virtual/graphics/fbcon
 /sys/class/graphics/fbcon

The framebuffer console seems to be attached to the console layer. 
$ cat /sys/class/vtconsole/vtcon1/bind
1
$ cat /sys/class/vtconsole/vtcon0/bind
0

Info on fbcon:


Not sure if this helps at all.

Cheers,

Jon


--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.

Mark A. Yoder

unread,
Sep 12, 2020, 3:33:23 PM9/12/20
to BeagleBoard
Jon:
  Well.....  su does give different results than sudo.  I tried su again and it works!

So, how can I set permissions so I don't have to su or sudo?

--Mark

p.s.  Thanks for all the suggestions.

Mark A. Yoder

unread,
Sep 12, 2020, 4:20:40 PM9/12/20
to BeagleBoard

jonnymo

unread,
Sep 12, 2020, 8:06:05 PM9/12/20
to Beagle Board
Cool.

  I am unable to get your pygame or other fb examples to work but I can get the 'usr' examples to work. 
 
Perhaps this is for another post, but in your examples, are you using SPI0 or SPI1?  It seems some of the setup for the examples are set for SPI0 and some are set for SPI1 yet the wiring listing in "EBC Exercise 12a 2.4 TFT LCD display via SPI" seems to indicate SPI0.  


Cheers,

Jon 

jonnymo

unread,
Sep 13, 2020, 7:32:53 PM9/13/20
to Beagle Board
I was able to resolve the issue I was having with your fb and pygame examples.  I had to ensure the BUS was set to '0' and the pin GPIO values were set properly in 'on.sh'. The same was true in reset.sh with 'busnum=0'

Also, it seemed that if I ran the examples in 'usr', I had to reboot the board for the 'fb' examples to work.

It's all working now.
Nice job.

Jon

Mark A. Yoder

unread,
Sep 16, 2020, 8:47:55 AM9/16/20
to BeagleBoard
Jon:
  Thanks...

I'm thinking of getting rid of reset.sh since on.sh effectively does a reset when you rerun it.

--Mark

Reply all
Reply to author
Forward
0 new messages