Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:57 01 Aug 2025 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 : Armmite L4: File support

Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 08:03pm 19 Nov 2018
Copy link to clipboard 
Print this post

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.







Edited by matherp 2018-11-21
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 12:51am 20 Nov 2018
Copy link to clipboard 
Print this post

this is a major advancement roughly, what is the flash footprint of adding LittleFS support? is it something that could be back-ported to the MX170-based micromites, even if just as a c-function stashed away in the library?


cheers,
rob :-)
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 04:18am 20 Nov 2018
Copy link to clipboard 
Print this post

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: Netherlands
Posts: 5089
Posted: 08:07am 20 Nov 2018
Copy link to clipboard 
Print this post

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....

Edited by Volhout 2018-11-21
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 09:35am 20 Nov 2018
Copy link to clipboard 
Print this post

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 Edited by matherp 2018-11-21
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4044
Posted: 09:50am 20 Nov 2018
Copy link to clipboard 
Print this post

  matherp said   if there is a pause in the interrupt...... (you don't do that do you?!!!!)

Make it an error?

It's terrible coding!

John
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 12:07pm 20 Nov 2018
Copy link to clipboard 
Print this post

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

Edited by matherp 2018-11-22
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 06:46pm 20 Nov 2018
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 10310
Posted: 07:06pm 20 Nov 2018
Copy link to clipboard 
Print this post

  Quote  would you use something like THIS ?


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.




  Quote  Is the method of dragging and dropping the .bin file only supported with the extra parts on the development board that allow this method?


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 Kingdom
Posts: 2170
Posted: 07:55pm 20 Nov 2018
Copy link to clipboard 
Print this post

  robert.rozee said   this is a major advancement roughly, what is the flash footprint of adding LittleFS support? is it something that could be back-ported to the MX170-based micromites, even if just as a c-function stashed away in the library?
)


+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.Edited by CaptainBoing 2018-11-22
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 03:42am 21 Nov 2018
Copy link to clipboard 
Print this post

  matherp said  
Fixes a bug when using settick with pauses in the main program.

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.

  Quote   CPU 48
DIM n
SETPIN D13, DOUT
PIN(D13) = 0

SETTICK 1000, flick

DO
IF n > 5 THEN PAUSE 100

IF flickit = 1 THEN
flickit =
0
PULSE D13, 50
n = n +
1
PRINT n
ENDIF
LOOP
END

SUB flick
flickit =
1
END SUB


Jim
VK7JH
MMedit
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1003
Posted: 05:07am 21 Nov 2018
Copy link to clipboard 
Print this post

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.

  Quote  
'CPU Power
'80 11.2mA
'48 6.43mA default
'32 4.44mA
'24 3.45mA
'16 2.49mA
'8 1.4mA
'4 0.9mA
'2 0.65mA
'PAUSE 0.57mA - unless PWM is active
'SLEEP 1.8uA

CPU 48
CLS
DIM n
SETPIN D13, DOUT
PIN(D13) = 0
SETTICK 1000, flick
DO
IF n > 30 THEN PAUSE 100

IF flickme=1 THEN
PULSE D13, 50
n = n +
1
'PRINT n
flickme=0
text 10,10,str$(n)+" "

endif

LOOP
END

SUB flick
flickme=
1
END SUB


Latest F4 Latest H7 FotS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 10:46am 21 Nov 2018
Copy link to clipboard 
Print this post

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: Australia
Posts: 6283
Posted: 09:46pm 21 Nov 2018
Copy link to clipboard 
Print this post

I started with CPU 80 and changed it to CPU 48 at the start of the program
  Quote   CPU 80
PRINT "CPU 80"
PAUSE 100
CPU 48
PRINT "CPU 48"


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 Kingdom
Posts: 10310
Posted: 08:03pm 22 Nov 2018
Copy link to clipboard 
Print this post

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: Australia
Posts: 6283
Posted: 08:12pm 22 Nov 2018
Copy link to clipboard 
Print this post

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: Australia
Posts: 1114
Posted: 06:15am 05 Jan 2019
Copy link to clipboard 
Print this post

.
... 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 Zealand
Posts: 9610
Posted: 01:35am 28 Jan 2019
Copy link to clipboard 
Print this post

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!
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025