Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 18:35 26 Dec 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 : PicoMite V6.00.01 release candidates - please test thoroughly

     Page 12 of 21    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9293
Posted: 11:59am 12 Dec 2024
Copy link to clipboard 
Print this post

Try this VGA RP2040. The only change you will need to make is that you mustn't change a pin setup that you are using as a PIO input after the PIO START command (other than to set as an input)


PicoMite.zip

Tested with

'disconnect ARM from GP0. - 1000Hz / 1500Hz Square Wave
SetPin gp0,pio1
SetPin gp2,dout

'configure pio1
p=Pio(pinctrl 0,1,,,,gp0,)
e=Pio(execctrl gp2,0,31)
f=1000 * 6 'Hz

'line code comment
' 0   E081 SET GP0 output
' 1   E001      SET gp0 high
' 2   00C5      JMP (GP2=1) to 5, (skip instructions 3 & 4)
' 3   E001      SET gp0 high
' 4   E000      SET gp0 low
' 5   E000      SET gp0 low
' 6   0001      JMP to 1


'program pio1
PIO program line 1,0,&hE081
PIO program line 1,1,&hE001
PIO program line 1,2,&h00C5
PIO program line 1,3,&hE001
PIO program line 1,4,&hE000
PIO program line 1,5,&hE000
PIO program line 1,6,&h0001


'write the configuration (note we added "e")
PIO init machine 1,0,f,p,e,,0

'start the pio1 code
PIO start 1,0


'toggle GP2 in MMBasic
SetPin gp8,fin

Do
Pin(gp2) = Not Pin(gp2) 'toggle pin GP2
Print Pin(gp8)
Pause 2000
Loop

End
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4350
Posted: 12:30pm 12 Dec 2024
Copy link to clipboard 
Print this post

Hi Peter,

This works. The logic analyzer however does not work. And it enables the GPx pins as PWM and starts PWM before programming and starting PIO.

Volhout

EDIT: something strange. The logic analyzer demo in the user manual (EXAMPLE 3) does work, including PWM and PIO on the same pins. But the logic analyzer LA_24_2 does not. Maybe becuase LA_24_2 uses triggering. I will have to debug that.
Edited 2024-12-12 22:56 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4350
Posted: 06:09pm 12 Dec 2024
Copy link to clipboard 
Print this post

Peter,

I. Could not get on thebackshed earlier. But the logic analyzer PIO and mmbasic interaction works as I could derive from the trigger pin gp22. But the traces on screen are flat 0.
This is using your test version 3 posts back.

I need some more digging to do, but my current thought is that the pack/unpack is not working.
The dma works, because the user manual example program 3 works.
Graphics work, the only thing in between is the unpacker of the circular buffer.

I will report when I have relevant information.
But please do not release 6.00.01 yet.

Volhout
PicomiteVGA PETSCII ROBOTS
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4350
Posted: 06:50pm 12 Dec 2024
Copy link to clipboard 
Print this post

Hi Peter,

The logic analyzer LA_24_2.bas still works in 6.00.01rc5.
Both the dual use of the PIO and ARM on GPIO pins, as well as the circular buffer (not confirmed that it actually is the circular buffer, but the logic analyzer completely works in rc5).

What is the list changes you made when going from rc5 to rc6 ?
That what killed it.

Please use your github history to trace back what caused it. Some typing error / It is not toolchain, otherwise rc5 would also be showing the problem.

Regards,

Volhout
Edited 2024-12-13 04:59 by Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9293
Posted: 07:03pm 12 Dec 2024
Copy link to clipboard 
Print this post

Please post your version of LA_24_2 so I'm sure I'm running the same thing. The version I've got fails on the mode command killing the framebuffer
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9293
Posted: 10:39pm 12 Dec 2024
Copy link to clipboard 
Print this post

OK I've found it. The bug is nothing to do with PIO or anything related to I/O. It relates to a fix I did to not change text in comments e.g. '=< to '>=
Have a look at this line
  Quote          If MM.Ver>=5.070807 Then ReadyInt 'needed if endless DMA


After you load the program from disk and you will see the problem
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 916
Posted: 11:19pm 12 Dec 2024
Copy link to clipboard 
Print this post

Peter,
When looking at the source to extract the fix for not tokenising in comments I noticed this. Do know if intentional or not.
The second line is a repeat of the first line, in RC5 the second line originally refers to CLOCK.

PinSetBit(Option.KEYBOARD_DATA, TRISSET);  // if tris = 1 then it is an input


RC6
void KBDIntEnable(int status)
{
 PinSetBit(Option.KEYBOARD_CLOCK, TRISSET); // if tris = 1 then it is an input
 PinSetBit(Option.KEYBOARD_CLOCK, TRISSET);  // if tris = 1 then it is an input
 PinSetBit(Option.KEYBOARD_CLOCK, CNPUSET); // if tris = 1 then it is an input
 PinSetBit(Option.KEYBOARD_DATA, CNPUSET);  // if tris = 1 then it is an input
 if (status)
 ......


In RC5 line is.
PinSetBit(Option.KEYBOARD_DATA, TRISSET);  // if tris = 1 then it is an input
Latest F4 Latest H7
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4350
Posted: 07:23am 13 Dec 2024
Copy link to clipboard 
Print this post

Hi Peter,

Here you go....

LA_24_2.zip

Volhout

EDIT: oops...to late.
Edited 2024-12-13 17:26 by Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9293
Posted: 08:55am 13 Dec 2024
Copy link to clipboard 
Print this post

Harm

Please try this


PicoMite.zip

Corrected code for STR_REPLACE

void  MIPS16 STR_REPLACE(char *target, const char *needle, const char *replacement){
char *ip=target;
int toggle=0;
   char comment[STRINGSIZE]={0};
   skipspace(ip);
   if(!(toupper(*ip)=='R' && toupper(ip[1])=='E' && toupper(ip[2])=='M' )){
       while(*ip){
           if(*ip==34){
               if(toggle==0)toggle=1;
               else toggle=0;
           }
           if(toggle && *ip==' '){
               *ip=0xFF;
           }
           if(toggle && *ip=='.'){
               *ip=0xFE;
           }
           if(toggle && *ip=='='){
               *ip=0xFD;
           }
           if(toggle==0 && *ip=='\''){
               strcpy(comment,ip);
               *ip=0;
               break;
           }
           ip++;
       }
       str_replace(target, needle, replacement);
       ip=target;
       if(comment[0]=='\''){
           strcat(target,comment);
       }
       while(*ip){
           if(*ip==0xFF)*ip=' ';
           if(*ip==0xFE)*ip='.';
           if(*ip==0xFD)*ip='=';
           ip++;
       }
   }

}
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4350
Posted: 09:36am 13 Dec 2024
Copy link to clipboard 
Print this post

Hi Peter,

I tested this release, and the logic analyzer works. Thanks.

The only difference with this version and previous is that you can not change pin data direction while PIO is running (as you already mentioned before).

Some programs need adaptations, but these should be minor. The problem I see is that there is no error message that you are changing data direction while PIO is running. It simply does not happen, but you have no idea why not.

Minor but confusing when that happens. Especially since that behaviour is different as before.

Volhout

P.S. Peter, what happens when I would write a PIO program that sniffs the PS2 data pin ? Does the keyboard stop working since it cannot change data direction ? You cannot detect or prevent that since GP8 is not mentioned in the PIO program when I used GP5 as basis and read 5 pins in an input statement (GP5,6,7,8,9). Or is it made impossible to change any SETPIN when PIO is running ? But VGA is running all the time ? What is the problem ?
Edited 2024-12-13 19:44 by Volhout
PicomiteVGA PETSCII ROBOTS
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4067
Posted: 09:43am 13 Dec 2024
Copy link to clipboard 
Print this post

  matherp said  Corrected code for STR_REPLACE


I had wondered about this before but didn't want to bother you at the time, what is the purpose of the temporary transformation of ' ', '.' and '=' when within quotes ?

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4350
Posted: 09:45am 13 Dec 2024
Copy link to clipboard 
Print this post

  Volhout said  Hi Peter,

I tested this release, and the logic analyzer works. Thanks.

The only difference with this version and previous is that you can not change pin data direction while PIO is running (as you already mentioned before).

Some programs need adaptations, but these should be minor. The problem I see is that there is no error message that you are changing data direction while PIO is running. It simply does not happen, but you have no idea why not.

Minor but confusing when that happens. Especially since that behaviour is different as before.

Volhout

P.S. Peter, what happens when I would write a PIO program that sniffs the PS2 data pin ? Does the keyboard stop working since it cannot change data direction ? You cannot detect or prevent that since GP8 is not mentioned in the PIO program when I used GP5 as basis and read 5 pins in an input statement (GP5,6,7,8,9). Or is it made impossible to change any SETPIN when PIO is running ? But VGA is running all the time ? What is the problem ? Is it a choice you made, or a complication in the system design.

PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9293
Posted: 09:51am 13 Dec 2024
Copy link to clipboard 
Print this post

  Quote  P.S. Peter, what happens when I would write a PIO program that sniffs the PS2 data pin ?

That is benign. PIO will just read zero for any reserved pin that is an output and read the current value for any that are inputs. For special functions like PWM, SPI, I2C it depends on whether the chip internals enable the input pad whether they will read or return 0. From the example of the logic analyser, it appears that setting a pin as PWM does enable the input PAD which is why RC5 worked. The bug in RC6 was nothing to do with this - you saw it because I changed MM.VER to MM.INFO(VERSION) and the code that preserves text in comments had a bug when a comment was after a string that was replaced.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9293
Posted: 12:29pm 13 Dec 2024
Copy link to clipboard 
Print this post

V6.00.01RC7


PicoMiteRP2350V6.00.01RC7.zip

PicoMiteRP2040V6.00.01RC7.zip


Fixes a bad bug that corrupts a program during load when a legacy function like MM.HPOS is replaced by MM.INFO(HPOS) in a line with a comment at the end. This bug was introduced in RC5 when a change was made to stop replacements in comments.

Enables PIO programs to read any pin that is not then changed to an output after the PIO is started
Edited 2024-12-13 22:30 by matherp
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4350
Posted: 01:38pm 13 Dec 2024
Copy link to clipboard 
Print this post

Hi Peter,

First few programs tested: OK !

Volhout
PicomiteVGA PETSCII ROBOTS
 
JanVolk
Senior Member

Joined: 28/01/2023
Location: Netherlands
Posts: 166
Posted: 09:03pm 13 Dec 2024
Copy link to clipboard 
Print this post

Test PicoMiteHDMI MMBasic USB RP2350A Edition V6.00.01RC7. It works properly.
My previous comment that the beep could not be heard when changing the option system is correct because this is only the case with the USB on the board and not with an external serial COM2 to USB and I have no longer been able to observe the disruption in the serial communication. , not even with the previous versions, so possibly there was a disruption on my side?
Also thanks for SDS -> SDA.

Greetings,
Jan.
 
JanVolk
Senior Member

Joined: 28/01/2023
Location: Netherlands
Posts: 166
Posted: 09:29pm 13 Dec 2024
Copy link to clipboard 
Print this post

Peter,

Test RP2040 GREEK with Freepins.

PicoMite MMBasic RP2040 Edition V6.00.01RC7
OPTION SYSTEM SPI GP10,GP11,GP24
OPTION SYSTEM I2C GP0,GP1
OPTION FLASH SIZE 4194304
OPTION COLOR CODE ON
OPTION HEARTBEAT OFF
OPTION PICO OFF
OPTION CPU SPEED 252000 'KHz
OPTION LCD PANEL ST7789_135, RLANDSCAPE,GP8,GP12,GP9,GP25
OPTION SDCARD GP23, GP18, GP19, GP20
OPTION PLATFORM RP2040-GEEK

GP8 11 Boot Reserved : LCD CD must be LCD DC.

Greetings,
Jan.
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 916
Posted: 12:03am 14 Dec 2024
Copy link to clipboard 
Print this post

  thwill said  
I had wondered about this before but didn't want to bother you at the time, what is the purpose of the temporary transformation of ' ', '.' and '=' when within quotes ?
Tom


They are used to prevent replacement strings that automatically convert variations of commands/functions to a share token being replaced if used in a literal string. e.g.
print " => is converted to >= "
In the ArmiteH7 and required in CMM2 also '(' so HEX$( is not replaced in a string.
if(toggle && *ip=='('){
               *ip=0xFC;
}

e.g. these ones.

STR_REPLACE(inpbuf,"=>",">=");
STR_REPLACE(inpbuf,"ERASE ","CLEAR VARS ");
STR_REPLACE(inpbuf,"MM.FONTHEIGHT","MM.INFO(FONTHEIGHT)");
STR_REPLACE(inpbuf,"HEX$(","BASE$(16,");

Edited 2024-12-14 11:03 by disco4now
Latest F4 Latest H7
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 301
Posted: 09:21am 14 Dec 2024
Copy link to clipboard 
Print this post

Good day! @matherp
I saw here that MMBasic DOS/WIN has a SYSTEM command for performing DOS functions that are not available from MMBasic.

I would like to have the same command for PicoMite MMBasic.
Yes, I know that PicoMite does not have a system, but it has a console shell, and maybe someday, some RTOS will appear.
In my humble opinion, such a command should already be present in MMBasic for PicoMite.
SYSTEM command-line$

This will exit to Shell, run the 'command-line$' as if typed in at the command
prompt and then return to the loading MMBasic program.
This can be used to access features of the Commamd prompt Shell that are not available
from within MMBasic.

For example:
Option ESCAPE
SYSTEM "Files \q*.TXT\q,size"

Or perform the system setup OPTIONS offered to the user from the program.

Best regards, javavi
Edited 2024-12-14 19:22 by javavi
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6912
Posted: 09:39am 14 Dec 2024
Copy link to clipboard 
Print this post

Hehe... I think if you want to do this you are going to have to write an OS for the Pico and a version of MMBasic to run on that.  ;) You can't shell out to nothing.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
     Page 12 of 21    
Print this page
© JAQ Software 2024