![]() |
Forum Index : Microcontroller and PC projects : Picomite(VGA) V5.07.06 betas - flash drive support
![]() ![]() |
|||||
Author | Message | ||||
Tinine Guru ![]() Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Just grab a different RP2040 device with more flash. Mine have 8MB and 16MB models are available. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7505 |
You'd have to fight those who like and use the flash slots too. :) Not everyone needs fast flash file storage - in fact it's not normally needed for data logging, where a SD card is usually of far more use even if it's slower. If finding space for a SD card is the problem I've already piggy-backed a micro-SD card holder on top of a PicoMite so it uses no extra PCB area. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9486 |
Well, I was for removing all the flash slots IN THE BEGINNING, but I can see the logic of keeping five of them, that way you are adding features(the flash disk) rather then taking them away(as you would be if you took away all the flash slots). I've been playing about with ver 5.070606 for the last few days over Christmas, including leaving it running for about the last 48 hours, and it has been working a treat and I have no errors to report. In fact, it is working SO well, I have just decided to drop use of the 24FC01 EEPROM's I had just been playing with, and just use a file on the flash disk. Not that reading or writing to EEPROM's is hard, but reading from a text file on the flash disk is even easier and can be done in one line of code(LINE INPUT), so.... That has also freed up PCB real-estate where the EEPROM chip was, and the need for 1x 100n cap and 2x 4k7 resistors in SMD - less parts to install. ![]() The next thing I need to do, is start reading my way through the PIO tutorial and trying some of those things out, as I have a little bit of spare time over the holidays, and that is one thing I promised myself I would do. Smoke makes things work. When the smoke gets out, it stops! |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2400 |
i would agree - the concept of flash slots was to overcome the absence of any sort of file system usage that was compatible with the way the pico's (onboad) flash chip was used. that problem has now been overcome, as peter has worked around all the limitations of using the onboard flash. an approach may be to have .BAS files and .BIN files, where a .BAS file is compiled into a .BIN file. where a .BIN file exists on the onboard flash, then it is run directly from there, if it exists on an external SD card, then it is copied to a SINGLE slot that is reserved on the onboard flash from where it can be run. if this was done, would typical usage cause excessive flash wear? one big advantage of .BIN files is that they do NOT each consume a FIXED size (100k or thereabouts) block of flash space. cheers, rob :-) Edited 2022-12-27 18:52 by robert.rozee |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7505 |
I suspect that you effectively need an external OS to do that if you want to chain programs. It has to be able to handle the file and variables transfer without using any of the resources required by either the old or the new chain sections. It may not be possible to do this given the constraints of the RP2040. Personally I don't see a problem now. There are close enough copies of the Pico with a lot more flash on board if that's important. Likewise, keeping some flash slots has retained some compatibility. You are still probably better using SD cards for data files if you are bothered about flash wear anyway as they are designed to handle it. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2417 |
The reduced number of flash slots can be offset somewhat by having smaller programs share a slot. Turn them into subroutines of a menu program. Select Case is perfect for this. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9486 |
In my case, the EEPROM I was planning to use was going to essentially be a WORM device, even though EEPROM's are not. The unit they are fitted to, is always the same, electronically, and the EEPROM(which is on a small module that can be removed from the host unit) just tells each unit, the unit-specific details at start-up, then it is basically ignored from that point on - till next boot up. Dropping that concept means I don't need the EEPROM module anymore and can store the data in a simple text file that is read at start-up(I could even use VAR SAVE/RESTORE), but it also means that each unit's PicoMite module has to have the text file(or variables) custom written for that unit. But it is six of one and half a dozen of the other, cos I still had to do that with the removable EEPROM's also, so having to do that takes no longer then having to write the EEPROM and plug it in to each unit. It may in fact, be quicker, with no module writing and swapping/plugging etc. I plan to use one of the flash slots as a dedicated writer for that file, and the main slot as the program that reads and uses that data. As I am reading it 99% of the time and not writing to that file, I don't expect flash endurance to be an issue - for me. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2139 |
I had a similar thing with my snooker table controller. I have a couple of hundred identical units (170 based) and each one needs some "personality" info at switch-on. I used VAR SAVE/RESTORE and if a variable was clear after a restore then I knew it was un-initialized and it prompted on the console.. This was then VAR SAVEd and it never asked again... Here's the code, fairly straightforward... might give you an idea: VAR RESTORE FlagSet 3 ' just booted IF MyAddr=0 THEN DO DO INPUT "Enter Node address (1-998) >", a$ MyAddr=int(val("0"+a$)) LOOP UNTIL MyAddr >0 AND MyAddr<999 DO INPUT "Enter Node Task Name >", a$ MyJob=a$ LOOP UNTIL MyJob<>"" PRINT "Is this correct? (Y/N)"; DO:INPUT a$:a$=UCASE$(a$):LOOP UNTIL a$="Y" OR a$="N" LOOP WHILE a$="N" VAR SAVE MyAddr,MyJob FlagSet 6 ' Just completed setup - need INIT END IF Post install, I go around to each module and plug into the exposed console port (3.5mm stereo jack), press the reset button, it prompts for its details and starts running, close up and move to next. very quick. where/how you store the info is down to you. Edited 2022-12-28 20:47 by CaptainBoing |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
Version 5.07.06b8 https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip Fixes a bug using append mode for opening a file on the flash file system NB: Programs intending to use the SDcard must include the command - DRIVE "B:" or file I/O will default to the flash file system Edited 2022-12-31 19:07 by matherp |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 4854 |
@Peter, Is it an option to default to sd card when a card is detected at power up? Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
That was my original approach but I changed it for the reason vegipete cites below. Remember you can always use fully qualified filenames irrespective of the default/active drive OPEN "B:/myfile.dat" for append as #1 Edited 2023-01-01 05:16 by matherp |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
Version 5.07.06b9 https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip PicoMite and PicoMiteVGA New MATH command and function ? MATH(RAND) ' generates a random number 0.0 <= n < 1.0 using the "Mersenne Twister: A 623-dimensionally * equidistributed uniform pseudorandom number generator. If not seeded with MATH RANDOMIZE the first usage seeds with the time in microseconds since boot MATH RANDOMIZE [n] 'seeds the Mersenne Twister algorithm. If n is not specified the seed is the time in microseconds since boot The Mersenne Twister algorithm gives a much better random number than the C-library inbuilt function NEW TRIANGLE commands TRIANGLE SAVE [#]n, x1,y1,x2,y2,x3,y3 'saves a triangular area of the screen to buffer #n. Only works on VGA and displays that support BLIT and transparent text TRIANGLE RESTORE [#]n 'restores a saved triangular region of the screen and deletes the saved buffer. PicoMite only New FRAMEBUFFER command for colour SPI displays FRAMEBUFFER CREATE creates a framebuffer with RGB121 resolution to match the configured SPI colour display FRAMEBUFFER LAYER creates a framebuffer with RGB121 resolution to match the configured SPI colour display FRAMEBUFFER WRITE where 'specifies "where" graphics commands will write. "where" can be N, F, or L where N is the actual display. FRAMEBUFFER COPY from, to 'does a highly optimised full screen copy of one framebuffer to another. "from" and "to" can be N, F, or L where N is the actual display. You can only copy from N on displays that support BLIT and transparent text. The firmware will automatically compress or expand the RGB resolution when copying to and from unmatched framebuffers. Of course copying from RGB565 to RGB121 loses information but for many applications (e.g. games) 16 colour levels is more than enough FRAMEBUFFER CLOSE [which] 'closes a framebuffer and releases the memory. "which" can be F or L. If omitted closes both. FRAMEBUFFER BLIT from, to, x_from, y_from, x_to, y_to, width, height 'moves a subsection of one framebuffer from one to another. x_from and y_from define the coordinates of the top left of the area to be copied with "width" and "height" x_to and y_to define the coordinates of the top left of the area to receive the copy with "width" and "height" You can only copy from N on displays that support BLIT and transparent text. This command cannot be optimised as well as the full framebbuffer copy and if the area is greater than about 150x150 then a full screen copy may be preferred. See https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=15427 for example usage of the FRAMEBUFFER command Edited 2023-01-02 01:00 by matherp |
||||
Michal Senior Member ![]() Joined: 02/02/2022 Location: PolandPosts: 125 |
How do they differ?: FRAMEBUFFER CREATE creates a framebuffer with RGB121 resolution to match the configured SPI colour display and FRAMEBUFFER LAYER creates a framebuffer with RGB121 resolution to match the configured SPI colour display Michal |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
They don't. I'm just using the same nomenclature as the VGA version. They just allow you to have two framebuffers as in the demo |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 4854 |
Hi Peter, Should I prepare for a change in the PIO helper function for EXECCTRL in the PIO training ? I mentioned this before, but you may have missed it, or may not be intending to change it. The current helper functions for PINCTRL accept a number for the number of pins in a range, and a GPx reference for the starting of the range of pins. The EXECCTRL helper function requires a number for the pin that must be assigned for conditional JMP's, it does not accept a GPx reference (GPx would be more logical since it points to a single pin). Regards, Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
I'll make it compatible with PINCTRL. i.e. because it is PIO you can only use the GPno with or without the GP prefix Now you are really into PIO is there anything else that I should be putting into Basic to better support the MMBasic/PIO interoperability? Edited 2023-01-03 02:43 by matherp |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 4854 |
Hi Peter, Yes, there is one other thing I would like to add. It relates to the helper function for SHIFTCTRL. PIO (SHIFTCTRL push_threshold [,pull_threshold] [,autopush] [,autopull]) Could you please add the booleans that control the shift direction. These are bit 18 and 19 of the register. ![]() This will be part of the training if you add it. There are many area's I did not even touch yet, so this may be not complete (I have not even touched IRQ's myself). In the EXECCTRL there is a bit SIDE_PINDIR that sounds useful. You can use it to create a serial open drain bus. There is much more, but adding too much will likely confuse more than it adds. When in doubt I can always directly write to the register. Regards, Volhout Edited 2023-01-03 05:23 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
I think they are there but perhaps the manual needs updating tp = checkstring(ep, "SHIFTCTRL"); if(tp){ getargs(&tp,11,","); if(argc<1)error("Syntax"); iret=(getint(argv[0],0,31)<<20); // push threshold iret|=(getint(argv[2],0,31)<<25); // pull threshold if(argc>3 && *argv[4])iret|=(getint(argv[4],0,1)<<16); // autopush if(argc>5 && *argv[6])iret|=(getint(argv[6],0,1)<<17); // autopull if(argc>7 && *argv[8])iret|=(getint(argv[8],0,1)<<18); // IN_SHIFTDIR if(argc>9 && *argv[10])iret|=(getint(argv[10],0,1)<<19); // OUT_SHIFTDIR targ=T_INT; return; } Will add SIDE_PINDIR |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 4854 |
Hi Peter, I'll try the SHIFTCTRL tomorrow. Good news. It can be used in PIONES and chapter 9 of the training. The training does not contain I2C, so the SIDE_PINDIR is not high prio. If, it will come after chapter 10... in 2 weeks or so... Regards, Volhout EDIT: I have given it a nights sleep, and would propose to also implement the SIDE_ENABLE flag in the EXECCTRL helper. Reason is that I checked in the RP2040 manual, and SIDE SET is dominant over OUT and SET. So if we ever want to write a shift-out using the OSR with a side set on the same pin (like a UART start bit and stop), the side set will overrule the OUT status. Only SIDE_ENable can get this to work. Edited 2023-01-03 17:47 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |