Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 11:38 29 Mar 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 4 of 16    
Author Message
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 07:09am 11 Apr 2017
Copy link to clipboard 
Print this post



 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 711
Posted: 11:12am 11 Apr 2017
Copy link to clipboard 
Print this post

So what?
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9030
Posted: 04:41pm 11 Apr 2017
Copy link to clipboard 
Print this post

I think he was just indicating that he got it going on his pi, that's all.
Smoke makes things work. When the smoke gets out, it stops!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5867
Posted: 07:15pm 11 Apr 2017
Copy link to clipboard 
Print this post

More playing, this time with a USB-TTL converter.
  Quote   ' serial test program
OPEN "/dev/ttyUSB0" FOR RANDOM AS #5 ' open the serial port
PRINT #5, "HELLO!!! Is anyone out there?"
DO ' one way to receive serial data which might not be there!
k$ = INPUT$(1,#5)
IF k$="" THEN
nodata=nodata+
1
ELSE
result$=result$+k$
PRINT result$
nodata=
0
ENDIF
PAUSE 20
LOOP UNTIL k$=CHR$(10)OR nodata=50 ' 50*20ms = 1 second timeout
CLOSE #5


There doesn't seem to be a way to change the baud rate yet. My FTDI converter defaulted to 9600 baud.

It seems to need the "FOR RANDOM" bit in there so we think its a file.

A Linux observation - The text is sent with a <LF> only so if you are waiting for the <CR>, you will be disappointed.

So far I have tested with a loopback plug on the serial adapter but there is no reason a micromite couldn't be sitting there.

This version on MMBasic doesn't save your code between sessions so remember to do a SAVE before exiting!

Jim
VK7JH
MMedit   MMBasic Help
 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 03:44am 12 Apr 2017
Copy link to clipboard 
Print this post

Hi,

Should this work on a Model B?

I can get it to run but it crashes the rPi at the mmbasic command prompt.

On a fresh install of Jessie which has pigpio installed already.

Anthony.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8516
Posted: 07:07am 12 Apr 2017
Copy link to clipboard 
Print this post

The pin usage of the early Pis were different. The code should work properly on A+, B+, Pi Zero (W), Pi2B, Pi3B but not currently on Model A, B, or B (revision 2).

This could probably be fixed but isn't something I will look at until I have more of the normal Micromite style I/O working (I2C, SPI, PWM etc.).
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8516
Posted: 03:15am 14 Apr 2017
Copy link to clipboard 
Print this post

Fairly big upgrade 5.3a2 including more "Micromite" functionality





2017-04-14_184056_mmbasic.zip

This now supports hardware SPI using Pi pins 19,21,and 23 with the standard Micromite syntax (SPI OPEN, ? SPI(x), SPI WRITE, SPI READ)

In addition it supports the following SPI displays connected to the same pins (+ user selectable CD, CS, RESET) ILI9341 (320x240), ILI9163 (128x128) , ST7735 (128x160), ILI9481 (480x320). Transparent text and BLIT are available for the ILI9341 display.

Touch is fully implemented and should also be connected to the SPI H/W pins + user selectable IRQ and CS.

The displays and touch are enabled using the standard Micromite syntax (OPTION ...)
Options are saved in the file ".options" in the same directory as the mmbasic executable

GUI TEST LCDPANEL and GUI TEST TOUCH are both implemented (exit using ctrl-C)

All MX470 GUI capability is also implemented and has been tested at a limited level.

as before you need to install pigpio on your Pi if not already installed

[code]sudo apt-get update
sudo apt-get install pigpio python-pigpio python3-pigpio [/code]

and execute mmbasic using

sudo ./mmbasic


Always exit mmbasic using ctrl-z or "quit" to avoid leaving disconnected processes running on the Pi which will interfere with pigpio initialisationEdited by matherp 2017-04-15
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 09:57am 14 Apr 2017
Copy link to clipboard 
Print this post

 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 812
Posted: 11:54am 14 Apr 2017
Copy link to clipboard 
Print this post

...is it possible that's our Pi-cromite doesn't work on a older Raspberry-Pi B? (not B+, Pi2 or Pi3)

It start's but I can't type something in - ctrl-z also doesn't work!

I have some Odroid-W which have the original chipset from the B (but with integrated battery loader and RTC) - they are ideal for battery operation - it would be very nice to have our MMBasic on it...

Frank
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3641
Posted: 12:03pm 14 Apr 2017
Copy link to clipboard 
Print this post

  Frank N. Furter said   ...is it possible that's our Pi-cromite doesn't work on a older Raspberry-Pi B? (not B+, Pi2 or Pi3)

Peter already posted some examples that are not supported, so yes.

(Though when time permits or someone helps then maybe there's nothing too hard to tweak so it would work.)

JohnEdited by JohnS 2017-04-15
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8516
Posted: 01:20am 15 Apr 2017
Copy link to clipboard 
Print this post

More functionality in 5.3a3

2017-04-15_105256_mmbasic.zip

This version includes support for SETPIN CIN, PIN, and FIN which are enabled on physical pins 11,13,15, and 16. Syntax is exactly the same as the Micromite.
I have also allowed the count to be initialised using the PIN command

[code]setpin 11,CIN
? pin(11) : pin(11)=0
[/code]

Accuracy is maintained up to something just over 100KHz

PWM and SERVO are also implemented. The implementation is slightly different from the Micromite to support the Pi hardware, in some ways better, in some ways worse

In both cases you can use any pin for PWM or SERVO and the command sets up one pin at a time - there is no limit on the number of pins used in this way. Frequencies and duty cycles are individually set per pin within the following restrictions:

SPECIAL CASE PIN 12
This has true hardware PWM and the frequency can be set anywhere between 1Hz and 25MHz. Duty cycle is expressed as a percentage (like the Micromite). The underlying clock is 250MHz so with a 25MHz output the duty cycle will move in steps of 25/250 = 10%. At 250Hz the duty cycle will move in steps of 0.0001%

ALL OTHER PINS
These use a PWM based on a 1uS clock and the valid frequencies will be exact divisors of 1,000,000. The maximum frequency is 20KHz where the duty cycle will move in steps of 2%. If a frequency of say 433Hz is input the actual frequency will round to the nearest of:
[quote]1,2,4,5,8,10,16,20,25,32,40,50,80,100,125,160,200,250,400,500,625,800,1000,1250,2000,2500,4000,5000,10000,20000[/quote]
At 50Hz (the fixed frequency for the SERVO command) the duty cycle will be accurate to 1 in 20000 and over the range of 1-2 milliseconds which are valid for a servo the accuracy is therefore 1 in 1000

Syntax:

[code]PWM pin, frequency(Hz), duty-cycle(%)
SERVO pin, milliseconds (1-2)[/code]

Note the SERVO command is fixed 50Hz frequency and only allows "valid" periods in the range of 1 to 2 milliseconds. Of course you can use the PWM command to generate any non-standard servo output but be aware this can damage a servo.
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 02:30am 15 Apr 2017
Copy link to clipboard 
Print this post

> SPECIAL CASE PIN 12
> This has true hardware PWM
> and the frequency can be set
> anywhere between 1Hz and 25MHz.

Can that pin also do variable
baud serial out ?
I.E. Midi ?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8516
Posted: 02:58am 15 Apr 2017
Copy link to clipboard 
Print this post

sorry I don't understand the question or the link to PWM

  Quote  MIDI messages are made up of 8-bit words (commonly called bytes) that are transmitted serially at a rate of 31.25 kbit/s. This rate was chosen because it is an exact division of 1 MHz, the speed at which many early microprocessors operated.[7]:286 The first bit of each word identifies whether the word is a status byte or a data byte, and is followed by seven bits of information.[2]:13–14 A start bit and a stop bit are added to each byte for framing purposes, so a MIDI byte requires ten bits for transmission.[7]:286
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3641
Posted: 03:39am 15 Apr 2017
Copy link to clipboard 
Print this post

  hitsware said   > SPECIAL CASE PIN 12
> This has true hardware PWM
> and the frequency can be set
> anywhere between 1Hz and 25MHz.

Can that pin also do variable
baud serial out ?
I.E. Midi ?

I don't see the relevance of PWM to MIDI.

You could perhaps use a uart/usart (read up to see but I think not) or else bitbang on a gpio. (If doing that, think about timings and consider a driver.)

google suggests people have looked at RPi & MIDI already.

John
 
PicFan
Senior Member

Joined: 18/03/2014
Location: Austria
Posts: 133
Posted: 04:25am 15 Apr 2017
Copy link to clipboard 
Print this post

Hello matherp!

Many Thanks you for your great work, but unfortunately I have a small problem with the new version 15-04-2017.

sudo ./mmbasic
./mmbasic: symbol lookup error: ./mmbasic undefined symbol: gpioSetPad

Unfortunately I am a Raspberry Pi beginner, but the Version 11-04-2017 works ?

Thanks and greetings from Austria

Wolfgang

 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8516
Posted: 05:13am 15 Apr 2017
Copy link to clipboard 
Print this post

Wolfgang

Sounds like you are running a different version of pigpio

Try following instructions here to install the same version as me

Did you get pigpio using apt-get? if so it looks like the version there is out-of-date
 
hitsware
Guru

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

> sorry I don't understand the question or the link to PWM

> I don't see the relevance of PWM to MIDI.

Duh ..... I was thinking of the variable frequencies
vs. set ones.

Is there a pin that will do midi messages ?
( 8-bit words (commonly called bytes) that are
transmitted serially at a rate of 31.25 kbit/s )

 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3641
Posted: 05:32am 15 Apr 2017
Copy link to clipboard 
Print this post

Just use google or the like and read :)

Plenty of people have had an interest in RPi and MIDI.

John
 
hitsware
Guru

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

  JohnS said   Just use google or the like and read :)

Plenty of people have had an interest in RPi and MIDI.

John


Not with MMBasic .
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3641
Posted: 06:03am 15 Apr 2017
Copy link to clipboard 
Print this post

Step 1: read how to get RPi & MIDI working

Step 2: do it from MMBasic (the easy part)

John
 
     Page 4 of 16    
Print this page
© JAQ Software 2024