Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 04:36 29 Nov 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 V5.07.06 preview - flash file system

     Page 2 of 5    
Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 01:19am 17 Dec 2022
Copy link to clipboard 
Print this post

Fantastic news - and a lovely Christmas prezzie for all of us who will be tinkering with things over the holiday period.

For my purposes, this would be brilliant, as I recently bought some MP3/WAV playing boards with on-board EEPROM memory chips that created a small USB drive you could copy files to.  If the PM started supporting that natively, I could store my sound files locally on the module itself, no need for an external uSD card or even an external uSD or FLASH-based sound player module.  Use the files on the flash filesystem, and MMBASIC's own native PLAY WAV commands.  Sounds like bliss.

Watching this thread with much interest.

EDIT:

  Peter said  My instinct is to set the maximum flash slots to 5 - thoughts?


Agreed.

Or just do away with the slots altogether IF you elect to format a flash filesystem.
IE: You can use flash slots by default, but if you elect to format a flash filesystem, the space used by the flash slots is gobbled up and becomes part of the filesystem pool.

...or am I being too brutal with that suggestion?    
Edited 2022-12-17 11:30 by Grogster
Smoke makes things work. When the smoke gets out, it stops!
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 06:36am 17 Dec 2022
Copy link to clipboard 
Print this post

Seems a shame to cripple MMBasic to suit the puniest RP2040.
Storage costs extra anyway so why not spend the money on the RP2040 with bigger flash.


Craig
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2140
Posted: 06:44am 17 Dec 2022
Copy link to clipboard 
Print this post

Perhaps that depends on whether Peter is prepared to maintain both 5.07.05 and 5.07.06
 
Tinine
Guru

Joined: 30/03/2016
Location: United Kingdom
Posts: 1646
Posted: 07:13am 17 Dec 2022
Copy link to clipboard 
Print this post

I'm betting that the 2MB versions will soon be phased out. That's the way things tend to go.  




Craig
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6810
Posted: 08:43am 17 Dec 2022
Copy link to clipboard 
Print this post

In that respect Peter's idea of keeping, say, 5 flash slots makes sense. The mechanism stays in place and any future Pico versions with more flash could simply dump the extra space into the file system (or the option is still there to increase the number of flash slots). Ok, at the moment it means having less space on a current PicoMite, but most of us could probably live with that I think.

@Grogster
Carry on dreaming. :)  WAV files are a lot bigger than MP3. Mind you, you can store them on a SD card for now. No need for a MP3 decoder really.
Edited 2022-12-17 18:44 by Mixtel90
Mick

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

Joined: 05/03/2018
Location: Netherlands
Posts: 4253
Posted: 10:39am 17 Dec 2022
Copy link to clipboard 
Print this post

  Grogster said  .

Or just do away with the slots altogether IF you elect to format a flash filesystem.
IE: You can use flash slots by default, but if you elect to format a flash filesystem, the space used by the flash slots is gobbled up and becomes part of the filesystem pool.

...or am I being too brutal with that suggestion?    


+1
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9137
Posted: 10:58am 17 Dec 2022
Copy link to clipboard 
Print this post

I wasn't aware I offered anything other than a change to the number of flash slots. You can't use chain with files as loading a file kills the variable memory. Chain is clearly a useful function for some. There will be one version with a defined number of flash slots. No flexibility and no second version.

My instinct is to set either 4 or 5 slots. Each slot uses about 100K and the firmware is currently about 640K
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2079
Posted: 11:27am 17 Dec 2022
Copy link to clipboard 
Print this post

  matherp said   loading a file kills the variable memory.


which explains stuff like this in VARTABLE:

00C0  4E 00 42 42 4C 45 53 00 26 FD 9C 87 1F 71 36 84   N.BBLES.&?.q6?
00D0  64 74 D3 77 4D 9F 58 74 04 80 89 3C 6F D4 7B BE   dt?wM?Xt.??<o?{?
00E0  01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
00F0  00 00 4F 70 74 69 6F 6E 00 00 70 43 65 20 30 0A   ..Option..pCe 0.

0100  42 00 44 69 6D 20 61 24 28 39 29 0A 20 44 69 6D   B.Dim a$(9). Dim
0110  20 69 6E 74 65 67 65 72 20 66 72 65 64 0A 20 43    integer fred. C
0120  02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
0130  00 00 FF 31 0A 0A 20 50 F0 D4 00 A0 0A 20 46 6F   ..?1.. P??.?. Fo

0140  4D 00 6E 3D 30 20 54 6F 20 35 31 31 20 53 74 65   M.n=0 To 511 Ste
0150  70 20 31 36 0A 20 20 62 24 3D 22 22 0A 20 20 50   p 16.  b$="".  P
0160  01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
0170  00 00 22 3B 0A 20 20 46 00 00 20 41 3D 30 20 54   ..";.  F.. A=0 T


I had my suspicions it was being used as a buffer.
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 512
Posted: 11:52am 17 Dec 2022
Copy link to clipboard 
Print this post

  matherp said  I wasn't aware I offered anything other than a change to the number of flash slots. You can't use chain with files as loading a file kills the variable memory. Chain is clearly a useful function for some. There will be one version with a defined number of flash slots. No flexibility and no second version.

My instinct is to set either 4 or 5 slots. Each slot uses about 100K and the firmware is currently about 640K


Hi Peter, are these memory figures about the same for both versions? Standard & VGA.
So approximately on a 2MB Pico, with 5 flash slots there would be about 860kB for the flash file storage? All very back of envelope.
I vote for 5, because that gives a reasonable number of slots & quite a lot of flash storage, which will get bigger if you have more total flash.
Regards Kevin.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6810
Posted: 12:21pm 17 Dec 2022
Copy link to clipboard 
Print this post

If there's to be a single version then I too vote for five flash slots as I love using them during development. If I want a lot of data storage then there's always SD card, even if it's slower.

The idea of using a flash slot for a menu. Another for a logging progrm, storing it's data into flash data files then  a third to read that data and graph/send or whatever rather appeals. :)
Mick

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

Joined: 11/12/2012
Location: United Kingdom
Posts: 9137
Posted: 12:29pm 17 Dec 2022
Copy link to clipboard 
Print this post

Here is a very early version to play with. The flash drive is always available and is created on first boot. NB loading this version will erase all options etc. Support for the flash drive is from littelfs



PicoMite.zip


New command

DRIVE drive$
drive$ can be "a:" or "b:" where a: is the flash drive and b: is only available if a sd card has been enabled. This sets the default drive where commands like load, save, files, xmodem etc. will execute. NB similar to original Maximite.
On boot the default drive will be the SD card if enabled otherwise the flash drive.
Use DRIVE "A:/FORMAT" to re-initialise the flash drive

new variants of copy

COPY A2B fname1$ to fname2$ 'copies file from flash to sd card
COPY B2A fname1$ to fname2$ 'copies file from sd card to flash

MM.INFO(OPTION FLASH SIZE) should give the size of the flash memory. Please confirm this works if you have versions with non-standard flash

MM.INFO(DISK SIZE) and MM.INFO(FREE SPACE) work on the default drive

LOAD, SAVE, XMODEM, LOAD IMAGE, LOAD JPG, OPEN, CLOSE etc. should all work on the flash drive including support for multiple files open

Directory commands (mkdir etc.) not available on flash and may cause crash if this is the default drive.
Audio wav playback not working yet

Next possible changes are to enable A: and B: in filenames, improve files command for flash drive, and implement directories on the flash drive.

BUGS HIGHLY LIKELY - please report

UPDATE play wav now working



PicoMite.zip
Edited 2022-12-18 02:40 by matherp
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 512
Posted: 05:24pm 17 Dec 2022
Copy link to clipboard 
Print this post

Hi Peter,
Just downloaded to test, but I've only got a VGA Picomite free at the moment, any chance of a version for the VGA. Thanks.
Regards Kevin.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9137
Posted: 06:06pm 17 Dec 2022
Copy link to clipboard 
Print this post

  Quote  any chance of a version for the VGA


not for some time - sorry

NB: file and directory names on the flash file system are case sensitive a-la unix
Edited 2022-12-18 04:07 by matherp
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4253
Posted: 06:37pm 17 Dec 2022
Copy link to clipboard 
Print this post

Hi Peter

Not sure if you have already implemented EOF() ?
Or I am doing something wrong ?

'test for flash file system

open "file1.txt" for output as #1

'write 1000 variables into file1.txt separated by <CR>
for i=1 to 1000
 print #1,i
next i
close #1
files


'read the 1000 values back, and copy to file2.txt
open "file1.txt" for input as #1
open "file2.txt" for output as #2

n=0
do
 input #1,a
 print #2,a
 n=n+1
loop until eof(1)
print n;" values copied"

close #1
close #2

files


When I replace the "EOF(1)" with "n=999" then it works.
But still the file size on file2 is not equal to file1.

Also if I write strings to file1.txt (print #1,str$(i)), and copy strings in the second part of the program, the file2 filesize is not the same as the file1 filesize.
Edited 2022-12-18 04:41 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 359
Posted: 07:10pm 17 Dec 2022
Copy link to clipboard 
Print this post

Tested on this type:


It has a Winbond 25Q32 flash (4MB). Seems to be OK.

 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6101
Posted: 09:37pm 17 Dec 2022
Copy link to clipboard 
Print this post

After a quick test with MMEdit,
You can copy files to the flash drive OK using xmodem but can not copy from the flash drive. This is because the FILES listing is formatted differently to the listing from the SDcard. MMCC does not find the file name.
I is simple enough for me to allow for this difference and will update MMEdit 'soon'

Change drives before starting the file-manager to use MMCC with both SD and flash drives.

Jim
VK7JH
MMedit   MMBasic Help
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9137
Posted: 09:52pm 17 Dec 2022
Copy link to clipboard 
Print this post

  Quote  Not sure if you have already implemented EOF() ?
Or I am doing something wrong ?


Definite bug - will look at it tomorrow
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 11:36pm 17 Dec 2022
Copy link to clipboard 
Print this post

@ CaptainBoing: Removed your post about the double-up.  I don't know why either, but as your original post did make it to the forum...

@ Mixtel90:
  Quote  @Grogster
Carry on dreaming. :)  WAV files are a lot bigger than MP3. Mind you, you can store them on a SD card for now. No need for a MP3 decoder really.


Well, yes and no.
Full HiFi stereo WAV, yes - they are just too big for a small flash drive like the one being proposed here.  But low-fi mono WAV files are considerably smaller, and that is all I need.  The application I have in mind, is just a talking computer kind of thing, so only needs to support a frequency response up to around 2kHz, and mono only, so you can get files down to only a few hundred K like that, and still be WAV.  Definitely no good for music, but fine for speech.  That was what I was thinking about.  Certainly not thinking about an embedded music player or anything like that.  
Smoke makes things work. When the smoke gets out, it stops!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6101
Posted: 03:15am 18 Dec 2022
Copy link to clipboard 
Print this post

Getting there:



Everything seems to work but it gets upset if you try to change to drive A: when you are already on drive A:

I need to add state checking to prevent that sort of thing.

I think I will add a "LOAD" button to transfer selected file to the main program memory ready to RUN

Jim
VK7JH
MMedit   MMBasic Help
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4253
Posted: 07:15am 18 Dec 2022
Copy link to clipboard 
Print this post

@Peter

As far as I can see there both problems

'test for flash file system

'drive "b:"

open "file1.txt" for output as #1
for i=1 to 1000
 print #1,str$(i)
next i
close #1

'files

open "file1.txt" for input as #1
open "file2.txt" for output as #2

n=0
do
 input #1,a$
 print a$
 print #2,a$
 n=n+1
loop until n=1000 'eof(1)
print n," values copied"

close #1
close #2

'files


1 - EOF() not implemented
2 - writing/reading of data is corrupted. Also for drive "B:".
   I expect the problem is in reading the data. Since the file size of file1.txt is
   correct. But when reading the strings they all look empty. And writing empty
   strings gives a shorter file2.txt.

Item 2 occurs in both flash drive and SD, the program runs fine in 5.07.05 (on SD card).

By the way, the previous version (5.07.05RC8) complains that FILES is not available inside a program. But 5.07.06 does not.

Volhout

P.S. what happens to 5.07.05 ? Is it officially released now ? Or still in Release Candidate ? On Geoff's website, I see 5.07.04 as official version. But there are soo many improvements in 5.07.05 that is could be worth releasing it.
Edited 2022-12-18 17:39 by Volhout
PicomiteVGA PETSCII ROBOTS
 
     Page 2 of 5    
Print this page
© JAQ Software 2024