Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:15 01 Aug 2025 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.04.21: Serial Console

     Page 1 of 2    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 10:42am 23 Sep 2018
Copy link to clipboard 
Print this post

Please find attached Version 5.04.21 for Stretch

2018-09-23_232033_mmbasicstretch.zip

and for Jessie

2018-09-23_231328_mmbasicjessie.zip

Manual

2018-09-23_220543_Pi-cromite_Manual.pdf

Please delete the options file before running this new release

rm .options


This version solves the issue of running MMBasic automatically at boot time and makes the Pi-Zero in particular much more useful as a pseudo embedded processor.

There is one new OPTION command to do this:

OPTION SERIAL CONSOLE n


This sets the device to be used as the MMBasic console device. By default this is 0 which is the terminal used to start the process. Alternatives are 1 and 2. Selecting one of these sets the console to use the COM1 or COM2 port on the Pi header. Changing the selection will automatically terminate MMBasic and it can be restarted. With the console set to COM1 or COM2 it is possible to run MMBasic as a background process using the Linux command:

sudo ./mmbasic &>/dev/null &

This can then easily be included as part of the boot process by adding the following lines to /etc/rc.local

echo “Starting MMBasic”
cd /home/pi
sudo ./mmbasic &>/dev/null &



This will automatically run MMBasic on a “Pi” at boot time as a pseudo embedded application and if OPTION AUTORUN is set and the file “AUTORUN.BAS” exists then the Pi-cromite will load and start automatically (remember filenames are case sensitive).
A standard USB/Uart can be used to connect to the configured COM port at anytime to access the MMBasic console.


Edited by matherp 2018-09-24
 
Micro-80
Newbie

Joined: 03/03/2017
Location: Russian Federation
Posts: 26
Posted: 02:27pm 23 Sep 2018
Copy link to clipboard 
Print this post

Very useful function. Thank you!
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 03:46pm 23 Sep 2018
Copy link to clipboard 
Print this post

  matherp said  
This can then easily be included as part of the boot process by adding the following lines to /etc/rc.local


I don't have an rc.local folder?



 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 03:50pm 23 Sep 2018
Copy link to clipboard 
Print this post

  Quote  I don't have an rc.local folder


rc.local is a file

edit it:

sudo nano /etc/rc.local
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 03:56pm 23 Sep 2018
Copy link to clipboard 
Print this post

I didn't realise it was a file sorry

One question, does this mean that you have to use either Com 1 or Com 2 to use autorun?
and you cannot run it wirelessly?

I know this might sound a "stupid" question, but I'd like to be positive in understanding itEdited by lew247 2018-09-25
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 04:43pm 23 Sep 2018
Copy link to clipboard 
Print this post

  Quote  One question, does this mean that you have to use either Com 1 or Com 2 to use autorun?
and you cannot run it wirelessly?


Not sure I understand the question but....

You can always use autorun and whatever the console if set the program will start when MMBasic is fired up.

The issue is that if you run MMBasic from the boot there is no console attached (certainly no SSL connection over wireless) so you have to use various tricks to make Linux think there is a console. By setting the console to use one of the H/W serial ports on the Pi header this whole issue is avoided. If nothing is connected the serial output pin just waggles all by itself and the program runs happily.
It may be you have got round the issue another way but this method works in an obvious way which satisfies my very limited Linux understanding.
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1003
Posted: 07:49am 24 Sep 2018
Copy link to clipboard 
Print this post

Hi Peter,

I am getting the error below in 5.21 but not in 5.20.
Both on a PiZero-W and a Pi3. One Jessie one Stretch

It is around the area of repeated JSON calls to extract data from a large data set.
It fails on the 13th loop with 3 JSON calls in the loop. I have printed MEMORY at loop 12 but normal memory seems OK. If I only have one JSON call in the loop I get 40 iterations before it errors.
Works for 5.20 with no issue.


Error: Not enough memory6

The getFloat function just call JSON. ie.


FUNCTION getFloat(parm$ as STRING, nlv as FLOAT) as FLOAT
local string s=JSON$(a(),parm$)
if s=parm$ or s="" then getFloat=nlv else getFloat=val(s)
end function




Regards
Gerry
Latest F4 Latest H7 FotS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 01:26pm 24 Sep 2018
Copy link to clipboard 
Print this post

The error says it is running out of temporary strings.

I've upped the number in this build. I'm not aware that there was any change recently in this area but please try the attached

2018-09-24_232629_mmbasicjessie.zip

2018-09-24_232642_mmbasicstretch.zip
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 435
Posted: 11:44pm 24 Sep 2018
Copy link to clipboard 
Print this post

Hi peter

I have tested new mmbasic (strech with rpi3B+) with my graphic test prog
everything is good except the test 14 (write text with background transparent)
you have corrected this problem on Armite prog

I have also somes problems with blit and sprite, but maybe it is my own fault

my prog
2018-09-25_094304_test_graph_picromite.zip
 
MikeO
Senior Member

Joined: 11/09/2011
Location: Australia
Posts: 275
Posted: 03:34am 25 Sep 2018
Copy link to clipboard 
Print this post

Hi peter, I have just got back to pi-cromite and loaded the latest version with Option serial Console set it to Com1 and successfully able to talk to the Pi/mmbasic however I find i cannot transfer programs as XMODEM RECEIVE command is not known? Is this correct ore am I missing something? I can transfer the program via winSCP ofcourse is this still the prefered way?

Codenquilts
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1003
Posted: 06:00am 25 Sep 2018
Copy link to clipboard 
Print this post

  matherp said   The error says it is running out of temporary strings.

I've upped the number in this build. I'm not aware that there was any change recently in this area but please try the attached



I am running the Stretch version and it runs OK ie memory6 error is fixed.
I got a segmentation error when trying to run the Jessie version on what I thought was a Jessie Pi3 but I think I may have partly updated to Stretch a couple of weeks ago. The Stretch version was OK.

So looks like it good.

Thanks
Gerry

P.S.
A thing I noticed that maybe only for me or not.(Not specific to 5.21)

Ctrl-Z returns to unix prompt as expected when using
a) a putty remote session
b) a local terminal shelled from the GUI
It does not return if running from the local terminal on the Pi3 i.e when you don't load the GUI or select Exit to CommandLine under the Shutdown menu.
You need to type 'quit'
'quit' will also work in place of Ctrl-Z for cases a) and b) as well.

Latest F4 Latest H7 FotS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 07:27am 25 Sep 2018
Copy link to clipboard 
Print this post

  Quote  however I find i cannot transfer programs as XMODEM RECEIVE command is not known? Is this correct ore am I missing something?


It never made sense to include it before but does now so I'll put it into the next release.

  Quote  It does not return if running from the local terminal on the Pi3 i.e when you don't load the GUI or select Exit to CommandLine under the Shutdown menu.


This may be because Linux traps control codes when running on a local terminal - don't think this is one worth spending too much effort on though - you can try ctrl-D which I included as an alternative exit for some reason (may have been this but can't remember)
 
MikeO
Senior Member

Joined: 11/09/2011
Location: Australia
Posts: 275
Posted: 08:22am 25 Sep 2018
Copy link to clipboard 
Print this post

Thanks Peter but Sorry to add something else! I know from some things I get involved with It's never ending, thanks again and the Pi-cromite is looking an exceptionally good option now for $15.00. Mike
Codenquilts
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 05:19pm 25 Sep 2018
Copy link to clipboard 
Print this post

Please find attached version 5.04.22

2018-09-26_032429_mmbasicstretch.zip

2018-09-26_032749_mmbasicjessie.zip

This fixes a serious bug in string handling found on the Armmite H7. This seems to relate to either a cacheing issue or a bug introduced in a recent compiler update as the bug does not occur on the MM2 or MM+ despite running identical code

This update is highly recommended!Edited by matherp 2018-09-27
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 11:45am 27 Sep 2018
Copy link to clipboard 
Print this post

  matherp said  
This version solves the issue of running MMBasic automatically at boot time and makes the Pi-Zero in particular much more useful as a pseudo embedded processor.

This will automatically run MMBasic on a “Pi” at boot time as a pseudo embedded application and if OPTION AUTORUN is set and the file “AUTORUN.BAS” exists then the Pi-cromite will load and start automatically (remember filenames are case sensitive).


A standard USB/Uart can be used to connect to the configured COM port at anytime to access the MMBasic console.


I'm trying to get my head round this to understand it properly and what I can and cannot do

I've got a Pi-Zero W that I've configured headlessly

Can I set the options you listed in the post and connect to the Pi using a USB cable into the USB port?
Or will this not work and it has to be connected to the GPIO pins?
Or is there a way to do this?

 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 11:53am 27 Sep 2018
Copy link to clipboard 
Print this post

  Quote  Can I set the options you listed in the post and connect to the Pi using a USB cable into the USB port?
Or will this not work and it has to be connected to the GPIO pins?


I've no idea if the USB connection on the Pi-zerro supports CDC mode. If it does (but I suspect not) then you can connect to it and open a terminal session in which you could run MMBasic with OPTION SERIAL CONSOLE set to 0 just like connecting over wifi.

The new functionality allows you specifically to connect a console to the COM ports on the Pi header. It may be of no use to you in which case just ignore it.

The advantage to me is that I can automatically run MMBasic at boot time (with or without AUTORUN) and I can then at any time connect a USB/UART to the COM port in order to interact with MMBasic without any additional complexity.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 12:27pm 27 Sep 2018
Copy link to clipboard 
Print this post

Please find attached minor bug fix to 5.04.22 - no version change

This fixes an issue when you try and print a transparent text character completely off the display area of the graphics screen

2018-09-27_222719_mmbasicstretch.zip

2018-09-27_222734_mmbasicjessie.zip
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 02:54pm 27 Sep 2018
Copy link to clipboard 
Print this post

I can connect to the Pi both with Wifi and the USB cable now
The issue I've got is while the screen and program ran when I removed the USB cable from the Pi it turned off after about 5 seconds
I do have a separate 5V psu connected as well
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 04:33pm 27 Sep 2018
Copy link to clipboard 
Print this post

  Quote  The issue I've got is while the screen and program ran when I removed the USB cable from the Pi it turned off after about 5 seconds


I suspect (based on very limited Linux knowledge) this is Linux timing out the console connection to the MMBasic task and is precisely why I implemented a console on the COM ports
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 05:37pm 27 Sep 2018
Copy link to clipboard 
Print this post

Thanks Peter, I'll get a USB to serial cable and try that instead
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025