Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 13:18 04 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 : Introducing the Pi-cromite: first steps

     Page 14 of 16    
Author Message
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5913
Posted: 07:26pm 21 Jun 2017
Copy link to clipboard 
Print this post

  matherp said  
So, if you have a Pi 3 please could you test serial output for me. First try the release as delivered (WAVETIME=1.0). If that doesn't work (i.e. you get garbled output) try 1.128.

If that also doesn't work and you have access to an oscilloscope or logic analyser please try the following:

open "COM1:1000" as #1
do
print #1,"U";
loop


Please also let me know the exact version of the Pi 3 you are testing on - mine is the Pi 3 Model B V1.2 and MM.DEVICE$ reports A02082

Thanks for any and all help on this one.


Pi 3 B V1.2 and MM.DEVICE$ reports A02082 - same as yours.
With the default settings ( no options set), I measure 100mS bit length.

Jim
VK7JH
MMedit   MMBasic Help
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5913
Posted: 08:09pm 21 Jun 2017
Copy link to clipboard 
Print this post

Playing with a USB TTL adapter

  Quote   ' serial test program
System "stty -F /dev/ttyUSB0 38400"
OPEN "/dev/ttyUSB0" FOR random AS #5 ' open the serial port
PRINT #5, "HELLO!!! Is anyone out there?"
DO ' prefered way to recieve serial data which might not be there!
k$ = INPUT$(1,#5)
IF k$="" THEN
nodata=nodata+
1
ELSE
result$=result$+k$
PRINT ASC(k$),result$
nodata=
0
ENDIF
PAUSE 20
LOOP UNTIL k$=CHR$(10)OR nodata=50 ' 50*20ms = 1 second timeout
DO
PRINT #5, "U";
LOOP

CLOSE #5


The SYSTEM command can be used to change the baud rate of the attached adapter.
The adapter defaulted to 9600 baud and was successfully changed.
I haven't tried any other options with the stty command. Changing baud rate should be enough for most users. The stty settings seem to be 'sticky' but I would put them in my program 'just in case'

I tried to run SYSTEM "dmesg | grep tty" from the mmbasic prompt but was kicked out of mmbasic with an error.

Edit : The previous post should read 1mS bit length, not 100mS. We are not THAT slow down under.
Edited by TassyJim 2017-06-23
VK7JH
MMedit   MMBasic Help
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 09:41pm 21 Jun 2017
Copy link to clipboard 
Print this post

  Quote  Settings in .options are not stored in ASCII format, correct?


Correct, they are in normal binary representation


  Quote  So, when I use the internal editor and store the Programm it is lost when I exit mmbasic?


"Save" in the editor moves the program from the edit buffer and "saves" it in normal RAM ready for execution. Unlike the Micromite, the Raspberry Pi always has a SD card available so, to save for next time, it is just a matter of saving to disk once you have exited the editor.

  Quote  With the default settings ( no options set), I measure 1mS bit length.


Thanks Jim, your Pi obviously works perfectly, I somehow need to track down the difference in my setup. Do you have an HDMI monitor connected?
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5913
Posted: 09:50pm 21 Jun 2017
Copy link to clipboard 
Print this post

  matherp said  
Thanks Jim, your Pi obviously works perfectly, I somehow need to track down the difference in my setup. Do you have an HDMI monitor connected?


Raspbian Jessie Lite without any keyboard or monitor.
I only ever connect with Teraterm (or WinSCP).

Jim
VK7JH
MMedit   MMBasic Help
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 02:38am 22 Jun 2017
Copy link to clipboard 
Print this post

@ Tassy Jim

Precisely which PiMiteBasic download are you using ?
I haven't kept up, and the latest ones give me screen garbage :(
I want to try what you did but with MIDI baudrate .
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 03:02am 22 Jun 2017
Copy link to clipboard 
Print this post

  Quote  I haven't kept up, and the latest ones give me screen garbage :(
#

Later releases use an additional library

Try installing

[code]sudo apt-get install libncurses5-dev[/code]

This change was introduced on page 14 of the thread to support the EDIT command in full colour
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 05:11am 22 Jun 2017
Copy link to clipboard 
Print this post

Thank You matherp ....
Same problem
goes back to 5.3.a23 .........a22 OK

Pi 3 w/hdmi/keyboard/mouse
to start : (term)
$ cd /home/pi/Downloads
$ chmod +x mmbasic
$ ./mmbasic
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 05:24am 22 Jun 2017
Copy link to clipboard 
Print this post

you must use

sudo ./mmbasic
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 06:05am 22 Jun 2017
Copy link to clipboard 
Print this post

Do not need 'sudo' up to (including)a22
If I use it now takes me nowhere (back @ prompt) ???
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 06:18am 22 Jun 2017
Copy link to clipboard 
Print this post

You definitely need sudo now.

I've had this issue with going to the @ prompt and it is probably that .options has been corrupted with the failed starts

So:
make sure you have version 64 of pigpio installed (2nd post page 19)
delete mmbasic
delete .options
reboot
recopy mmbasic
run with sudo


If you change versions ALWAYS delete .options before running any new versionEdited by matherp 2017-06-23
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 06:42am 22 Jun 2017
Copy link to clipboard 
Print this post

DdduuuuuuuuuhhH ..................
Where do I find " .options "
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 09:16am 22 Jun 2017
Copy link to clipboard 
Print this post

  Quote  Where do I find " .options "


Same place as mmbasic. It is a hidden file just go

rm .options


and Linux will prompt for confirmation
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 11:03am 22 Jun 2017
Copy link to clipboard 
Print this post

O.K........
Worked once but wouldn't work again
I hadn't rebooted
When I tried, RPi wouldn't boot
(someways contaminated SD)
Lucky I had spare SD

Request: way to break out of running loop .....
Like Ctrl-Break in GW-Basic

I seemed to be writing to synth,
but no sound ????
Nice ...... I will dance at your wedding
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 12:28pm 22 Jun 2017
Copy link to clipboard 
Print this post

  Quote  Request: way to break out of running loop .....


ctrl-C ?

Then use ctrl-Z to exit mmbasic

Never just close the terminal session without exiting mmbasic or the program will be left running and you will have to "kill" the mmbasic processes (2) or reboot before you can run it again
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 03:09pm 22 Jun 2017
Copy link to clipboard 
Print this post

> ctrl-C ?

Right ..... I've forgotten my MM stuff

> make sure you have version 64 of pigpio installed (2nd post page 19)
> delete mmbasic
> delete .options
> reboot
> recopy mmbasic ( re - unzip ? )
> run with sudo

All between each session ?
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5913
Posted: 03:28pm 22 Jun 2017
Copy link to clipboard 
Print this post

  hitsware said  
> make sure you have version 64 of pigpio installed (2nd post page 19)
> delete mmbasic
> delete .options
> reboot
> recopy mmbasic ( re - unzip ? )
> run with sudo

All between each session ?

No
only when you install a new version.

Always start mmbasic with sudo ./mmbasic and always exit mmbasic with ^Z

If mmbasic has crashed, you might have problems restarting mmbasic in which case restarting the Pi will help (just like with Windows programs)

With the more recent versions on mmbasic, I get fewer crashes and mmbasic seems to be better at recovering.

Jim
VK7JH
MMedit   MMBasic Help
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 03:45pm 22 Jun 2017
Copy link to clipboard 
Print this post


System "stty -F /dev/ttyUSB0 31250"
OPEN "/dev/ttyUSB0" FOR random AS #5 ' open the serial port
PRINT #5, "HELLO!!! Is anyone out there?"

Thank You Jim ..... While you're handy
(you answered this long ago but I don't remember
and can't find with search)

What do I do with the PRINT to simply send integer bytes ?
Maybe Matherp will do a WRITEBYTE or PRINTBYTE ?
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5913
Posted: 04:28pm 22 Jun 2017
Copy link to clipboard 
Print this post

  hitsware said  
System "stty -F /dev/ttyUSB0 31250"
OPEN "/dev/ttyUSB0" FOR random AS #5 ' open the serial port
PRINT #5, "HELLO!!! Is anyone out there?"

Thank You Jim ..... While you're handy
(you answered this long ago but I don't remember
and can't find with search)

What do I do with the PRINT to simply send integer bytes ?
Maybe Matherp will do a WRITEBYTE or PRINTBYTE ?


  Quote   ' a is the integer to send 0 to 255
PRINT #5, CHR$(a);


don't forget to suppress the cr with ;


VK7JH
MMedit   MMBasic Help
 
RonnS
Senior Member

Joined: 16/07/2015
Location: Germany
Posts: 120
Posted: 07:06am 23 Jun 2017
Copy link to clipboard 
Print this post

hello Peter, hello at all,

good news,.. my code for a PiCromite Remote Control is running an working - Once to test the possibilities

using option wavetime 1.3 to tweak the pulselenghts
it now working together with all my "Smartwares" Unites and a cheap 12V Ledstripe Controller, see my old smart home thread too

regards Ron

2017-06-23_170310_PCRC_W.zip Edited by RonnS 2017-06-24
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 10:36am 23 Jun 2017
Copy link to clipboard 
Print this post

Hi Peter

I have the same version PI3 as you A22082
Serial out is garbled but if i use OPTION WAVETIME 1.128 the program in memory gets erased. If i reload the program and run it it gets erased. To resolve the issue i deleted the options file reboot then it works. Readding the OPTION WAVETIME 1.128 produces the same wierdness

Regards
Jman
 
     Page 14 of 16    
Print this page
© JAQ Software 2024