![]() |
Forum Index : Microcontroller and PC projects : Armmite L4: File support
Author | Message | ||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Please find attached version 5.04.37 2018-11-20_060037_ArmmiteL4.zip This includes a comprehensive implementation of LittleFS to provide a file capability for the Armmite L4. The file storage medium is an 8-pin SPI flash memory chip. Supported chips are the Winbond W25Q32, the Winbond W25Q64, and the Winbond W25Q128 providing between 4 and 16 Mbytes of storage. The two bigger chips are as yet untested. Limitations/differences compared to a full SDcard implementation are: Single file open at a time Single top level directory Filenames are limited to 31 characters Filenames are case sensitive The top two could be addressed at a later date but for the intended applications they don't seem necessary. Wiring of the SPI flash is as follows: Pin 1 : Chip select, connect to any free pin on the uP Pin 2 : SPI data out, connect to SPI2-IN (D12) on the uP Pin 3 : _Write enable, connect to GND pin 4 : GND, connect to GND pin 5 : SPI data in, connect to SPI2-OUT (D11) on the uP pin 6 : SPI clock, connect to SPI2-CLK (D13) on the uP pin 7 : RESET, connect to RST on the uP pin 8 : VCC, connect to 3.3V ![]() To enable the flash memory use the command: OPTION FLASH CSpin CSpin can be specified as the pin number or the pin ID (e.g. D3) The code will automatically format the flash the first time it is enabled. All of the normal file commands should then work: Open "filename" for MODE as #n print #n input #n input$(num, #n) xmodem send "filename" xmodem receive "filename" load "filename" save "filename" loc(#n) lof(#n) eof(#n) files ["mask"] seek #n, pos close #n name "old filename" as "new filename" kill "filename" There is a small difference for DIR$. The new syntax is just: dir$("mask") for the first call and then dir$() for subsequent calls. Any time dir$ is called with a mask it will reset the search. The MMEDIT filemanger is fully functional ![]() The system will create and maintain a file "bootcount" on the flash memory. This keeps a count of the number of times the uP is restarted and can be interrogated with the function MM.BOOTCOUNT. The file can be deleted but will be re-created on next reboot. The flash can be manually re-formatted with the command FORMAT. This re-writes a blank index on the memory and access to all existing files is lost. |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
this is a major advancement ![]() cheers, rob :-) |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Yes, I 2nd that Rob. It would be very useful to have on the 170's, hell, even on the MM+ I could see that being useful. Smoke makes things work. When the smoke gets out, it stops! |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5089 |
This would be great for the 170 !!! Even if it eats 10k of RAM/ROM it would so much enhance these smaller micromites. This would even make it worth designing a new 170 backpack PCB, just to incorporate the winbond chip. Needs only 1 pin extra since SPI is already shared with display and touch. Or a new backpack with the ARM on it.... PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Minor update - no version change Fixes a bug when using settick with pauses in the main program. The Pause processing is quite complex as it slows the clock to save power but must speed it to process a MMBasic interrupt and then slow it down again to continue the pause. Then if there is a pause in the interrupt...... (you don't do that do you?!!!!) 2018-11-20_193454_ArmmiteL4.zip |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
Make it an error? It's terrible coding! John |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Received some chips and breakout boards from Farnell this morning so all up and running without the ST-LINK. Minor update needed to support the now-tested 128Mbit Flash chips. 2018-11-21_025725_ArmmiteL4.zip ![]() ![]() To solder it wasn't a problem, I tinned the connection on the breakout and applied lots of flux as in the first picture. Then I located the chip and applied the heatgun until the solder melted. The chip sat down nicely into the solder and all the pins checked out. Required connections were: Pin 1 - 3.3V Pin 2 - 32KHz Xtal with 4.7pf cap to GND Pin 3 - 32KHz Xtal with 4.7pf cap to GND Pin 4 - 10K pullup to 3.3V Pin 5 - 3.3V Pin 8 - USB/UART RX Pin 16 - GND Pin 17 - 3.3V Pin 25 - USB/UART TX Pin 31 - 10K to GND Pin 32 - GND I used 0.01uF, 0.1uf, and 2.2uF decoupling on both rails The taped together connection is for the ST-LINK programmer from a full-size Nucleo used to program the chip Pins are: ST-LINK Pin 1 - 3.3V ST-LINK Pin 2 - uP Pin 23 ST-LINK Pin 3 - GND ST-LINK Pin 4 - uP Pin 24 ST-LINK Pin 5 - uP Pin 4 NB: the STM32L4 doesn't need any sort of VCAP just sensible power de-coupling |
||||
viscomjim Guru ![]() Joined: 08/01/2014 Location: United StatesPosts: 925 |
matherp, this is getting pretty neat! To program the chip without it being on a development board, would you use something like THIS ? Is the method of dragging and dropping the .bin file only supported with the extra parts on the development board that allow this method? All pretty new to me, so sorry for the noob questions. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Should be OK. I just use the top part of a Nucleo PCB which I broke off from one I killed. Also has the advantage it provides a USB/UART. ![]() No, this is a function of the ST-LINK processor. The question mark over a clone is whether this is properly implemented and up-to-date. Certainly the one you linked doesn't support the USB/UART functionality |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
+1 what a treat! I am already using Pete's Winbond 4M routines from a few months back on a project but a proper file system on a 170 would be a dream. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Close but no cigar. It runs happily with CPU speed 32 or lower but still hangs with CPU 48. It also runs happily with CPU 80 although I haven't given that a long test yet. Jim VK7JH MMedit |
||||
disco4now![]() Guru ![]() Joined: 18/12/2014 Location: AustraliaPosts: 1003 |
I played with code very similar to Jim's and was just about to post same findings. Seems OK on all speeds other than the default 48. Latest F4 Latest H7 FotS |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Traveling today and tomorrow. I tested on 48 until count greater than 2000. Do you see the problem if you go to speed other than 48 and then back to 48? |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
I started with CPU 80 and changed it to CPU 48 at the start of the program It didn't help. I can get it to continue with a PAUSE of 1 mS but any longer and it hangs. Jim VK7JH MMedit |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
I'm wondering if I posted the wrong version. I've just run both tests and am currently at 3000 count with no issues at 48MHz This is definitely what I am running 2018-11-23_060306_ArmmiteL4.zip |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
That looks better! 48MHz has just scored a century. I will test it for a bit longer then try the other speeds to be sure but looking good so far. Thanks Jim VK7JH MMedit |
||||
panky![]() Guru ![]() Joined: 02/10/2012 Location: AustraliaPosts: 1114 |
. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Could this be ported to the MM+ series of chips, or is it strictly an L4 feature? Smoke makes things work. When the smoke gets out, it stops! |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |