PicoMite V6.00.02 release candidates - all versions


Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9967
Posted: 09:59am 26 Mar 2025      

Electricat have you looked at the new chain command and save context/load context - don't know if they help

  Quote  CHAIN fname$ [,cmdline$] ' Allows the program to run another program with the variable space preserved - command is recommended to be used in top level program and not from within a subroutine (may work OK but not tested for side-effects)

SAVE CONTEXT [CLEAR]' saves the variable space and optionally clears it - command should be used in top level program and not from within a subroutine (may work OK but not tested for side-effects). If used in a subroutine a subsequent LOAD CONTEXT must DEFINITELY be in the same subroutine or a crash/corruption will DEFINITELY happen.

LOAD CONTEXT [KEEP]' restores the variable space to the previously saved state and optionally preserves the stored variables to allow a second LOAD if required.

electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 286
Posted: 10:16am 26 Mar 2025      

  matherp said  Electricat have you looked at the new chain command and save context/load context - don't know if they help


I routinelly read and - re read manual and important threads like beata and RC, but seems missed this one. Shame on me. Sounds promissing! Will tray!
Edited 2025-03-26 20:17 by electricat

electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 286
Posted: 11:36am 26 Mar 2025      

It is said
  Quote  "command should be used in top level program and not from within a subroutine "

but users are summoned from hell to broke things  

SAVE CONTEXT CLEAR used inside of startup sub where DIM and Local were declared was unhapy about Local and failed.

But

sub mm.prompt
SAVE CONTEXT CLEAR
end sub

Seems to work (without extensive testing) as clears vars on exit.  
Slows down exit to cmd prompt becouse saves .vars to flash. Means, unnecessary wearing and tearing flash.

If we could ommit flash write and have command, something like maybe SAVE NONE CLEAR then it might work. However how it might affect what users put in MM.PROMPT ... ?
But it is not my wishes, just looking how it could be solved.

Then another stupid idea came from hell.. if I could just use

sub mm.prompt
CLEAR
end sub


However, you know, how it ended  
Will think/play furthurer

JanVolk
Senior Member

Joined: 28/01/2023
Location: Netherlands
Posts: 213
Posted: 12:56pm 26 Mar 2025      

Peter,

Oled screen is now working normally again. Thanks for this.
The other problem of the firmware crashing in the editor is still the case.
It always occurs when scrolling down with the arrow keys in the program with the editor and can only be fixed with a hard reset.
Test with PicoMite MMBasic RP2040 Edition V6.00.01 it always goes well and with PicoMite MMBasic RP2040 Edition V6.00.02RC7 it always goes wrong.
Program is about 1100 lines long and stops at line 304. Communication with Tera Term is then broken and after a reset there is communication again.
It also happens with PicoMite MMBasic RP2350 Edition V6.00.02RC7.

> option list
PicoMite MMBasic RP2040 Edition V6.00.01
OPTION SYSTEM I2C GP0,GP1
OPTION COLOR CODE ON
OPTION HEARTBEAT OFF
OPTION PICO OFF
OPTION DISPLAY 44, 100
OPTION LCD PANEL SSD1306I2C, RLANDSCAPE
OPTION SDCARD GP5, GP6, GP7, GP4


PicoMite MMBasic RP2040 Edition V6.00.02RC7
Copyright 2011-2025 Geoff Graham
Copyright 2016-2025 Peter Mather

Firmware updated
> option list
PicoMite MMBasic RP2040 Edition V6.00.02RC7
OPTION SYSTEM I2C GP0,GP1
OPTION COLOR CODE ON
OPTION HEARTBEAT OFF
OPTION PICO OFF
OPTION CPU SPEED (KHz) 200000
OPTION DISPLAY 44, 100
OPTION LCD PANEL SSD1306I2C, RLANDSCAPE
OPTION SDCARD GP5, GP6, GP7, GP4
>


Greetings,

Jan.

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9967
Posted: 01:04pm 26 Mar 2025      

  Quote  The other problem of the firmware crashing in the editor is still the case.


Does this occur is you disable the OLED?

JanVolk
Senior Member

Joined: 28/01/2023
Location: Netherlands
Posts: 213
Posted: 01:21pm 26 Mar 2025      

Peter,

This tested with oled screen disabled and i2c is still active. (4x20 lcd screen)
Then it works fine and I can now scroll to the end.

> option list
PicoMite MMBasic RP2040 Edition V6.00.02RC7
OPTION SYSTEM I2C GP0,GP1
OPTION COLOR CODE ON
OPTION HEARTBEAT OFF
OPTION PICO OFF
OPTION CPU SPEED (KHz) 200000
OPTION DISPLAY 44, 100
OPTION SDCARD GP5, GP6, GP7, GP4

Greetings,

Jan.

JanVolk
Senior Member

Joined: 28/01/2023
Location: Netherlands
Posts: 213
Posted: 01:39pm 26 Mar 2025      

Peter,

Thanks also for list variables

Greetings,

Jan.

PicoMite MMBasic RP2040 Edition V6.00.02RC7
Copyright 2011-2025 Geoff Graham
Copyright 2016-2025 Peter Mather

> list variables
> run
> list variables
DIM FLOAT ALIVE
DIM FLOAT BEREIK_MAX(21)
DIM FLOAT BEREIK_MIN(21)
DIM FLOAT BINNEN_TEMP
DIM FLOAT BSEC
DIM FLOAT BUITEN_TEMP
DIM FLOAT LCDI2C_BACKLIGHT
DIM FLOAT LCDI2C_EMASK
DIM FLOAT LCDI2C_I2CADDR
DIM FLOAT LCDI2C_LCDBACKLIGHT
DIM FLOAT LCDI2C_NIBPOS
DIM FLOAT LCDI2C_RSDATAMASK
DIM FLOAT LU_DICHT
DIM FLOAT LU_OPEN
DIM FLOAT MAX_MENU_TELLER
DIM FLOAT MAX_RAAM
DIM FLOAT MENU_TELLER
DIM FLOAT MENU_TELLER_OLD
DIM FLOAT MIN_VERSTELLING
DIM FLOAT PIJL_DOWN
DIM FLOAT PIJL_UP
DIM FLOAT RAAM_0
DIM FLOAT RAAM_10
DIM FLOAT RAAM_100
DIM FLOAT RAAM_DICHT
DIM FLOAT RAAM_MIN
DIM FLOAT RAAM_OPEN
DIM FLOAT RAAM_PLUS
DIM FLOAT RAAMSTAND
DIM FLOAT RAAMSTAND_10
DIM FLOAT RAAMSTAND_100
DIM FLOAT RAAMSTAND_A
DIM FLOAT RAAMSTAND_ADC
DIM FLOAT RAAMSTAND_B
DIM FLOAT RAAMSTAND_BER
DIM FLOAT RAAMSTAND_BU
DIM FLOAT RAAMSTAND_BUI
DIM FLOAT RAAMSTAND_IJK
DIM FLOAT RAAMSTAND_IJK10
DIM FLOAT RAAMSTAND_M
DIM FLOAT RAAMSTAND_MENU
DIM FLOAT RAAMSTAND_MIN
DIM FLOAT RAAMSTAND_N
DIM FLOAT RAAMSTAND_N100
DIM FLOAT RAAMSTAND_T
DIM FLOAT RAAMSTAND_T100
DIM FLOAT REGENMELDER
DIM FLOAT REGENMELDER_ADC
DIM FLOAT REGENMELDER_TIJD
DIM FLOAT RESOLUTIE(21)
DIM FLOAT STATUS_KAS
DIM FLOAT STATUS_METEO
DIM FLOAT STATUS_PIJL_DOWN
DIM FLOAT STATUS_PIJL_UP
DIM FLOAT STATUS_RAAM
DIM FLOAT TEMP
DIM FLOAT TEMP_OLD
DIM FLOAT TEMPERATUUR(5)
DIM FLOAT TIMERLOOP
DIM FLOAT UIT
DIM FLOAT VERWERK_GEG
DIM FLOAT WAARDE_OLD
DIM INTEGER MAX_VERSTELLING
DIM INTEGER WAARDE(21)
DIM STRING I
DIM STRING VERSIE
>

JanVolk
Senior Member

Joined: 28/01/2023
Location: Netherlands
Posts: 213
Posted: 04:00pm 26 Mar 2025      

Update:

The Oled screen is disabled. Only I2C LCD screen 4x20 and a DS18B20.
Scrolling with the arrow keys works fine, but scrolling with the mouse wheel sometimes causes the editor to freeze. Ln: n and Col: n and INS are missing and communication can be restored with a hard reset.
Also tested without I2C hardware and communication stops (freezes). With Option system i2c disable it continues to work fine so far. So is I2C possibly the problem?

Greetings,

Jan.

homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 448
Posted: 04:44pm 26 Mar 2025      

  matherp said  RC7 updated

Fixes the ~ issue
Fixes a bug that Gerry found and fixed
Gives about 1.5% performance improvement on code with lots of function/subroutine calls


Out of interest:
How do I enter the ~ on the German keyboard? [AltGr]+[+~*] (to the left of the [Enter] key) does not work. In the terminal this is no problem.
[AltGr]+[Q@] for @ works on keyboard. Therefore it is not the [AltGr]-Key.

Version is PicoMiteHDMI MMBasic USB RP2350A Edition V6.00.02RC7 from 25.03.

@Peter, have you seen my other questions?

1)
Music playback:
> play mp3 “going <-- very quietly PLOPP
> play pause <-- PLOPP
> play resume <--PLOPP
> play stop <-- NO plopp, okay
when the song is finished and the playback stops: <--PLOPP

2)
the counter question to MODFILE and pause? If you make it possible, I would also find it stringent to the other command behavior.

Does the command “PLAY MODSAMPLE Samplenum, channel[,volume]” still work when PAUSE is active? Or would no samples be played?

That would be cool for the sound effect usage :-)

Is there also a parameter in the depths of your implementations with which note the sample is played back?
Edited 2025-03-27 02:46 by homa

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4809
Posted: 04:56pm 26 Mar 2025      

Homa,

For Petscii robots Martin made 2 modfiles. 1 with sound track, and sfx (samples). And one with an empty sound track, only having sfx samples.
So technically you can play modsamples without a sound track playing, but I do not think you can play modsamples when the player is paused or stopped.

About the plops in sound, do mention if you use pwm, I2s or SPI audio.
I know pwm has plops, but i2s should not.
Maybe pwm can be improved. Plops are result of either stopping and starting the pwm timer, such as with a bitrate change, or writing a zero value, in stead of 50% when stopping


Volhout
Edited 2025-03-27 02:57 by Volhout

homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 448
Posted: 05:29pm 26 Mar 2025      

  Volhout said  About the plops in sound, do mention if you use pwm, I2s or SPI audio.

I use the “standard” Pico2 HDMI board from Peter.
Edited 2025-03-27 03:30 by homa

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9967
Posted: 06:59pm 26 Mar 2025      

  Quote  > play pause <-- PLOPP
> play resume <--PLOPP


When you pause the system sets the output to 50%. If it was not close to this at the time you will get a sound, likewise on resume the other way - just the way it works

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4809
Posted: 07:02pm 26 Mar 2025      

@Peter, Homa,

On my 2040 VGA (PWM audio) design, when I power it on, there is 2.3Vdc at the output.
Since the PWM audio should be centrered around 50% (of 3.3V) equals 1.65V, the 2.3V  causes a jump at the start of each sound played. I see the same at the end of each tone.

I have a scope picture that shows it. This is from PLAY TONE 1000,1000,50



Also at the end of the tone, this offset of 2.3V is restored...after 1.2 milisecond.



I think the initial value of the Timer Compare Register should be half the value of the Timer Wrap Register. Also with every sample frequency change this default value should be set.

Volhout
P.S. this is RC7_2
Edited 2025-03-27 05:18 by Volhout

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4809
Posted: 07:25pm 26 Mar 2025      

  homa said  
  Volhout said  About the plops in sound, do mention if you use pwm, I2s or SPI audio.

I use the “standard” Pico2 HDMI board from Peter.


I lost what the standard HDMI design was. I recall first the pico2 design uses PWM. I think the new one has a 2350B and I2S audio.
I myself have MIXTEL's pico2 design, and it uses SPI. I may convert to it to I2S since the DAC is in an 8pin socket.

Volhout

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4809
Posted: 07:33pm 26 Mar 2025      

@Peter,

These DC jumps also happen at PLAY PAUSE and PLAY RESUME of a WAV file,
So I think it is just a wrong default value programmed in the PWM when the PWM is idle. When playing samples, it is nicely centered around 1.65 V.

Volhout

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9967
Posted: 07:53pm 26 Mar 2025      

If you look at the actual PWM output you will see on power on it is exactly 50:50.
You will also see that if you PLAY TONE 400,400 and then ctrl-C it returns to 50:50.
Please also confirm "play tone 400,400" and then "play stop" leaves the output at 50:50
On my system play tone 400,400,n leaves the PWM signal lower than 50% (about 41%). I'll try and find why this is the case but it certainly doesn't give an output that could yield 2.3V

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4809
Posted: 07:10am 27 Mar 2025      

Hi Peter,

When I PLAY TONE 400,400 and stop it with PLAY STOP, I get nice 50:50. Confirmed.

Observations:
When I PLAY WAV "xx" and the tune ends, I am at 50:50. Confirmed. Play stop always returns to 50:50.

When I PLAY TONE x,x,y and the tone ends after y ms, it ends at 2.3V (69% PWM). tested several frequencies, all end at the same level. Several different times. Always the same 2.3V. So there is no relation between frequency and time for the level 2.3V.

When I PLAY WAV, then PLAY PAUSE, I get 2.3V. The same 2.3V. Even if I started with a power cycled unit that has 50:50 at start of the play wav.

This is VGA design 2 RP2040.

Another observation: after power on (without anything playing) the initial value is 50mV lower than the 1.65V (1.60V), as if the default PWM is set to 48.5%. This is a minute difference, and may even have a different cause. (i.e. changing drive strength of the IO pins) So ignore this for now, but it may give a lead into the other issue.

So in summary: when PLAY TONE ends by the set time, and with PLAY PAUSE this happens. PLAY STOP does not.

Volhout

P.S. I have never seen your 41%. It is always 69%. Maybe it is taken from some not-initialized memory location ?
Edited 2025-03-27 17:24 by Volhout

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4809
Posted: 08:02am 27 Mar 2025      

@Peter,

I also confirm this is not caused by a change in sample frequency. In all cases (even during PLAY PAUSE the sample rate is 44.1kHz. No change to 48kHz or 32/16kHz.
Really solid 69.7% duty cycle at 44.1kHz .

idea:
The PWM at 44.1kHz is around 11 bits actual. Could it be that you write the mid position of the 12bit DAC MCP4822 to the PWM ? That would boil down to this roughly 70%.

Volhout
Edited 2025-03-27 18:12 by Volhout

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9967
Posted: 08:21am 27 Mar 2025      

  Quote  Another observation: after power on (without anything playing) the initial value is 50mV lower than the 1.65V (1.60V), as if the default PWM is set to 48.5%. This is a minute difference, and may even have a different cause. (i.e. changing drive strength of the IO pins) So ignore this for now, but it may give a lead into the other issue.


This bit is deliberate. The audio code centers on 2000/4096 and allows swings between 0 and 4000

  Quote  When I PLAY TONE x,x,y and the tone ends after y ms, it ends at 2.3V (69% PWM). tested several frequencies, all end at the same level. Several different times. Always the same 2.3V. So there is no relation between frequency and time for the level 2.3V.

When I PLAY WAV, then PLAY PAUSE, I get 2.3V. The same 2.3V. Even if I started with a power cycled unit that has 50:50 at start of the play wav.

P.S. I have never seen your 41%. It is always 69%. Maybe it is taken from some not-initialized memory location ?


Something obviously wrong. I've been testing on an RP2350B PicoMite so the 41% vs 69% may in some way be version dependent - will explore more.

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9967
Posted: 01:49pm 27 Mar 2025      

This VGA version should fix the voltage offset. In addition, I've changed the behavior of play pause/resume so that pause leave the voltage at the instantaneous level at the time of the command and resume starts from that level. Should also support pause on MOD playback.

  Quote  The other problem of the firmware crashing in the editor is still the case.
It always occurs when scrolling down with the arrow keys in the program with the editor and can only be fixed with a hard reset.


I've looked at this and can't find the issue. It isn't anything to do with the I2C display as it can happen with no display configured ( tested on a file with 3200 lines). It seems to be a bug in the handling of stdout by the sdk turning off interrupts and not re-enabling them under a, yet to be understood, set of conditions. As far as I can test it only happens in the editor (tested with a program that mimics editor functionality) so may be to do with escape sequence handling. I have made a couple of changes which may have reduced the incidence of the problem but this could be one we have to live with - i.e. avoid scrolling through a long file by holding down the down-arrow key. Use Page down instead.

This version also includes the option to list variables to a longstring - don't know why, seemed like it might be useful.

LIST VARIABLES a%()


PicoMiteVGARP2040.zip
Edited 2025-03-28 00:00 by matherp