WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Using RPi sensehat on picore 8  (Read 2135 times)

Offline Linkan

  • Newbie
  • *
  • Posts: 27
Using RPi sensehat on picore 8
« on: December 14, 2016, 07:45:17 AM »
Hello, I've got a sensehat that I would like to interact with and I am having some issues finding the FB device on my RPi. I installed compiletc.tcz and created a basic program to read from the sensors over i2c. I looked at the source code for RTIMULibDrive11 and the datasheets for HTS221 and LPS25H. I've included the source code as an attachment if anyone is interested (very simple but it gets the job done). Now I want to interact with the 8x8 RGB led matrix and looked at the source code for the sense hat on github.com, it is written in python but I was still able to understand it. On line 173 I found this code:
Code: [Select]
for fb in glob.glob('/sys/class/graphics/fb*'):I looked for `RPi-Sense FB` in /sys/class/graphics/fb0 and couldn't find it so I realized I needed to enable the rpi-sense overlay in config.txt

I added this to config.txt (under [ALL]):
Code: [Select]
[ALL]                         
dtoverlay=rpi-sense           
dtdebug=1

I also copied the following kernel modules from http://tinycorelinux.net/8.x/armv6/releases/RPi/src/kernel/4.4.20-piCore%2B_modules.tar.xz to /lib/modules:
- modules/4.4.20-piCore+/kernel/drivers/mfd/rpisense-core.ko
- modules/4.4.20-piCore+/kernel/drivers/input/joystick/rpisense-js.ko
- modules/4.4.20-piCore+/kernel/drivers/video/fbdev/rpisense-fb.ko

I put the modules in a tcz package and installed it on my system.  Not sure how I can see if the rpi-sense overlay is enabled.

Has anyone got an idea on what I have missed? I can't find the FB device on my RPi zero.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1078
Re: Using RPi sensehat on picore 8
« Reply #1 on: December 14, 2016, 09:25:30 AM »
The overlay will just load the modules for you.  You can still use standard module tools

use lsmod to list installed modules

modprobe to load modules

Offline Linkan

  • Newbie
  • *
  • Posts: 27
Re: Using RPi sensehat on picore 8
« Reply #2 on: December 14, 2016, 09:48:13 AM »
Of course... I didn't realize the modules were not loaded on boot. However there is still an issue when trying to load `rpisense-fb`. After running these commands:
Code: [Select]
tc@box:~$ sudo modprobe rpisense-core
tc@box:~$ sudo modprobe rpisense-js
tc@box:~$ sudo modprobe rpisense-fb
I get the following error:
Code: [Select]
modprobe: can't load module rpisense-fb (kernel/drivers/video/fbdev/rpisense-fb.ko): unknown symbol in module, or unknown parameter
The output of dmesg is:
Code: [Select]
[  141.774669] rpisense_fb: Unknown symbol fb_sys_write (err 0)
[  141.774726] rpisense_fb: Unknown symbol sys_imageblit (err 0)
[  141.774763] rpisense_fb: Unknown symbol sys_fillrect (err 0)
[  141.774867] rpisense_fb: Unknown symbol sys_copyarea (err 0)
[  141.774923] rpisense_fb: Unknown symbol fb_sys_read (err 0)

Perhaps there is a module I forgot to copy?

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1078
Re: Using RPi sensehat on picore 8
« Reply #3 on: December 14, 2016, 10:35:22 AM »
There could be another dependency,  use modinfo to look at each module and see what dependencies there are.

Offline Linkan

  • Newbie
  • *
  • Posts: 27
Re: Using RPi sensehat on picore 8
« Reply #4 on: December 14, 2016, 10:46:03 AM »
Output from modinfo /lib/modules/4.4.20-piCore\+/kernel/drivers/video/fbdev/rpisense-fb.ko:
Code: [Select]
filename:       /lib/modules/4.4.20-piCore+/kernel/drivers/video/fbdev/rpisense-fb.ko
license:        GPL
author:         Serge Schneider <serge@raspberrypi.org>
description:    Raspberry Pi Sense HAT framebuffer driver
alias:          of:N*T*Crpi,rpi-sense-fb*
alias:          platform:rpi-sense-fb
srcversion:     FC554BC5F2903919A643A1E
depends:        fb_sys_fops,sysfillrect,syscopyarea,sysimgblt,rpisense-core
vermagic:       4.4.20-piCore+ mod_unload modversions ARMv6
parm:           lowlight:Reduce LED matrix brightness to one third
Awesome, thanks for the help. I also installed the dependencies and now I can interact with the sense hat RGB led matrix. The `/dev/fb1` file now exists.

Offline marinux

  • Newbie
  • *
  • Posts: 6
Re: Using RPi sensehat on picore 8
« Reply #5 on: May 24, 2017, 05:24:13 PM »
Bonjour,
I am also interested to get data from sense hat. As I created a specialized marine OS version for x86 (http://marinux.tuxfamily.org), I am cooking a Raspberry version Debian , using sense hat as a navigational device. I have wrote a script using RTImullibDrive11 to output, compass, atmospheric pressure, hygrometer, pitch and roll in NMEA format.
Yes, this version run, but every year I find Linux conventionnal distros more and more heavy and complicate, I would like use TinyCore Linux for this version (small is beautifull !), but compile RTImullibDrive11 and sense hat modules is above my level.
Is somebody has an idea, doc, howto, to realize this project ?
Amicalement - Frank