Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 01:32 19 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Pi-cromite: V5.05.01

     Page 2 of 4    
Author Message
MikeO
Senior Member

Joined: 11/09/2011
Location: Australia
Posts: 275
Posted: 11:05pm 29 Nov 2018
Copy link to clipboard 
Print this post

Lew , this is my rc.local file

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
/usr/bin/sudo -u pi /usr/bin/screen -dmS screen /home/pi/start.bash
exit 0

Then this is the command to atatch to your running mmbasic session.

pi@raspberrypi:~ $ screen -r


Codenquilts
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1676
Posted: 08:46am 30 Nov 2018
Copy link to clipboard 
Print this post

It still will not boot into screen let alone MM

This is my rc.local file
[code]#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi

/usr/bin/sudo -u pi /usr/bin/screen -dmS screen /home/pi/start.bash

exit 0
[/code]

I have run this command chmod +x start.bash
and the contents of my start.bash file are
[code]cd /home/pi
sudo ./mmbasic[/code]

This is my bash.history file contents
[code]sudo raspi-config
sudo ./mmbasic
(sudo ./mmbasic; ; sudo ./mmbasic; exit
sudo ./mmbasic
sudo shutdown -r now
sudo apt-get update -y
sudo apt-get upgrade -y
wget abyz.me.uk/rpi/pigpio/pigpio.tar
tar xf pigpio.tar
cd PIGPIO
make
sudo make install
cd ..
sudo apt-get install screen
chmod +x start.bash
chmod +x mmbasic
sudo ./mmbasic
screen
screen -D -r
sudo nano /etc/rc.local)
sudo nano /etc/rc.local
sudo shutdown -r now
sudo ./mmbasic
chmod +x start.bash
sudo shutdown -r now
screen -D -r
screen
sudo ./mmbasic
sudo shutdown -r now
screen -D -r
screen
sudo ./mmbasic
sudo shutdown -r now
sudo nano -w /etc/rc.local
chmod +x start.bash
sudo ./mmbasic
screen
screen -r
chmod +x start.bash
sudo shutdown -r now
[/code]

When I reboot the Pi I get nothing at all
If I connect Terra Term, login and run screen -d I get




The AUTORUN.BAS MM program starts the weather program so the SSD1963 would start - that's how I know it's not running even before I try and log into the Pi again
Edited by lew247 2018-12-01
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8605
Posted: 09:17am 30 Nov 2018
Copy link to clipboard 
Print this post

Just set up another pi with no issues.

  Quote  It still will not boot into screen let alone MM

screen won't be there unless mmbasic has run

You do have mmbasic and start.bash in /home/pi ?

Try deleting .options just to get a clean start without autorun. Reboot the pi and then look at what happened in rc.local with the command

systemctl status rc.local.service
Edited by matherp 2018-12-01
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1676
Posted: 11:56am 30 Nov 2018
Copy link to clipboard 
Print this post

Yes I have it in the correct folder
I got this result
I don't know much about linux but the TTY=unknown - isn't that something to do with it trying to communicate with something that isn't there?


It says [quote]Nov 30 11:28:25 raspberrypi sudo[467]: root : TTY=unknown ; PWD=/ ; USER=pi ; COMMAND=/usr/bin/screen -dmS screen /home/pi/start.bash[/quote]



Edited by lew247 2018-12-01
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8605
Posted: 01:38pm 30 Nov 2018
Copy link to clipboard 
Print this post

This is what I get:




Did you try deleting .options and disabling autorun so MMBasic can just start at the command prompt? screen will not stay running if MMBasic doesn't start
Edited by matherp 2018-12-01
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1676
Posted: 02:05pm 30 Nov 2018
Copy link to clipboard 
Print this post

Yep
Tried it all
I just this second deleted the .options again
made sure autorun was off
started screen loaded MM
CTRL Z to exit MM
then sudo shutdown -r now so the Pi rebooted

After it rebooted I opened Terra Term again
SSH'd to the Pi
typed systemctl status rc.local.service
and I got the exact same as before

I then typed screen -r and I got "there is no screen to be resumed."
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3027
Posted: 02:26pm 30 Nov 2018
Copy link to clipboard 
Print this post

If from the linux command line you type: ps -A -f | grep mmbasic

do you get anything but the grep command?

I started my program from the command line, not in rc.local, with:

sudo screen ./mmbasic g2.bas

After the puTTY session times out overnight, I can restart with this:

sudo screen -r

Then I can see the last approximately 60 lines of my output (based on the height of the puTTY terminal window).

Possibly I could reverse screen and sudo in the startup command and do without "sudo" when I restart. I'll test that later.
Edited by lizby 2018-12-02
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1676
Posted: 04:08pm 30 Nov 2018
Copy link to clipboard 
Print this post

  lizby said   If from the linux command line you type: ps -A -f | grep mmbasic
do you get anything but the grep command?

pi@raspberrypi:~ $ ps -A -f | grep mmbasic
pi 1549 1531 0 16:07 pts/0 00:00:00 grep --color=auto mmbasic
pi@raspberrypi:~ $

That's what I get
I've no idea what it means

EDIT:
I've just run screen then ran MM
I then pressed CTR Z to exit back to the Pi
I then typed screen -r and I got "There is no screen to be resumed."

I thought pressing CTRL Z would exit MM and leave screen running?
Edited by lew247 2018-12-02
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3027
Posted: 04:49pm 30 Nov 2018
Copy link to clipboard 
Print this post

Getting back only the "grep" line when you do "ps -A -f" means that you do not have mmbasic running.

Ctrl-z exits mmbasic, doesn't leave it running. If you shut down your terminal (puTTY or Teraterm) while mmbasic is running, then when you re-open the terminal, mmbasic will still be running, but you won't be connected to its console output.

From the linux command line, run "ps -A -f" to see every task that is running. If you have an mmbasic task, does it show with it "screen" or "SCREEN"? If it does, then you should be able to do "screen -r" to reconnect to it.

You can have as many ssh sessions into the pi as you want, so with a second session you can do stuff at the linux command line while mmbasic is running.
Edited by lizby 2018-12-02
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1676
Posted: 05:21pm 30 Nov 2018
Copy link to clipboard 
Print this post

  lizby said  
Ctrl-z exits mmbasic, doesn't leave it running.


I knew that - BUT it should leave "screen" running

It's the autostart of MM that I can't get working.

If MM is running and the Pi reboots MM won't restartEdited by lew247 2018-12-02
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8605
Posted: 05:36pm 30 Nov 2018
Copy link to clipboard 
Print this post

  Quote  I knew that - BUT it should leave "screen" running


No it doesn't. screen is linked to the task mmbasic, if mmbasic terminates screen terminates. I think this may be the root of the problem. For whatever reason mmbasic is not keeping running on your machine
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1676
Posted: 08:18pm 30 Nov 2018
Copy link to clipboard 
Print this post

I'm now confused
If screen and mm basic is running I can close Terra Term and the program keeps running
In the instructions in Appendix G it says
exit mmbasic (ctrl-Z)
Finally reboot the pi (sudo shutdown -r now") and when it reboots your MMBasic program will be running

IF screen and MM both close when you press ctrl-Z - doesn't that contradict what you just said?

or am I getting totally confused somewhere?
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3027
Posted: 09:32pm 30 Nov 2018
Copy link to clipboard 
Print this post

If you reboot the pi, nothing but system tasks will be running unless you have started something in rc.local. Post the result of "cat /etc/rc.local".

If you have tried to start something but there is a mistake in your syntax or an error in the program, it won't work.

Also post the output from "ps -A -f" after rebooting. This will show what tasks are running.

Edited by lizby 2018-12-02
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1676
Posted: 11:05pm 30 Nov 2018
Copy link to clipboard 
Print this post

cat /etc/rc.local result
[quote]pi@raspberrypi:~ $ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi

/usr/bin/sudo -u pi /usr/bin/screen -dmS screen /home/pi/start.bash

exit 0[/quote]

CONTENT of /etc/rc.local
[quote]#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi

/usr/bin/sudo -u pi /usr/bin/screen -dmS screen /home/pi/start.bash

exit 0
[/quote]

[quote]pi@raspberrypi:~ $ ps -A -f
UID PID PPID C STIME TTY TIME CMD
root 1 0 5 22:59 ? 00:00:03 /sbin/init
root 2 0 0 22:59 ? 00:00:00 [kthreadd]
root 3 2 0 22:59 ? 00:00:00 [kworker/0:0]
root 4 2 0 22:59 ? 00:00:00 [kworker/0:0H]
root 5 2 0 22:59 ? 00:00:00 [kworker/u2:0]
root 6 2 0 22:59 ? 00:00:00 [mm_percpu_wq]
root 7 2 0 22:59 ? 00:00:00 [ksoftirqd/0]
root 8 2 0 22:59 ? 00:00:00 [kdevtmpfs]
root 9 2 0 22:59 ? 00:00:00 [netns]
root 10 2 0 22:59 ? 00:00:00 [kworker/0:1]
root 11 2 0 22:59 ? 00:00:00 [khungtaskd]
root 12 2 0 22:59 ? 00:00:00 [oom_reaper]
root 13 2 0 22:59 ? 00:00:00 [writeback]
root 14 2 0 22:59 ? 00:00:00 [kcompactd0]
root 15 2 0 22:59 ? 00:00:00 [crypto]
root 16 2 0 22:59 ? 00:00:00 [kblockd]
root 17 2 0 22:59 ? 00:00:00 [watchdogd]
root 18 2 0 22:59 ? 00:00:00 [rpciod]
root 19 2 0 22:59 ? 00:00:00 [xprtiod]
root 20 2 0 22:59 ? 00:00:00 [kworker/u2:1]
root 22 2 0 22:59 ? 00:00:00 [kswapd0]
root 23 2 0 22:59 ? 00:00:00 [nfsiod]
root 33 2 0 22:59 ? 00:00:00 [kthrotld]
root 34 2 0 22:59 ? 00:00:00 [iscsi_eh]
root 35 2 0 22:59 ? 00:00:00 [dwc_otg]
root 36 2 0 22:59 ? 00:00:00 [DWC Notificatio]
root 37 2 0 22:59 ? 00:00:00 [vchiq-slot/0]
root 38 2 0 22:59 ? 00:00:00 [vchiq-recy/0]
root 39 2 0 22:59 ? 00:00:00 [vchiq-sync/0]
root 40 2 0 22:59 ? 00:00:00 [vchiq-keep/0]
root 41 2 0 22:59 ? 00:00:00 [SMIO]
root 42 2 0 22:59 ? 00:00:00 [irq/86-mmc1]
root 43 2 0 22:59 ? 00:00:00 [kworker/0:2]
root 44 2 0 23:00 ? 00:00:00 [kworker/0:3]
root 45 2 0 23:00 ? 00:00:00 [mmcqd/0]
root 46 2 0 23:00 ? 00:00:00 [jbd2/mmcblk0p2-]
root 47 2 0 23:00 ? 00:00:00 [ext4-rsv-conver]
root 48 2 0 23:00 ? 00:00:00 [ipv6_addrconf]
root 63 2 0 23:00 ? 00:00:00 [kworker/0:1H]
root 78 1 1 23:00 ? 00:00:01 /lib/systemd/systemd-journald
root 101 1 1 23:00 ? 00:00:00 /lib/systemd/systemd-udevd
root 114 2 0 23:00 ? 00:00:00 [kworker/u2:2]
root 157 2 0 23:00 ? 00:00:00 [cfg80211]
root 159 2 0 23:00 ? 00:00:00 [brcmf_wq/mmc1:0]
root 160 2 0 23:00 ? 00:00:00 [brcmf_wdog/mmc1]
systemd+ 188 1 0 23:00 ? 00:00:00 /lib/systemd/systemd-timesyncd
message+ 215 1 0 23:00 ? 00:00:00 /usr/bin/dbus-daemon --system --
root 221 1 0 23:00 ? 00:00:00 /usr/sbin/rsyslogd -n
nobody 225 1 0 23:00 ? 00:00:00 /usr/sbin/thd --triggers /etc/tr
root 227 1 0 23:00 ? 00:00:00 /lib/systemd/systemd-logind
avahi 241 1 0 23:00 ? 00:00:00 avahi-daemon: running [raspberry
root 246 1 0 23:00 ? 00:00:00 /usr/sbin/cron -f
avahi 256 241 0 23:00 ? 00:00:00 avahi-daemon: chroot helper
root 335 1 0 23:00 ? 00:00:00 wpa_supplicant -B -c/etc/wpa_sup
root 355 2 0 23:00 ? 00:00:00 [kworker/u3:0]
root 356 1 0 23:00 ? 00:00:00 /usr/bin/hciattach /dev/serial1
root 357 2 0 23:00 ? 00:00:00 [kworker/u3:1]
root 358 2 0 23:00 ? 00:00:00 [kworker/u3:2]
root 362 1 0 23:00 ? 00:00:00 /usr/lib/bluetooth/bluetoothd
root 373 2 0 23:00 ? 00:00:00 [kworker/0:4]
root 467 1 0 23:00 ? 00:00:00 /sbin/dhcpcd -q -w
root 480 1 0 23:00 ? 00:00:00 /usr/sbin/sshd -D
root 494 1 0 23:00 tty1 00:00:00 /bin/login -f
pi 504 1 0 23:00 ? 00:00:00 /lib/systemd/systemd --user
pi 507 504 0 23:00 ? 00:00:00 (sd-pam)
pi 512 494 1 23:00 tty1 00:00:00 -bash
root 580 480 1 23:00 ? 00:00:00 sshd: pi [priv]
pi 591 580 0 23:00 ? 00:00:00 sshd: pi@pts/0
pi 594 591 2 23:00 pts/0 00:00:00 -bash
pi 615 594 0 23:01 pts/0 00:00:00 ps -A -f[/quote]

Proof rc.local exists and is in the correct location


Edited by lew247 2018-12-02
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3027
Posted: 12:18am 01 Dec 2018
Copy link to clipboard 
Print this post

List the contents of start.bash with "cat start.bash" in your /home/pi directory. This is what actually starts mmbasic. Make sure you have made it executable with "chmod +x start.bash".

Start mmbasic and enter "OPTION LIST" and "LIST" so we can see that you have AUTORUN on and what your program looks like (PRINT "Hello, world" will do).

Even with no program, mmbasic should be started if you have a proper start.bash file.



PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1676
Posted: 10:51am 01 Dec 2018
Copy link to clipboard 
Print this post

pi@raspberrypi:~ $ cat start.bash
cd /home/pi
sudo ./mmbasicpi@raspberrypi:~ $

[quote]
Shouldn't the start.bash file be somewhere else? How does the Pi know to look in the home/pi folder for it?
[/quote]



if I load "AUTORUN.BAS" it says
Error: Expected a string

IF I load "autorun.bas" it "seems to load" but when I LIST it does nothing.

but I can load and list other programs

Edited by lew247 2018-12-02
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8605
Posted: 01:20pm 01 Dec 2018
Copy link to clipboard 
Print this post

I've tried every combination and can't replicate the issues you are seeing.

To go back to basics on the Pi:

to autorun a program run mmbasic and set

OPTION AUTORUN ON


This only needs doing once and the option is then stored in the hidden file .options. Including the statement in a program is pointless and just wears the disk unnecessarily but does not cause a problem.

With this option set when mmbasic is started it will attempt to load and run the file AUTORUN.BAS - note the filename is case sensitive. Remember, unlike the Micromite, there is no "saved" program in the Pi. The program must be loaded from disk so the file AUTORUN.BAS must exist in the same directory as the mmbasic executable.

To load the file manually in MMBasic

LOAD "AUTORUN.BAS"


The filename is enclosed in quotes like any other string.

The directory /home/pi must contain as a minimum:
  Quote  mmbasic
start.bash
AUTORUN.BAS


all filenames are case sensitive, mmbasic and start.bash must be set as executable (chmod +x filename).

You can also choose the program to be run when you start MMBasic using the syntax

sudo ./mmbasic filename.bas


Note in this case there are no quotes around the filename. Using this syntax overides the autorun option so filename.bas will be run rather than AUTORUN.BAS. This syntax can be used in start.bash and works perfectly overriding the need for option autorun.

I'm not sure what more help we can give you. If you follow the instructions with a clean install and DO NOTHING ELSE it will work as detailed above. For example, do not alter peripheral settings in raspi-config for things like SPI, I2C, or UART.

 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3027
Posted: 01:28pm 01 Dec 2018
Copy link to clipboard 
Print this post

  lew247 said   pi@raspberrypi:~ $ cat start.bash
cd /home/pi
sudo ./mmbasicpi@raspberrypi:~ $
[/quote]
I trust this is a cut and paste error. The last line in start.bash should be just "sudo ./mmbasic"

If you do "ls -l start.bash", does it show it to be executable?

If after "ps -A -f" shows that there is no mmbasic running, if you do "screen /home/pi/start.bash", does mmbasic run?

If you end up at the linux prompt (or from another ssh session), try another "ps -A -f" to show that mmbasic now is running?

If from the linux command line you can see that mmbasic is running, close the terminal session that has mmbasic running (prompt is showing after Ctrl-c, for instance, or output from your program), restart it, check that you have a screen session with "screen -ls", and try to reconnect with "screen -r".

Edited by lizby 2018-12-02
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1676
Posted: 09:45am 06 Dec 2018
Copy link to clipboard 
Print this post

New Subject:

Pi Zero W with an SSD1963 7 inch display

Can I also use a serial LCD module such as



IF it's possible do I connect the pins to the SPI pins as labelled on the manual for the Picromite
21 SPI in to LODA
19 SPI out to DOUT
23 SPI-CLK to CLK

I'm not sure if you can have 2 "displays" at once, or if I have to the the PI spi pins or the ones labelled in the manual
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8605
Posted: 09:53am 06 Dec 2018
Copy link to clipboard 
Print this post

Easiest is to connect to three unused pins and bitbang the SPI as it is very low volume. MAX7219 does not have a CS pin so can't share and SPI bus.Edited by matherp 2018-12-07
 
     Page 2 of 4    
Print this page
© JAQ Software 2024