Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:08 04 Jul 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 : Introducing the Pi-cromite: first steps

     Page 12 of 16    
Author Message
matherp
Guru

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

  Quote  Are PWM outputs 'bitbanged' on the Pi?


See post second from the bottom on page 6
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10197
Posted: 08:27am 12 Jun 2017
Copy link to clipboard 
Print this post

Attached version 5.4.a02

2017-06-12_182528_mmbasic.zip

This now (hopefully) has the GUI changes that Geoff has included in 5.4.04

When a text or number box is touched the pen down interrupt subroutine will now be
called before the keypad is drawn. This gives the programmer the opportunity to redraw non GUI graphics to accommodate the keypad which is about to appear. When the touch is removed the pen up interrupt will be called after the keypad is removed so that any non GUI graphics can be redrawn. This is a key feature in allowing the mixing of non GUI graphics with GUI controls.

The virtual keyboard generated when the user touches a Number Box or a Text Box can
be dismissed by the program using the commands GUI NUMBERBOX CANCEL or GUI TEXTRBOX CANCEL.

Fixed a bug where the blinking of the GUI LED control could disrupt other graphics
operations (like drawing text).
 
jman

Guru

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

Hi Peter

Thanks for the explanation
It's a pity as serial is widley used with sorts of modules.

  Quote  Known issues:
output to serial ports unreliable particularly on pi-zero. This is caused by the operating system disrupting the timing of the bit-banged output. Serial output is usable with a checksum/retry protocol but is not recommended without.


Regards
Jman
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 724
Posted: 10:27am 12 Jun 2017
Copy link to clipboard 
Print this post

Jman, I agree to you.

Non working or unreliable serial ports are for lots of applications a "no go" situation.

Don't understand why the process mmbasic has problems with it.
Why bitbanging, mmbasic could use the standard calls to Linux for communication ?!

THX.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10197
Posted: 10:52am 12 Jun 2017
Copy link to clipboard 
Print this post

  Quote  Don't understand why the process mmbasic has problems with it.
Why bitbanging, mmbasic could use the standard calls to Linux for communication ?!


Gosh I never thought of that

Pi 3 and Pi Zero W use the only true UART for bluetooth. There is also a mini-UART (pins 8 and 10) but this is tied to the system CPU clock and as processor load changes the baud rate can change.

In addition by default LINUX uses the Pi 3 and Zero W mini-UART as a console so the logon prompt will appear when used. This would then need to be disabled meaning that additional LINUX work is needed on an install.

Serial input is pretty reliable as the I/O ports are read by a DMA every microsecond - the issue is with output

If you want reliable comms then a clocked protocol (I2C or SPI) is the best solution
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2428
Posted: 02:12pm 12 Jun 2017
Copy link to clipboard 
Print this post

i had wondered how you were getting multiple serial ports.

might i suggest thinking about abandoning the software serial ports completely, and simply requiring the user to exclusively use USB to serial bridges instead? this provides for an unlimited number of serial ports leveraged off the strengths of having an underlying linux kernel, that is the USB support.

it also makes adding additional serial ports much easier, plug-and-play as opposed to having to attach wires to the RPi's pin-header. this may well be a bonus for some non-technical users.


cheers,
rob :-)
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 724
Posted: 08:10pm 12 Jun 2017
Copy link to clipboard 
Print this post

Robert,

that is a very good Idea!
And with ser2net we get rs232 over the air😄

Heureka.
 
matherp
Guru

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

Attached 5.4.a03

2017-06-13_094435_mmbasic.zip

This fixes the issue with serial ports. Based on limited testing transmit at up to 115200 now works perfectly.

One other change:

MM.DEVICE$ now gives the hardware revision code of the Raspberry Pi
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 11:59pm 12 Jun 2017
Copy link to clipboard 
Print this post

Thanks for a03

So how did you tackle the serial 'issue' in the end (just curious).
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 09:28am 13 Jun 2017
Copy link to clipboard 
Print this post

  matherp said  
This fixes the issue with serial ports. Based on limited testing transmit at up to 115200 now works perfectly




Awesome news thank you so much for all the effort you put into this

Regards
Jman
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 724
Posted: 09:31am 13 Jun 2017
Copy link to clipboard 
Print this post

Thank you !
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 10:29pm 15 Jun 2017
Copy link to clipboard 
Print this post

Hi
Thanks Peter i did some limted testing and success this is with a PI Zero (NOT W)

Before


After


Regards
Jman
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10197
Posted: 08:41am 18 Jun 2017
Copy link to clipboard 
Print this post

Attached 5.4.a04

2017-06-18_183954_mmbasic.zip

This has a new command "BITSTREAM" at the request of RonnS which mimics the bitbanger CFunction on the MM+




This waveform was created with the program


DIM INTEGER BITS[10)
SETPIN 40,DOUT
PIN(40)=0
FOR i=0 to 10
BITS(i)= i*2 + 10
NEXT i
BITSTREAM 40, 11, BITS()


The syntax is:

BITSTREAM pin_number, number_of_pulses, array_of_pulse_lengths () in microseconds

Notes:

unlike the bitbanger function the BITSTREAM command will automatically create an end transition to the last pulse.

The direction of the first pulse will be determined by the state of the pin when BITSTREAM is called. If it is high then the first pulse will be at zero, if it is low the first pulse will be at 3.3V

The arrays can be INTEGER or FLOAT but the pulse length must be specified in microseconds

The miniumum pulse length and pulse increment is 1uS

There is a known clock issue on the Pi 3 (it is not know if this affects all boards or only some - it certainly affects mine). Timings for the Pi 3 are scaled by 1.128 so pulses may be wrong by up to 0.5uS. The Pi Zero W works perfectly.


In addition 5.4.a04 has some tidying up of digital I/O to remove runt pulses when using SETPIN x,DOUT

I would like feedback on whether serial output works properly on your PI 3 as this is subject to the same clock issue as described above and I've tuned the timings to work on my Pi 3.
Edited by matherp 2017-06-19
 
gumath
Newbie

Joined: 25/04/2017
Location: Austria
Posts: 10
Posted: 10:42am 18 Jun 2017
Copy link to clipboard 
Print this post

@matherp

Hi Peter,

With PI 3,
Serial input works
Serial output does not work

OPEN "/ dev / ttyUSB0" FOR RANDOM AS # 5 'open the serial port
Works in both direction, but only 9600 baud


Thank you, for your many time

Vy 73 de Guenter, OE7GMT
 
plasma
Guru

Joined: 08/04/2012
Location: Germany
Posts: 437
Posted: 10:59am 18 Jun 2017
Copy link to clipboard 
Print this post

Hi Matherp ,

will the bitstream code work for the rgb leds such like ws2812b?

mfgEdited by plasma 2017-06-19
 
matherp
Guru

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

  Quote  will the bitstream code work for the rgb leds such like ws2812b?


No: they require sub-microsecond pulses
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 724
Posted: 09:01pm 18 Jun 2017
Copy link to clipboard 
Print this post

Where to find Documentation / Manual for the PI-Cromite?


THX


DS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10197
Posted: 09:48pm 18 Jun 2017
Copy link to clipboard 
Print this post

  Quote  


Everything is on this thread +

this

and this

and this
Edited by matherp 2017-06-20
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2949
Posted: 09:55pm 18 Jun 2017
Copy link to clipboard 
Print this post

  matherp said  

DIM INTEGER BITS[10)





Should that be an open bracket instead of square bracket Peter?

Kind Regards,

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 724
Posted: 03:07am 20 Jun 2017
Copy link to clipboard 
Print this post

  matherp said  
  Quote  


Everything is on this thread +

this

and this

and this


OK, so far no written Documentation in PDF or so...

One Forum Member wrote:

"OPEN "/ dev / ttyUSB0" FOR RANDOM AS # 5 'open the serial port"

Didn't know that Picromite can do things like this.
How could i know if not documented, or did i miss it somewhere ??

THX

DS
Edited by atmega8 2017-06-21
 
     Page 12 of 16    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025