Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: johnwmcc on December 09, 2018, 07:50:24 PM
-
After a lot of hassle, i've installed piCore 9.03 on an RPi Zero W, got it to reboot and run WiFi, SSH, a desktop, python3.6, and x11vnc.
I've got onboot.lst to run these of modules on startup.
I've hit a number of roadblocks, which use of Google has mostly (eventually) resolved. Unfortunately, most of the instructions I found for installing piCore on Pi Zero W are incomplete or even inconsistent, but eventually I figured things out and have got most of what I want to do to work.
But I'm stuck, and can't find an answer using Google. I can load python3.6 (using sudo - naughty, I know, but it won't run the IDLE IDE unless I do that). At the python prompt, I get the IDE to run using
>>> import idlelib.idle
I've also run in a terminal the commandtce-load -iw python-RPi.GPIO to install the GPIO module, and put that in onboot.lst too. And if I run it a second time, it tells me it's already loaded.
But python can't find it. A python program using import RPi.GPIO fails, and creates an error.
Using Midnight Commander to search the mounted filesystem can find no file corresponding to a file search pattern of *RPi.GPIO* except .tcz files in tce/optional, anywhere.
What can I do to get GPIO to work in python3?
Is my problem to do with running python with sudo? If so, how do I get IDLE to work without that?
Any help would be welcome. At the moment I'm completely stuck.
-
Hi johnwmcc
According to:
http://tinycorelinux.net/9.x/armv6/tcz/python-RPi.GPIO.tcz.list
that extension contains:
usr/local/lib/python2.7/site-packages/RPi.GPIO-0.6.2-py2.7.egg-info
usr/local/lib/python2.7/site-packages/RPi/_GPIO.so
usr/local/lib/python2.7/site-packages/RPi/GPIO/__init__.py
usr/local/lib/python2.7/site-packages/RPi/__init__.pyIs it possible python3 doesn't know to look under /usr/local/lib/python2.7/ ?
-
I can see that the python2.7 files are there, and also that python 3.6 isn't finding them.
But how do I fix that?
-
Hi johnwmcc
See if Google returns anything useful for PYTHONPATH.
-
I believe that you will have to recompile gpio against python3.6
-
I'm afraid I don't know how to do that. Has no one else done it already?
Where would I find instructions for compiling it, please?
-
Hi johnwmcc
Is there a reason you need Python 3.6? The python.tcz extension is version 2.7 and should work with the GPIO extension.
-
With a friend, we've been working on a routine to control motors and all the code is for python 3.
It worked, more or less, on Raspbian, but there are long delays when interrupts stop feeding back from optical sensors on the motors while other background processes run, so the motors overran.
We wanted to get it working on piCore as there should be a lot less overhead and things going on in the background.
We have tried installing RPi.GPIO for python 3.6 with pip, but it fails with errors I don't understand and can't easily copy here, unfortunately.
The first attempt failed saying gcc was missing, so we installed gcc with
tce-load -iw gcc.tcz.
The next run failed with a different error - compiler couldn't find Python.h.
Do we need to install python3.6-dev.tcz or something like that?
... later
Tried that. Now complaining it can't find limits.h.
At this point, I'm afraid, we are inclined to put piCore in the 'too difficult' pile.
-
see:
http://repo.tinycorelinux.net/8.x/armv6/tcz/src/python-RPi.GPIO/
-
Hi johnwmcc
You need compiletc.tcz. This will give you a proper toolchain for compiling. You probably need python3.6-dev.tcz. There is
a build script for python-RPi.GPIO.tcz that may be of some help located here:
http://tinycorelinux.net/8.x/armv6/tcz/src/python-RPi.GPIO/python-RPi.GPIO.build
You'll probably need to adjust some of the variable assignments such as SRCNAM, WRKDIR, etc.
-
Thank you - both responses from Juanito and Rich crossed with my making an edit to my previous post, so I hadn't seen them.
We'll have to stop for the moment, but will resume when possible.
-
Hi johnwmcc
... Tried that. Now complaining it can't find limits.h. ...
Installing compiletc.tcz will fix that.
-
python3.6-RPi.GPIO posted to piCore 9.x armv6/armv7 repos (not tested)
-
Many thanks. That's solved that problem, and we can now run the motors.
But in the switch from running the ZeroW with a monitor, mouse and keyboard, to running it headless using VNC, the screen resolution for the VNC connection has dropped from the monitor resolution of full HD 1920 x 1080 to an unusably small 600 x 480 or maybe 800 x 600. When the monitor was still plugged in, VNC gave us full HD. Now it doesn't, now the monitor is no longer plugged in.
Google search has not found us a way to increase this - posts refer either to changing Windows screen resolution, or an option in VNC preferences which doesn't exist on the piCore version of the server or in the client connected to it.
There's also a reference to uncommenting an entry hdmi_force_hotplug=1 in a /boot/config.txt file, and the file (never mind the option) doesn't seem to exist on the piCore file system.
Any suggestions for where else to look? Can't find anything relevant in /etc/X11 or other plausible /etc files.
Both of us have limited linux knowledge, and very little specific to piCore.
Thanks again if anyone can help us with this (we hope) final hurdle!
-
Hi johnwmcc
There's also a reference to uncommenting an entry hdmi_force_hotplug=1 in a /boot/config.txt file, and the file (never mind the option) doesn't seem to exist on the piCore file system.
If you do this:
sudo mount /dev/mmcblk0p1 /mnt/mmcblk0p1Is config.txt found when executing this:
ls /mnt/mmcblk0p1
Any suggestions for where else to look? Can't find anything relevant in /etc/X11 or other plausible /etc files.
Googling for this:
x11vnc resolution no monitorreturned a lot of results. A thread on the archlinux forum suggested that tigervnc might be easier to set up.
-
Thank you again, Rich.
Busy most of this evening but will follow up either late tonight or some time tomorrow
-
Tried that, found config.txt, uncommented hdmi_force_hotplug=1, and rebooted.
Sorry, but no difference - still the same low resolution.
Will follow up on other suggestions late tonight or tomorrow - have to stop now.
-
Still stuck.
Found and edited context.txt. Can't change the resolution that way as far as I can see.
Tried uncommenting in turn:
no display
hdmi_force_hotplug=1
hdmi_safe
Resolution stubbornly stuck at low or very low.
Searched Apps for 'vnc' and get only two results - one for tigervnc viewer, and x11vnc as the only server available in .tcz form.
Are there other vnc servers that will run on piCore? If so, where can one find them?
Tried tigervnc viewer 64bit on Windows.
The program has options to set the display resolution directly and also to 'resize remote session to local window'.
Tried two different resolutions - both 1024x768 (the default) and 1920x1080. Also tried 'resize..' to local window.
Neither works to enlarge the remote window - it just scales up the low res screen to a bigger view size, but gives no more effective resolution.
Anything else to try?
I've looked on this page: http://www.karlrunge.com/x11vnc/x11vnc_opts.html
It suggests using either -geometry widthxheight or equivalently -scale widthxheight parameters when starting x11vnc server.
This doesn't change the resolution at the remote end, and just scales it up to that size on the viewer screen.
I notice that it does say at the top 'allow VNC connections to real X11 displays' (my emphasis).
Does this mean it can't set a resolution when running headless (no 'real' display)?
It was all working fine when there was a real monitor with Full HD resolution plugged in, but that isn't a realistic option for the intended end use.
Can anyone offer any further help before we just give up on this distro?
It is all proving an order of magnitude more difficult than we expected or can cope with.
Perhaps I should start a new topic for the resolution change - it seems to be an unsolved problem?
-
Just before giving up for the night, I tried once more.
Edited config.txt to uncomment hdmi_safe=1 and no display. Commented out again #hdmi_force_hotplug=1
Also uncommented and changed the framebuffer parameters, first to the default 1280x720 then 1920x1080.
This has definitely improved things, but I am now not quite certain which of the changes is taking full effect after I restarted x11vnc with the following command line:
x11vnc -display :0 -many -geometry 1920x1080
That seems to be working well enough to let us get on with debugging the python scripts, which was the original intention of this whole exercise.
Thanks for help that has pointed us in the right directions even if sometimes up apparently dead ends. Without that feedback from you we'd have had to give up days ago.
-
Hi johnwmcc
This has definitely improved things, but I am now not quite certain which of the changes is taking full effect after I restarted x11vnc ...
I suspect it was the frame buffer parameters that made the difference. I saw a post from 2014 on the raspberry pi forum
that said hdmi_force_hotplug=1 should be commented out. It went on to say to run:
fbset -g 1920 1080 1920 1080 16prior to starting X.