Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:33 31 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 16 of 23    
Author Message
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2838
Posted: 03:11pm 17 Dec 2024
Copy link to clipboard 
Print this post

  matherp said  javavi

This should fix it. Bug in CLS for mode 1 on HDMI only not respecting FRAMEBUFFER WRITE


PicoMite.zip


Just asking - is for file for the HDMI version (it is just called PicoMite)?
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 307
Posted: 09:42pm 17 Dec 2024
Copy link to clipboard 
Print this post

  matherp said  This should fix it. Bug in CLS for mode 1 on HDMI only not respecting FRAMEBUFFER WRITE
PicoMite.zip

Yes, it works great now.  
PicoMiteHDMI MMBasic RP2350A Edition V6.00.01RC8
OPTION FLASH SIZE 4194304
OPTION COLOURCODE ON
OPTION KEYBOARD US
OPTION KEYBOARD PINS GP2,GP3
OPTION CPUSPEED (KHz) 315000
OPTION HDMI PINS  1, 3, 5, 7
OPTION SDCARD GP5, GP6, GP7, GP4
OPTION AUDIO GP10,GP11', ON PWM CHANNEL 5
OPTION PSRAM PIN GP8


Now, I have another question about PSRAM, how can I now disable it without resetting other settings options?
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6930
Posted: 09:59pm 17 Dec 2024
Copy link to clipboard 
Print this post

Have you tried OPTION PSRAM DISABLE ?
Then again, just disconnecting it from GP8 will remove its CS signal and it's gone.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 307
Posted: 11:49pm 17 Dec 2024
Copy link to clipboard 
Print this post

  Mixtel90 said  Have you tried OPTION PSRAM DISABLE ?
Then again, just disconnecting it from GP8 will remove its CS signal and it's gone.

OPTION PSRAM DISABLE does not work, there is no such OPTION.
I modified my RP2350-Plus board with a jumper that disconnects CS from the PSRAM chip.
Disabling this signal CS subsequently led to a complete system freeze. I had to erase and reflash "Pico2" again, restore the option settings.

By the way, can someone help write a stress test or a performance test for this type of PSRAM memory with a capacity of 8 Mbytes?  
Edited 2024-12-18 10:10 by javavi
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4364
Posted: 06:12am 18 Dec 2024
Copy link to clipboard 
Print this post

Hi Javavi,

Disconnecting is not enough. You may need a pull-up on the chip to make sure the cs pin is off.

I tested PSRAM by DIM of a huge array.
Filling that with random data in a loop is basically a memory test. i.e. 800000 elements (=800000 * 8 bytes = 6.4Mbyte). You can also use ppre-defined data (&haaaaaaaa and &h55555555) and verifty the data by reading it.

If you run the same test with 8000 elements in the array (8000 elements = 64kbyte = fit in RP2350 RAM) you will notice that the speed of MMBasic is significantly higher (per array cell changed) than when executing the same routine with 800000 elements. So PSRAM is slower.

I measured PSRAM to be 10x slower in earlier tests.

Volhout
Edited 2024-12-18 17:16 by Volhout
PicomiteVGA PETSCII ROBOTS
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2195
Posted: 07:11am 18 Dec 2024
Copy link to clipboard 
Print this post

  Quote  You may need a pull-up on the chip to make sure the cs pin is off.
To test that without adding a resistor replace the jumper then:-
SetPin GP8, DOut : Pin(GP8) = 1
Though you will need to remove OPTION PSRAM from the options.
If OPTION PSRAM DISABLE doesn't work trial and error may be needed.
eg OPTION PSRAM OFF or DELETE or REMOVE etc.
Failing that reset all the Options.
Edited 2024-12-18 17:19 by phil99
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4364
Posted: 07:17am 18 Dec 2024
Copy link to clipboard 
Print this post

Hi phill,

That may not work. When PSRAM blocks the flash SPI bus, you cannot get into MMBAsic at all.

Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9308
Posted: 10:21am 18 Dec 2024
Copy link to clipboard 
Print this post

V6.00.01RC9

PicoMiteRP2040V6.00.01RC9.zip

PicoMiteRP2350V6.00.01RC9.zip


Fixes bug in CLS in HDMI mode 1 when writing to a framebuffer or layerbuffer
Fixes bug when a program ends without an explicit END statment

Adds OPTION PSRAM DISABLE

Optional parameter on
MATH V_PRINT array() [,hex] 'outputs the contents in hex

New MATH command
MATH AES128 ENCRYPT/DECRYPT CBC/ECB/CTR key$/key(), in$/in(), out$/out() [,iv$/iv()]
This command encrypts or decrypts the data in 'in' and puts the answer in 'out' using the AES128 encryption method specified
The parameters can each be either a string, integer array, or float array with any mix possible
The key must be 16 elements long (16*8=128bits)
in and out must be a multiple of 16 elements long.
In the case of out being specified as a string (e.g. out$), the string variable must exist and should be set to empty (DIM out$="")
The maximum number of elements in 'in' and 'out' is 256 when defined as arrays or 128 if one or other is defined as a string
For CBC and CTR versions you can optionally specify an initiallisation vector 'iv'. 'iv' must be 16 elements long (16*8=128bits)


My test program for AES128

Dim float key(15)=(&H2b,&H7e,&H15,&H16,&H28,&Hae,&Hd2,&Ha6,&Hab,&Hf7,&H15,&H88,&H09,&Hcf,&H4f,&H3c)
Dim integer in(63),out(63),comp(63)
Dim integer iv(15)
Dim s$=""
Dim k$=""
Data &H6b, &Hc1, &Hbe, &He2, &H2e, &H40, &H9f, &H96, &He9, &H3d, &H7e, &H11, &H73, &H93, &H17, &H2a
Data &Hae, &H2d, &H8a, &H57, &H1e, &H03, &Hac, &H9c, &H9e, &Hb7, &H6f, &Hac, &H45, &Haf, &H8e, &H51
Data &H30, &Hc8, &H1c, &H46, &Ha3, &H5c, &He4, &H11, &He5, &Hfb, &Hc1, &H19, &H1a, &H0a, &H52, &Hef
Data &Hf6, &H9f, &H24, &H45, &Hdf, &H4f, &H9b, &H17, &Had, &H2b, &H41, &H7b, &He6, &H6c, &H37, &H10
'read in the message to be encrypted
For i=0 To 63
 Read in(i)
Next
'convert the key array to a string version of the key
For i=0 To 15
 iv(i)=15-i 'create an initialisation vector different from the default
 Inc s$,Chr$(key(i))
Next
'convert the message to a string version of the message
For i=0 To 63
 Inc k$,Chr$(in(i))
Next
' encrypt the message
Math aes128 encrypt cbc key(),in(),out(),iv()
Math v_print out(),hex
'decrypt the message
Math aes128 decrypt cbc key(),out(),comp(),iv()
Math v_print comp(),hex
'check for errors
For i=0 To 63
If in(i)<>comp(i) Then Print "WTF"
Next
End

Edited 2024-12-18 22:35 by matherp
 
BishopXXL
Newbie

Joined: 13/01/2019
Location: Germany
Posts: 29
Posted: 01:02pm 18 Dec 2024
Copy link to clipboard 
Print this post

Hi Peter,

I tried it and the first half (16 bytes) worked.
Could it be that I made another mistake?
I chose the "ECB" mode and omitted the initialization vector.
To check it I took the key (0x01 - 0x10) and the data (0x01 - 0x20).



Dim float key(15)=(&H01,&H02,&H03,&H04,&H05,&H06,&H07,&H08,&H09,&H0A,&H0B,&H0C,&H0D,&H0E,&H0F,&H10)
Dim integer in(63),out(63),comp(63)
Dim integer iv(15)

Dim s$=""
Dim k$=""

Data &H01,&H02,&H03,&H04,&H05,&H06,&H07,&H08,&H09,&H0A,&H0B,&H0C,&H0D,&H0E,&H0F,&H10
Data &H11,&H12,&H13,&H14,&H15,&H16,&H17,&H18,&H19,&H1A,&H1B,&H1C,&H1D,&H1E,&H1F,&H20

' Key
Print "Key:"
For i=0 To 15
Print Hex$(key(i)); " " ;
Next

Print

'read in the message to be encrypted
For i=0 To 31
Read in(i)
Next

'convert the key array to a string version of the key
'For i=0 To 15
' iv(i)=15-i 'create an initialisation vector different from the default
' Inc s$,Chr$(key(i))
'Next

'convert the message to a string version of the message
'For i=0 To 31
' Inc k$,Chr$(in(i))
'Next

' encrypt the message

Math aes128 encrypt ecb key(),in(),out()

Print "Input text:"
For i = 0 To 31
Print Hex$(in(i)); " " ;
Next i
Print
Print "Encrypted text:"
For i = 0 To 31
Print Hex$(out(i)); " " ;
Next i


End



Result :
Key:
1 2 3 4 5 6 7 8 9 A B C D E F 10
Input text:
1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
Encrypted text:
34 C3 3B 7F 14 FD 53 DC EA 25 E0 1A 2 E1 67 27 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20


Cheers Bishop
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1326
Posted: 02:21pm 18 Dec 2024
Copy link to clipboard 
Print this post

@Peter
I only get error messages with the new "END" feature.
[33] End "files"
Error : MM.ENDLINE is not declared

Should MM.endline be declared?  
Regards
Michael

> option list
PicoMiteHDMI MMBasic RP2350A Edition V6.00.01RC9
OPTION FLASH SIZE 4194304
OPTION KEYBOARD GR
OPTION CPUSPEED (KHz) 315000
OPTION SDCARD GP5, GP2, GP3, GP4
OPTION F9 *"B:FM113"

Edited 2024-12-19 00:36 by twofingers
causality ≠ correlation ≠ coincidence
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9308
Posted: 02:42pm 18 Dec 2024
Copy link to clipboard 
Print this post

Bishop

I've checked the TinyAES source and it only converts 16 bytes at a time. I'll put a loop in my code but in the meantime you should find that doing your 32-byte message 16 bytes at a time should work.

twofingers
Can't replicate. MM.ENDFILE$ is automatically created by the END statement and works for me.
 
BishopXXL
Newbie

Joined: 13/01/2019
Location: Germany
Posts: 29
Posted: 02:47pm 18 Dec 2024
Copy link to clipboard 
Print this post

completed..
Edited 2024-12-19 00:49 by BishopXXL
 
ville56
Senior Member

Joined: 08/06/2022
Location: Austria
Posts: 125
Posted: 02:51pm 18 Dec 2024
Copy link to clipboard 
Print this post

  matherp said  Bishop

twofingers
Can't replicate. MM.ENDFILE$ is automatically created by the END statement and works for me.


Doesn't work for me either. Env: Webmite RP2040, V6.00.01RC9

Gerald
Edited 2024-12-19 00:51 by ville56
                                                                 
73 de OE1HGA, Gerald
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1326
Posted: 02:54pm 18 Dec 2024
Copy link to clipboard 
Print this post

@Peter
  Quote  twofingers
Can't replicate. MM.ENDFILE$ is automatically created by the END statement and works for me.

that's weird. If I put the >End "files"< at the beginning of the program, then I get no error, but at the end.

'End "files"

' Peters aes demo program
' modified for ascii input by twofingers@TBS

Option explicit
CLS
Dim float key(15)=(&H2b,&H7e,&H15,&H16,&H28,&Hae,&Hd2,&Ha6,&Hab,&Hf7,&H15,&H88,
&H09,&Hcf,&H4f,&H3c)

Dim string in$="",out$="",comp$=""
Dim integer iv(15),i

'convert the key array to a string version of the key
For i=0 To 15
iv(i)=15-i 'create an initialisation vector different from the default
Next
'convert the message to a string version of the message
Print
Input "Your message (16 min char, max 128): ", in$
Inc in$,String$(16-Len(in$) Mod 16,0)

' encrypt the message
Math aes128 encrypt ctr key(),in$,out$,iv()
Print in$
Print out$
'Math v_print out(),hex
'decrypt the message
Math aes128 decrypt ctr key(),out$,comp$,iv()
'Math v_print comp(),hex
Print out$
Print comp$
'check for errors
If in$<>comp$ Then Print "WTF" Else Print "Okay"

End "files"

causality ≠ correlation ≠ coincidence
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9308
Posted: 02:56pm 18 Dec 2024
Copy link to clipboard 
Print this post

Can you put a CR after the END "files" statement and test again - thanks
Also what version?
Edited 2024-12-19 00:57 by matherp
 
ville56
Senior Member

Joined: 08/06/2022
Location: Austria
Posts: 125
Posted: 02:57pm 18 Dec 2024
Copy link to clipboard 
Print this post

It's OPTION EXPLICIT which hurts .... If commented out, its working ....
                                                                 
73 de OE1HGA, Gerald
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1326
Posted: 03:00pm 18 Dec 2024
Copy link to clipboard 
Print this post

Solved: >Option explicit < makes the difference!
Edit: ville56 is right.

@Peter: PicoMiteHDMI MMBasic RP2350A Edition V6.00.01RC9
Edited 2024-12-19 01:03 by twofingers
causality ≠ correlation ≠ coincidence
 
matherp
Guru

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

OK thanks Gerald - now I can fix it - will include in next RC or full release whichever is first
Edited 2024-12-19 01:11 by matherp
 
ville56
Senior Member

Joined: 08/06/2022
Location: Austria
Posts: 125
Posted: 03:12pm 18 Dec 2024
Copy link to clipboard 
Print this post

Peter, I have to thank you for the magnificent work you are providing us.
                                                                 
73 de OE1HGA, Gerald
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 307
Posted: 07:22pm 18 Dec 2024
Copy link to clipboard 
Print this post

  matherp said  V6.00.01RC9
Adds OPTION PSRAM DISABLE

> OPTION PSRAM DISABLE
Error : Invalid Option

> OPTION PSRAM PIN DISABLE
 

On my "Pico2" module I have a jumper to pin 1 (CS) of the PSRAM which is pulled up by a 10k resistor to the chip power supply.
If the PSRAM is connected and the OPTION PSRAM PIN GPn is configured, then everything works.
But if you remove the CS jumper and turn on the power, then everything freezes, and returning the jumper does not change anything. Only erasing and reflashing with the CS jumper disconnected restores startup.
Is it possible to introduce some kind of check for the presence of the PSRAM at startup and if it is not detected, then disable it or not use it?
 
     Page 16 of 23    
Print this page
© JAQ Software 2024