Menu
JAQForum Ver 26.09

Forum Index : Microcontroller and PC projects : My Star Trek program now bricks my CMM2 :-(

Posted: 04:06am
01 Oct 2026
Copy link to clipboard
PeteCotton
Guru


IMPORTANT - don't download and run this program without reading this note.

I'm working on my Star Trek program (don't judge it just yet - it's still a very early work in progress), but when I run the main program mmtrek.bas I get a message saying:

Error in font14.inc line 54: flash not erased

And then CMM2 becomes unresponsive. Rebooting the CMM2 boots up to the Maximite screen with Geoff and Peter's copyright statements, but there is no prompt.

The good news - re-blowing the firmware into the CMM2 brings it back to life - but that's the only way I've managed to get it back. I tried shorting pins 39 and 40, but that didn't help.

I tried this on two different CMM2's multiple times, with different SD cards. Sometimes it takes a couple of runs to brick the computer - but it does always happen (for me).

font14.inc is indeed a file in my program, but I haven't touched it in months. I tried overwriting it again from my PC in case that was the issue, but to no avail.

I was programming my CMM2 when it happened (via MMEdit). i.e. I was editing, running and all of that was fine, until one time when I hit run and it started doing this.

My program is large, but less than 50% of program capacity.

I'm using version 6.00.00b13 of the firmware and it's a 2nd gen CMM2.

This may be one of the larger CMM2 programs out there, so is it possible the font load is somehow corrupting the firmware or overwriting something that it shouldn't be?

At this stage I'm stumped, so I was hoping I could pass the issue over to smarter minds who can tell me what I'm doing wrong. (Thanks in advance)

To replicate the issue, unzip the attached file to SD card. Navigate to it and run mmtrek.bas.

MMTrek.zip
Edited 2026-10-01 16:06 by PeteCotton
 
Posted: 11:53am
01 Oct 2026
Copy link to clipboard
disco4now
Guru


I can replicate it. If I run Trek.bas I get the error straight away. It does not always lockup but I have had to reload the firmware a few times.

I think OPTION RAM and running from flash might be OK.
It looks like your code plus the fonts is broaching 256K so going into the third flash slot, so looks like something is wrong around writing the flash. Maybe its overwriting the firmware ?

Will try to have a look tomorrow.


Program:
245K (47%) Program (3829 lines)
 11K ( 2%) 5 Embedded Fontss
260K (51%) Free

Data:
747K ( 3%) 374 Variables
  0K ( 0%) General
24050K (97%) Free
 
Posted: 02:07pm
01 Oct 2026
Copy link to clipboard
PeteCotton
Guru


  disco4now said  Will try to have a look tomorrow.


Thank you! I really appreciate everything you guys do for us.  
 
Posted: 05:43pm
01 Oct 2026
Copy link to clipboard
PeteCotton
Guru


I can also confirm the OPTION RAM seems to work fine. That allows me to continue developing it! Thanks!
 
Posted: 11:27pm
01 Oct 2026
Copy link to clipboard
disco4now
Guru


OK I have found it.

When converting to 16Bit tokens I found a chunk of code that I could not work out why it was there, it checked that the binary version of Fonts and CSub had not changed, I thought maybe redundant as they could not change unless the HEX versions had also changed, so I commented it out. Well it turns out you need it as the function also returns the total program size, which tells you how much flash you need to erase each time the program loads. If you have a program of a size that fits within a 128K boundary but the binary copy of a font or CSub pushes it to the next 128K block then not enough flash was erased in preparation to save the program.


#ifdef DOWENEEDTHIS
   // now we must scan the program looking for CFUNCTION/CSUB/DEFINEFONT statements, extract their data and program it into the flash used by  CFUNCTIONs
    // programs are terminated with two zero bytes and one or more bytes of 0xff.  The CFunction area starts immediately after that.


I just need to check it still recognises an unchanged program and does no rewrite the flash each time. Will put Beta14 out later today.

Beta14 with the fix is now on Geoff's Website.
CMM 6.00.00 CMM2_Beta.zip
Edited 2026-10-02 11:12 by disco4now
 
Posted: 03:56pm
02 Oct 2026
Copy link to clipboard
PeteCotton
Guru


  disco4now said  OK I have found it.


Thank you! It is very much appreciated.  
 


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

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