Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 17:25 10 Nov 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 : MM+: Pictures on serial flash

Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10565
Posted: 05:55am 16 Sep 2016
Copy link to clipboard 
Print this post

In this thread we developed code to use a serial flash chip (e.g.Winbond 25Q32) for some data logging activities.

These chips are particularly convenient because they can be mounted on the back of many TFT displays



For an application I'm writing I need to display some images but don't want to use an SD card for the runtime code so it seemed sensible to store them on the serial flash chip.

To do this I have written a program that reads an image off SD card and then stores it on the flash.

There is only one function:

storepic(1000,"leopardA.ppm")


This takes the image file "leopardA.ppm" and stores it from page 1000 upwards on the flash chip. The image file on the SDcard must be in ASCII .PPM format.

A 800x480 24-bit image file takes 88 seconds to write to the flash card and takes 4717 pages of the flash (a 32Mbit flash chip has 16384 pages). You can store as many images as there is space on the flash chip but it is your responsibility to make sure the pages used don't overlap. The storepic routine reports flash usage to help with this.

To display the picture there is a similarly simple function

displaypicture(1000,0,0)


1000 is the start page of the picture in the flash as defined in the storepic example command and the two zeroes are the x,y coordinates of the top left of the picture.

The displaypicture command only takes 2.7 seconds for a 800x480 24-bit image, much faster (5x) than displaying from SDcard.

The programs should run on any Micromite+ but note you need to uncomment the appropriate display CFunctions for 64 or 100-pin.

In both programs you need to define the MM+ pin that is connected to the F-CS connection on the display (see picture). Version 1A of the Explore100 ties this pin high and won't work - I haven't got a later version to test with.

The flash handling CFunctions are exactly the same as those in the logging thread with the exception that the read command has been turned from a subroutine into a function returning a string which is now possible since V5.2 of the MM+ firmware.

Store program

option explicit
option default none
dim integer i
const cspin=21 'chip select pin for serial flash chip
'
' Example program to demonstrate storing pictures on a serial flash chip mounted on a SSD1963
' Compatible with 64 and 100 pin MM+ processors
'
print "Initialising memory chip with";
print initchip(1,cspin), " pages" 'iniitialise the chip with full erase
timer=0
storepic(1000,"leopardA.ppm")
print timer
end
'
'****************************************
'
'
function initchip(eraseit as integer, cspin as integer) as integer
local d$
local integer i=getpagecount(d$,cspin)*256
if eraseit then
if not (erasechip(i,cspin)) then
print "erase failed"
end
endif
' print "Erase complete"
endif
initchip=i\256
end function
'
Sub storepic(location%, PIC$)
LOCAL inbuff$,binbuff$,outbuff$=""
local p%=0
print "Starting picture at page ",location%
open pic$ for input as #1
line input #1,inbuff$
if inbuff$="P3" then
writepage(location%,"P6",cspin): location%=location%+1
do
line input #1,inbuff$
if len(inbuff$)<40 then
writepage(location%,inbuff$,cspin): location%=location%+1
endif
loop while len(inbuff$)<40
binstring(inbuff$,outbuff$)
do while not eof(#1)
line input #1,inbuff$
binstring(inbuff$,binbuff$)
if len(outbuff$)+len(binbuff$)>255 then
writepage(location%,outbuff$,cspin): location%=location%+1
p%=p%+len(outbuff$)
outbuff$=binbuff$
else
outbuff$=outbuff$+binbuff$
endif
loop
writepage(location%,outbuff$,cspin)
p%=p%+len(outbuff$)
print "Ending picture at page ",location%, " ",p%," bytes written"
else
print "Invalid picture format - should be ASCII .PPM"
endif
end sub
'
CSub binstring
00000000
90820000 00821821 90660000 24030020 10C30004 24060020 24420001 00821821
A0660000 28430002 14600015 240A0001 24030001 240B0020 00003021 00833821
90E70000 00064840 000640C0 01284021 24630001 10EB0005 24E9FFD0 1462FFF7
01283021 10000009 00AA1021 00AA4021 0062382A A1060000 14E0FFEF 254A0001
2544FFFF 03E00008 A0A40000 A0460000 1000FFFB 254A0001
End CSub

CFunction getpagecount
00000000
27BDFFC8 AFB30028 AFBF0034 AFB50030 AFB4002C AFB20024 AFB10020 AFB0001C
8CB10000 3C029D00 8C420088 00111880 00621021 8C420000 24030008 10430007
00809821 3C029D00 8C420010 02202021 24050008 0040F809 00003021 3C02BF81
8C44F220 3C029D00 8C430088 3C020580 7C84D800 3442B053 00821026 24050014
24040030 00A2200B 00831021 8C430000 24020065 1062006F 3C02BF81 8C45F220
3C030580 3C029D00 8C420010 3463B053 7CA5D800 00A32826 24040005 2403000C
0065200A 00003021 0040F809 24050008 3C02BF81 8C45F220 3C030580 3C029D00
8C420010 3463B053 7CA5D800 00A32826 24040005 2403000C 0065200A 00003021
0040F809 24050064 3C02BF81 8C45F220 3C030580 3C029D00 8C420010 3463B053
7CA5D800 00A32826 2404002F 2403000B 0065200A 00003021 0040F809 24050002
3C02BF81 8C45F220 3C030580 3C029D00 8C420010 3463B053 7CA5D800 00A32826
2404002F 2403000B 0065200A 00003021 0040F809 24050064 3C02BF81 8C45F220
3C030580 3C029D00 8C420010 3463B053 7CA5D800 00A32826 24040004 2403000A
0065200A 00003021 0040F809 24050008 3C02BF81 8C45F220 3C030580 3C029D00
8C420010 3463B053 7CA5D800 00A32826 24040004 2403000A 0065200A 00003021
0040F809 24050064 3C02BF81 8C43F220 3C020580 3442B053 7C63D800 1462000C
3C03BF81 8C64FA90 24050001 3C02BF81 7CA41804 AC64FA90 8C43FCA0 24040006
7C831804 AC43FCA0 1000000B 3C029D00 8C64FA90 24050007 3C02BF81 7CA41804
AC64FA90 8C43FC9C 24040006 7C831804 AC43FC9C 3C029D00 8C42001C 02202021
0040F809 24050006 3C02BF80 34038060 24040C00 AC435A00 AC445A40 24040001
AC445A30 3C03BF80 AC405A20 8C625A10 30420080 1040FFFD 3C029D00 8C42001C
3C10BF80 02202021 24050005 8E125A20 0040F809 00000000 2402009F AE025A20
3C03BF80 8C625A10 30420080 1040FFFD 3C02BF80 8C435A20 3C03BF80 AC405A20
8C625A10 30420080 1040FFFD 3C02BF80 8C505A20 3C03BF80 AC405A20 8C625A10
30420080 1040FFFD 3C02BF80 8C555A20 3C03BF80 AC525A20 8C625A10 30420080
1040FFFD 3C129D00 8E42001C 3C03BF80 02202021 24050006 8C745A20 0040F809
00108200 24020010 AFA20010 02158021 8E420030 00108200 02148021 26640001
02003021 0040F809 00103FC3 3C02FF40 3442D9BF 02021021 24030006 2C420002
10400027 A2630000 3C029D00 8C42001C 02202021 0040F809 24050005 24030006
3C02BF80 AC435A20 3C03BF80 8C625A10 30420080 1040FFFD 3C129D00 8E42001C
3C13BF80 02202021 24050006 8E635A20 0040F809 00000000 8E42001C 02202021
0040F809 24050005 24020098 AE625A20 3C03BF80 8C625A10 30420080 1040FFFD
3C029D00 8C42001C 3C03BF80 02202021 24050006 8C635A20 0040F809 00000000
3C0200BF 24422642 24044000 12020012 00002821 3C0200BF 24422602 1202000E
3C0200BF 24422641 1202000B 24042000 3C0200BF 24422601 12020006 2694FFF8
24020001 0282A004 02802021 10000002 00142FC3 00002821 8FBF0034 00801021
00A01821 8FB50030 8FB4002C 8FB30028 8FB20024 8FB10020 8FB0001C 03E00008
27BD0038
End CFunction
'
CSUB writepage
00000000
27BDFFD8 AFB3001C AFB10014 AFB00010 AFBF0024 AFB40020 AFB20018 8CD30000
3C029D00 8C42001C 8C940000 24030001 3C10BF80 AE035A30 00A08821 02602021
0040F809 24050005 24020006 0014A200 AE025A20 3C03BF80 8C625A10 30420080
1040FFFD 3C109D00 8E02001C 3C12BF80 02602021 24050006 8E435A20 0040F809
00000000 8E02001C 02602021 0040F809 24050005 24020002 AE425A20 3C03BF80
8C625A10 30420080 1040FFFD 3C02BF80 7E843C00 8C435A20 3C03BF80 AC445A20
8C625A10 30420080 1040FFFD 3C02BF80 7E943A00 8C435A20 3C03BF80 AC545A20
8C625A10 30420080 1040FFFD 3C02BF80 8C435A20 3C03BF80 AC405A20 8C625A10
30420080 1040FFFD 3C02BF80 8C425A20 00008021 3C03BF80 24040100 02301021
80420000 AC625A20 8C625A10 30420080 1040FFFD 00000000 26100001 8C625A20
1604FFF7 02301021 3C029D00 8C42001C 02602021 0040F809 24050006 3C129D00
3C11BF80 8E420004 0040F809 24040064 8E42001C 02602021 0040F809 24050005
24020005 AE225A20 8E225A10 30420080 1040FFFD 00000000 8E225A20 AE305A20
8E225A10 30420080 1040FFFD 00000000 8E305A20 8E42001C 02602021 0040F809
24050006 32020001 5440FFE7 8E420004 8FBF0024 8FB40020 8FB3001C 8FB20018
8FB10014 8FB00010 03E00008 27BD0028
End CSUB
'


Display program

option explicit
option default none
'
const cspin=21
'
const forread=1
const forwrite=0
'
initchip(0,cspin)
cls
timer=0
displaypicture(1000,0,0)
print timer
end

Sub Displaypicture(l%, StartX%, StartY%)
LOCAL Buffer$
local a%,numbytes%
buffer$=readpage$(l%,cspin):l%=l%+1
if buffer$="P6" then
buffer$=readpage$(l%,cspin):l%=l%+1
if left$(buffer$,1)="#" then
buffer$=readpage$(l%,cspin):l%=l%+1
endif
a%=instr(buffer$,chr$(32)) ' look for the space between dimensions
local width%=val(left$(buffer$,a%-1))
buffer$=right$(buffer$,len(buffer$)-a%)
LOCAL height%=val(left$(buffer$,a%-1))
numbytes%=width%*height%*3
buffer$=readpage$(l%,cspin):l%=l%+1 'skip past the colour depth
if (StartX%+width%>MM.HRES) OR (StartY%+height%>MM.VRES) then
print pic$," too big", width%," x",height%
else
defineregionSSD StartX%, StartY%, width%, height%, forwrite
do
buffer$=readpage$(l%,cspin):l%=l%+1
DisplaybufferSSD(buffer$)
numbytes%=numbytes%-len(buffer$)
loop while numbytes%
endif
else
Print "Invalid File Format"
endif
end sub
'
sub initchip(eraseit as integer, cs as integer)
local d$
local integer i=getpagecount(d$,cs)*256
if eraseit then
if not (erasechip(i,cs)) then
print "erase failed"
end
endif
print "Erase complete"
endif
end sub
'
CFunction getpagecount
00000000
27BDFFC8 AFB30028 AFBF0034 AFB50030 AFB4002C AFB20024 AFB10020 AFB0001C
8CB10000 3C029D00 8C420088 00111880 00621021 8C420000 24030008 10430007
00809821 3C029D00 8C420010 02202021 24050008 0040F809 00003021 3C02BF81
8C44F220 3C029D00 8C430088 3C020580 7C84D800 3442B053 00821026 24050014
24040030 00A2200B 00831021 8C430000 24020065 1062006F 3C02BF81 8C45F220
3C030580 3C029D00 8C420010 3463B053 7CA5D800 00A32826 24040005 2403000C
0065200A 00003021 0040F809 24050008 3C02BF81 8C45F220 3C030580 3C029D00
8C420010 3463B053 7CA5D800 00A32826 24040005 2403000C 0065200A 00003021
0040F809 24050064 3C02BF81 8C45F220 3C030580 3C029D00 8C420010 3463B053
7CA5D800 00A32826 2404002F 2403000B 0065200A 00003021 0040F809 24050002
3C02BF81 8C45F220 3C030580 3C029D00 8C420010 3463B053 7CA5D800 00A32826
2404002F 2403000B 0065200A 00003021 0040F809 24050064 3C02BF81 8C45F220
3C030580 3C029D00 8C420010 3463B053 7CA5D800 00A32826 24040004 2403000A
0065200A 00003021 0040F809 24050008 3C02BF81 8C45F220 3C030580 3C029D00
8C420010 3463B053 7CA5D800 00A32826 24040004 2403000A 0065200A 00003021
0040F809 24050064 3C02BF81 8C43F220 3C020580 3442B053 7C63D800 1462000C
3C03BF81 8C64FA90 24050001 3C02BF81 7CA41804 AC64FA90 8C43FCA0 24040006
7C831804 AC43FCA0 1000000B 3C029D00 8C64FA90 24050007 3C02BF81 7CA41804
AC64FA90 8C43FC9C 24040006 7C831804 AC43FC9C 3C029D00 8C42001C 02202021
0040F809 24050006 3C02BF80 34038060 24040C00 AC435A00 AC445A40 24040001
AC445A30 3C03BF80 AC405A20 8C625A10 30420080 1040FFFD 3C029D00 8C42001C
3C10BF80 02202021 24050005 8E125A20 0040F809 00000000 2402009F AE025A20
3C03BF80 8C625A10 30420080 1040FFFD 3C02BF80 8C435A20 3C03BF80 AC405A20
8C625A10 30420080 1040FFFD 3C02BF80 8C505A20 3C03BF80 AC405A20 8C625A10
30420080 1040FFFD 3C02BF80 8C555A20 3C03BF80 AC525A20 8C625A10 30420080
1040FFFD 3C129D00 8E42001C 3C03BF80 02202021 24050006 8C745A20 0040F809
00108200 24020010 AFA20010 02158021 8E420030 00108200 02148021 26640001
02003021 0040F809 00103FC3 3C02FF40 3442D9BF 02021021 24030006 2C420002
10400027 A2630000 3C029D00 8C42001C 02202021 0040F809 24050005 24030006
3C02BF80 AC435A20 3C03BF80 8C625A10 30420080 1040FFFD 3C129D00 8E42001C
3C13BF80 02202021 24050006 8E635A20 0040F809 00000000 8E42001C 02202021
0040F809 24050005 24020098 AE625A20 3C03BF80 8C625A10 30420080 1040FFFD
3C029D00 8C42001C 3C03BF80 02202021 24050006 8C635A20 0040F809 00000000
3C0200BF 24422642 24044000 12020012 00002821 3C0200BF 24422602 1202000E
3C0200BF 24422641 1202000B 24042000 3C0200BF 24422601 12020006 2694FFF8
24020001 0282A004 02802021 10000002 00142FC3 00002821 8FBF0034 00801021
00A01821 8FB50030 8FB4002C 8FB30028 8FB20024 8FB10020 8FB0001C 03E00008
27BD0038
End CFunction
'
CFunction erasechip
00000000
27BDFFD8 AFB40020 AFB00010 AFBF0024 AFB3001C AFB20018 AFB10014 8CB30000
3C029D00 8C42001C 24030001 3C10BF80 AE035A30 0080A021 24050005 0040F809
02602021 24020006 AE025A20 3C03BF80 8C625A10 30420080 1040FFFD 3C109D00
8E02001C 3C11BF80 02602021 24050006 8E235A20 0040F809 00000000 8E02001C
02602021 0040F809 24050005 240200C7 AE225A20 3C03BF80 8C625A10 30420080
1040FFFD 3C029D00 8C42001C 02602021 24050006 3C03BF80 8C635A20 0040F809
3C119D00 3C10BF80 8E220004 0040F809 3404C350 8E22001C 02602021 0040F809
24050005 24020005 AE025A20 8E025A10 30420080 1040FFFD 00000000 8E025A20
AE125A20 8E025A10 30420080 1040FFFD 00000000 8E125A20 8E22001C 02602021
7C129420 0040F809 24050006 32420001 5440FFE6 8E220004 3C029D00 8C42001C
02602021 0040F809 24050005 24030003 3C02BF80 AC435A20 3C03BF80 8C625A10
30420080 1040FFFD 3C02BF80 8C435A20 3C03BF80 AC405A20 8C625A10 30420080
1040FFFD 3C02BF80 8C435A20 3C03BF80 AC405A20 8C625A10 30420080 1040FFFD
3C02BF80 8C435A20 3C03BF80 AC405A20 8C625A10 30420080 1040FFFD 00000000
8E820004 3C03BF80 8C635A20 5C400006 3C02BF80 14400014 3C029D00 8E820000
10400010 3C02BF80 AC525A20 3C03BF80 8C625A10 30420080 1040FFFD 3C029D00
8C42001C 02602021 24050006 3C03BF80 8C635A20 0040F809 00000000 10000007
00001021 3C029D00 8C42001C 02602021 0040F809 24050006 24020001 8FBF0024
8FB40020 8FB3001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0028
End CFunction
'
CFunction readpage$(integer, integer) string
00000000
27BDFFD8 AFBF0024 AFB40020 AFB20018 AFB10014 AFB3001C AFB00010 3C129D00
8E420040 0080A021 24040100 0040F809 8CB30000 00408821 8E42001C 8E940000
24030001 3C12BF80 AE435A30 02602021 0040F809 24050005 24020003 0014A200
AE425A20 3C03BF80 8C625A10 30420080 1040FFFD 3C02BF80 7E843C00 8C435A20
3C03BF80 AC445A20 8C625A10 30420080 1040FFFD 3C02BF80 7E943A00 8C435A20
3C03BF80 AC545A20 8C625A10 30420080 1040FFFD 3C02BF80 8C435A20 3C03BF80
AC405A20 8C625A10 30420080 1040FFFD 3C02BF80 8C425A20 02202021 26250100
3C03BF80 AC705A20 8C625A10 30420080 1040FFFD 00000000 8C705A20 A0900000
24840001 1485FFF7 3C029D00 8C42001C 02602021 0040F809 24050006 8FBF0024
02201021 8FB40020 8FB3001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0028
End CFunction
'
' 64-pin routines
'
CSub DisplayBufferSSD
00000000
14A00003 90880000 10000004 24050001 8CA80000 00002821 2508FFFF 00A8102A
10400017 00852021 3C02BF88 24030800 90870000 24A50003 00A8302A 34E71800
AC476430 AC436134 AC436138 90870001 34E71800 AC476430 AC436134 AC436138
90870002 24840003 34E71800 AC476430 AC436134 AC436138 54C0FFEE 90870000
03E00008 00000000
End CSub
'
CSub DefineRegionSSD
00000000
3C029D00 8C420090 8C830000 8CA50000 8CC40000 24081000 8CE60000 3C07BF88
ACE86134 80420015 24A7FFFF 2468FFFF 00E63821 24060001 10460004 01042021
24060003 14460005 3C029D00 00604821 00804021 10000008 00E01821 8C420094
00A04821 00E04021 8C420000 2442FFFF 00442823 00431823 00096202 00085A02
3C02BF88 24060800 24071000 00052202 00035202 35081800 358C1800 35291800
356B1800 240D022A AC4D6430 34841800 AC466134 34A51800 AC466138 354A1800
AC476138 34631800 AC4C6430 AC466134 AC466138 AC496430 AC466134 AC466138
AC4B6430 AC466134 AC466138 AC486430 2408022B AC466134 AC466138 AC476134
AC486430 AC466134 AC466138 AC476138 AC446430 AC466134 AC466138 AC456430
AC466134 AC466138 AC4A6430 AC466134 AC466138 AC436430 AC466134 AC466138
AC476134 8FA20010 8C420000 10400006 2403022C 2403022E 3C02BF88 AC436430
10000004 3C02BF88 3C02BF88 AC436430 3C02BF88 24030800 AC436134 AC436138
24031000 AC436138 03E00008 00000000
End CSub
'
' 100-pin routines
'
'CSub DisplayBufferSSD
' 00000000
' 14A00003 90880000 10000004 24050001 8CA80000 00002821 2508FFFF 00A8102A
' 10400017 00852021 3C02BF88 24030200 90870000 24A50003 00A8302A 34E70300
' AC476430 AC436434 AC436438 90870001 34E70300 AC476430 AC436434 AC436438
' 90870002 24840003 34E70300 AC476430 AC436434 AC436438 54C0FFEE 90870000
' 03E00008 00000000
'End CSub
''
'CSub DefineRegionSSD
' 00000000
' 3C029D00 8C420090 8C830000 8CA50000 8CC40000 24080100 8CE60000 3C07BF88
' ACE86434 80420015 24A7FFFF 2468FFFF 00E63821 24060001 10460004 01042021
' 24060003 14460005 3C029D00 00604821 00804021 10000008 00E01821 8C420094
' 00A04821 00E04021 8C420000 2442FFFF 00442823 00431823 00096202 00085A02
' 3C02BF88 24060200 24070100 00052202 00035202 35080300 358C0300 35290300
' 356B0300 240D022A AC4D6430 34840300 AC466434 34A50300 AC466438 354A0300
' AC476438 34630300 AC4C6430 AC466434 AC466438 AC496430 AC466434 AC466438
' AC4B6430 AC466434 AC466438 AC486430 2408022B AC466434 AC466438 AC476434
' AC486430 AC466434 AC466438 AC476438 AC446430 AC466434 AC466438 AC456430
' AC466434 AC466438 AC4A6430 AC466434 AC466438 AC436430 AC466434 AC466438
' AC476434 8FA20010 8C420000 10400006 2403022C 2403022E 3C02BF88 AC436430
' 10000004 3C02BF88 3C02BF88 AC436430 3C02BF88 24030200 AC436434 AC436438
' 24030100 AC436438 03E00008 00000000
'End CSub



Edited by matherp 2016-09-17
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 08:10am 16 Sep 2016
Copy link to clipboard 
Print this post

You said "ASCII .PPM format"
I presume this isn't the same as the binary.PPM I use currently to read from the SD card?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10565
Posted: 08:22am 16 Sep 2016
Copy link to clipboard 
Print this post

  Quote  I presume this isn't the same as the binary.PPM I use currently to read from the SD card?


No it is a variant in which all the data is in ascii format. See this post

I use PaintShopPro V7.04 for all my file manipulation. Came out in 1999 but still works perfectly on W10 and I think is now available for free downloadEdited by matherp 2016-09-17
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 11:01am 16 Sep 2016
Copy link to clipboard 
Print this post

  matherp said  I use PaintShopPro V7.04 for all my file manipulation. Came out in 1999 but still works perfectly on W10 and I think is now available for free download


It's worth taking a look at XnView for basic file manipulation too,
for those who don't have something.
Freeware for personal use; No ads or rubbish.

It's like the ASCII programmer Vs MP Labs; Instant load Vs wait.

I've got various versions of PS & PS Elements on different PC's here, but with XnView, all the basic functions are just a right click of the mouse away;
instantly loads, & I can open, crop, resize & convert an image in under 30 seconds.

Supports over 500 formats, ppm ASCII included.

Full download with all features is 17Meg. It's on all PC's here and it behaves like a natural extension of the Windows Shell.

Right Click can add this to the context menu, if desired.

XnView.




Phil.
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 11:11am 16 Sep 2016
Copy link to clipboard 
Print this post

  matherp said  
To do this I have written a program that reads an image off SD card and then stores it on the flash.


Thanks Peter this great well done

Regards
Jman
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9749
Posted: 09:00pm 16 Sep 2016
Copy link to clipboard 
Print this post

[Quote=matherp]Version 1A of the Explore100 ties this pin high and won't work - I haven't got a later version to test with. [/Quote]

Yes, version 1A of the E100 board has the F_CS pin tied high with one of the internal layers of the board, so not really easy or practicial to hack one of those for the F_CS pin access. 1A is the prototype run of boards, so......

Version 1B or greater are the first production-run boards, and F_CS was brought out and pulled high via a 10k resistor, so you can get at F_CS in the later versions of the board.
Smoke makes things work. When the smoke gets out, it stops!
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 06:01pm 05 Dec 2017
Copy link to clipboard 
Print this post

Peter
I've started trying to get this working instead of the SD card as the SD card sometimes fails to read.

If I try and run the program to load the picture into the flash you posted above then I get the error
[quote][23] If Not (erasechip(i,cspin)) Then
Error: Function or array ERASECHIP not declared[/quote]
IF I then add the erase function in the read program below I get this
[quote]> RUN
Initialising memory chip with[/quote]
and the programs just does nothing, I left it for almost an hour in case it was doing something.

The only difference is I used my own picture - converted to ASCII.ppm format
2017-12-06_040040_picture.zip

Any ideas where I've gone wrong?

I'm using an Explore 100 version B board and I used const cspin=21 'chip select pin for serial flash chip as I believe pin 58 is correct for the E100 board
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 08:07pm 05 Dec 2017
Copy link to clipboard 
Print this post

I reconverted the picture to ASCII.PPM format and it now gets a "bit" further but still doesn't seem to finish loading the picture
It now gets this far
[code]> RUN
Initialising memory chip with 32768 pages
Starting picture at page 1000
[/code]Edited by lew247 2017-12-07
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9749
Posted: 09:21pm 05 Dec 2017
Copy link to clipboard 
Print this post

[Quote=Lew247]I've started trying to get this working instead of the SD card as the SD card sometimes fails to read.[/Quote]

I'm not Peter, but I was intrigued by that statement. I have never had read problems with the SD card - or write ones for that matter. Can you elaborate on your issue? I'm just curious.
Smoke makes things work. When the smoke gets out, it stops!
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 09:29pm 05 Dec 2017
Copy link to clipboard 
Print this post

When I am running the weather station it gets the weather icon codes from Openweathermap for today and the next few days
It then displays todays icon on the screen and does this everytime it updates the online conditions.
Occasionally it will throw up an SD card error like this
[code][728] SDcard readfile,buff(),-1,4095,NumBytes%
Error: Disk Error
[/code]

Which is why I wanted to get this working, it would both remove the having to have an sd card in and also make it neater because the card wouldn't be sticking out of the bottom
Edited by lew247 2017-12-07
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 07:20am 06 Dec 2017
Copy link to clipboard 
Print this post

Grogster updated my post, it threw the error overnight, I had the wrong message before
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9749
Posted: 07:24am 06 Dec 2017
Copy link to clipboard 
Print this post

Interesting.

I have my images as completely separate image files(BMP), and just use LOAD IMAGE.
I have a system that loads a logo from the SD card and puts it in a random position on the LCD over and over, and I never had read problems. But that's just the way I am doing mine.
Smoke makes things work. When the smoke gets out, it stops!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10565
Posted: 09:16am 06 Dec 2017
Copy link to clipboard 
Print this post

This code and the SDcard CFunction was written when loading an image from the SDcard was very slow (c15s for 800x480 I seem to remember).

Since then the SDcard code has been completely replaced in the MM+ and is quicker and more reliable than either of the old solutions so I would recommend using the in-built LOAD IMAGE code as per Grogster.

As to why the flash code doesn't work - you have soldered a flash chip onto the display? and it is one of the supported ones? and it is big enough? The display doesn't come with one fitted
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 09:19am 06 Dec 2017
Copy link to clipboard 
Print this post

The reason I want to get Matherp's Pictures on serial flash is my main picture is a full size picture that takes a LONG time to load when it's a .bmp and so would the weather update pictures
I'd like to get this working as it would reduce the loading time and get rid of the need for an sd card.

Matherp if your around could you upload a copy of the leopard picture you used for this to see if I can get it working?
Are there any limitations on what can be displayed or should any picture converted to ASCII.PPM work?

Yes its got a Winbond 25064fVSIG serial flash (64MB flash) soldered on by Peter Edited by lew247 2017-12-07
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10565
Posted: 09:34am 06 Dec 2017
Copy link to clipboard 
Print this post

  Quote  full size picture that takes a LONG time to load when it's a .bmp and so would the weather update pictures


Are you running the latest version of the MM+ firmware? Load image is now much faster than it was
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 09:41am 06 Dec 2017
Copy link to clipboard 
Print this post

Yes I am running the latest MM version
I've just tried it and it is 0.5 secs faster than the normal .PPM file type I was previously using

Anyway one of the main reasons for wanting to get this working was to get rid of the SD card because it sticks out of the bottom of the board, and as I want to put the weather display in a case when its finished this will make it a lot bigger and uglier than it needs to be (I'd rather not have an sd card sticking out)
EDITED:Edited by lew247 2017-12-07
 
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