Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:24 21 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 : MM2 Sleep command - problem?

Author Message
mozzie
Senior Member

Joined: 15/06/2020
Location: Australia
Posts: 176
Posted: 01:08am 07 Feb 2023
Copy link to clipboard 
Print this post

G'day All,
Long time lurker on the forum and MicroMite tinkerer but first time posting, possibly with a bug  

I am not sure if this is something I am doing wrong or a fault in MM2 V5.05.05, all works ok in V5.05.03
A search on TheBackShed turned up no mention of this so maybe my end.

This is running on a bare chip + cap / no options set / clean library to eliminate possible hardware interactions, have tried with pin 16 / wakeup pulled low / high with 10k and 2 different chips.


> print mm.ver
5.0503
> cpu sleep 5
> cpu sleep 30,16
> cpu sleep 30,16
> cpu sleep
> cpu sleep
> cpu sleep 30,14
> cpu sleep 30,14
> cpu sleep 30
>

*** PROGRAM V5.05.05 into MMite ***

> print mm.ver
5.0505
> cpu sleep 5

*** NO RESPONSE - @ 30 SECONDS RESET BUTTON PRESSED ***

Micromite MKII MMBasic Ver 5.05.05
Copyright 2011-2021 Geoff Graham

> cpu sleep 30,16

*** NO RESPONSE - @ 60 SECONDS RESET BUTTON PRESSED ***

Micromite MKII MMBasic Ver 5.05.05
Copyright 2011-2021 Geoff Graham

> cpu sleep
>

> list
' sleep test program

SetPin 25,dout
Pin(25)=1
Pause 1000
Pin(25)=0
Pause 1000
Pin(25)=1
Pause 1000
Pin(25)=0
CPU sleep 5
Pause 100
Pin(25)=1
Pause 1000
Pin(25)=0
Pause 1000
Pin(25)=1
Pause 1000
Pin(25)=0

End
> run

*** NO RESPONSE - @ 60 SECONDS RESET BUTTON PRESSED ***

Micromite MKII MMBasic Ver 5.05.05
Copyright 2011-2021 Geoff Graham

>



When run the above program does provide a clue, the 2 flashes of the led on pin 25 take 5 seconds each, could it be that the PLL in the MMite is not being set to X5 and the chip is still running at 8Mhz?
A quick test on a MM+ 64pin shows the same behaviour.

Can I ask someone to try this out and let me know if they have the same symptoms, I find it hard to believe no-one has found this in the time V5.05.05 has been released.

Thanks in advance.

Regards, Lyle.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9760
Posted: 01:28am 07 Feb 2023
Copy link to clipboard 
Print this post

Hello - welcome to the forums.  Well, for your first post anyway!  

Yes, I thought that the firmware for the MM2 was basically a final at this point, but there is always the possibility of finding another obscure bug.

Can I ask if you are pulling the WAKEUP pin high(or low) for AT LEAST one second?
Manual page 57 mentions that you have to keep the changed state of the wakeup pin in place for at least one second.  If you don't, then the code might never come out of sleep.

If you can please just confirm you ARE doing that, then we can move forward with more experiments.  Later tonight, I will try your code out on my bench-testing E28 module and see what happens.
Smoke makes things work. When the smoke gets out, it stops!
 
mozzie
Senior Member

Joined: 15/06/2020
Location: Australia
Posts: 176
Posted: 01:45am 07 Feb 2023
Copy link to clipboard 
Print this post

G'day Grogster,
Thanks for the reply, I forgot about the 1 second pulse width for the wake-up signal  

I have tried tying the wakeup pin both hi / low and changing state permanently but still no wake-up. Even with no wake-up pin defined (CPU SLEEP XX) the problem is still evident, as per the test program.

I found this by accident as I don't need the timed wake-up in my main program, was using this for testing only, but if it is a bug then it might hopefully stop someone else pulling their hair out  

Regards,
Lyle.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9760
Posted: 04:33am 07 Feb 2023
Copy link to clipboard 
Print this post

OK, that's interesting.  I will hook up my E28 module that uses the 170 MM2 chip, and see if I can replicate your issues.  I'll post back with the results.  Will be a few hours away....
Smoke makes things work. When the smoke gets out, it stops!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3308
Posted: 04:55am 07 Feb 2023
Copy link to clipboard 
Print this post

I just tried it and it works perfectly.

Micromite MKII MMBasic Ver 5.05.05
Copyright 2011-2022 Geoff Graham

> list
Trace on
SetPin 25,dout
Pin(25)=1
Pause 1000
Pin(25)=0
Pause 1000
Pin(25)=1
Pause 1000
Pin(25)=0
CPU sleep 5
Pause 100
Pin(25)=1
Pause 1000
Pin(25)=0
Pause 1000
Pin(25)=1
Pause 1000
Pin(25)=0
> run
[2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18]
>

I know that it is easy to jump to the conclusion that something not working is a bug in the firmware.  However the Micromite series is very stable and is being used by thousands of people.  Something serious like SLEEP not working would have been reported (and fixed) way before now.

It sounds like your chip is silently crashing but cannot think what your problem could be.  All I can suggest are the usual suspects:  try reflashing the firmware and check for errors, try a different power supply and make sure Vcap is a ceramic or tantalum cap.  Finally, make sure that you are not overclocking the chip (ie, not using 48MHz on a 40MHz spec'd chip).

Geoff
Edited 2023-02-07 15:30 by Geoffg
Geoff Graham - http://geoffg.net
 
mozzie
Senior Member

Joined: 15/06/2020
Location: Australia
Posts: 176
Posted: 07:00am 07 Feb 2023
Copy link to clipboard 
Print this post

G'day Geoff,
Thanks for the reply and a HUGE thanks for all the time you and several others have put into making the MicroMite family what is a fantastic device.

Also as you suggest, if all else fails go back to basics....

Have now tried:
Re-downloading MicroMite firmware V5.05.05 from your web site
Programmed into a MM2 ver 1 backpack (no add-ons)
Programmed into a MM2 ver 2 backpack (no add-ons)
Programmed into a MM+ backpack with ILI9341 screen attached
Trying different bypass capacitors.

Using different computer (WIN 7 / WIN XP) and PICkit 3 / MicroBridge

Using external power supply with autorun on (in case of USB / serial interference)

And so far I am still stumped.. Some of this I had already tried before posting.

These devices all worked correctly with 5.05.03 and these are all running at 40Mhz
I think the backpack V1 was from 2017 and always rock solid.

Can you confirm the device you tested had no external connections? just wondering if floating I/O is an issue.

Also, being picky now, your startup banner shows:
Micromite MKII MMBasic Ver 5.05.05
Copyright 2011-2022 Geoff Graham

And I have:
Micromite MKII MMBasic Ver 5.05.05
Copyright 2011-2021 Geoff Graham

Yeah, I guess thats clutching at straws...

Regards,
Lyle.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3308
Posted: 12:34pm 07 Feb 2023
Copy link to clipboard 
Print this post

Well spotted Lyle and I think that I will have to eat some humble pie.

The copyright should be 2011-2022 but, as a check, I downloaded the version on my website and it had a copyright of 2011-2021.  Even worse, I tested the version on my website and it failed some tests including your sleep test program.  I am not sure what has happened here but it seems that some of the files on my website have been messed up and in particular Micromite MKII MMBasic Ver 5.05.05 seems to be a test version of mine that should never have seen the light of day.

I have replaced the file with the correct version and I would be grateful if you could download it and let me know if it works for you: https://geoffg.net/Downloads/Micromite/Micromite_Firmware.zip

I have tested this and it seems OK including correctly running your test program.  So you were not clutching at straws.

I have a few minor updates on my ToDo list and I might use this as an opportunity to release V5.05.06 so that anyone who has the faulty 5.05.05 will upgrade to something without issues.  However I will not be able to get to it for a few weeks which is why I have made this running update.

Geoff
Geoff Graham - http://geoffg.net
 
mozzie
Senior Member

Joined: 15/06/2020
Location: Australia
Posts: 176
Posted: 09:34pm 07 Feb 2023
Copy link to clipboard 
Print this post

G'day Geoff,
If the BackShed has taught me anything, it is that 99.9% of the time its the user software / hardware that is at fault. Without the efforts of your good self and a couple of others here we would all be stuck with the horrors of Arduino / C / bracket madness, so lets leave the humble pie in the fridge where it belongs.

Unfortunately the V5-05-05 provided has the same 2011-2021 and the same fault as before, I also tried V5-05-04 and it shows the same symptoms. V5-05-03 is ok as far as I can tell. I have a few copies on this machine now so I will have a clean out and try again just in case I picked the wrong one...

A couple of bits of good news, placing a CPU XX statement after the CPU SLEEP gets the MicroMite back to normal, its running at 8Mhz after waking up.

And I learnt how to peek into the PIC32 memory and see what the oscillator bits are doing :) way more complicated than the 16F's I normally program in assembler but good to know.

Thanks again for your help.  

Regards, Lyle.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3308
Posted: 11:18pm 07 Feb 2023
Copy link to clipboard 
Print this post

Damn, the saga continues.

I'm sure that the correct V5-05-05 with 2011-2022 copyright was copied up but I am away from the computer and will not be able to check until later today.  Try clearing your browser cache and re download... maybe that is the answer.

Geoff
Geoff Graham - http://geoffg.net
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2466
Posted: 01:15am 08 Feb 2023
Copy link to clipboard 
Print this post

hi geoff,
   when the 5.05.06 version comes out, is there any chance you could (covertly) include the option for a negative PWM parameter to allow directly loading the OCxRS register, as per the 'special' build you made for me here:

https://www.thebackshed.com/forum/ViewTopic.php?TID=14558&PID=182207

it has proven extremely useful, but is currently not something i can really make use of publicly beyond these forums. the major use is to create a PWM for precisely trimming voltage references over temperature change.


cheers,
rob   :-)
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9760
Posted: 01:27am 08 Feb 2023
Copy link to clipboard 
Print this post

@ mozzie - I am reading this thread, but I have not bothered to post back, as Geoff has taken up the testing.  That, and I also cannot find my bench-testing E28 module, but I will keep hunting for it, and once I find it, I will post results.

If 5.05.03 works, can you not just use that older firmware?  That should be a work-around anyway.  But then, you might need some of the features in the latest firmware!  
Smoke makes things work. When the smoke gets out, it stops!
 
mozzie
Senior Member

Joined: 15/06/2020
Location: Australia
Posts: 176
Posted: 02:27am 08 Feb 2023
Copy link to clipboard 
Print this post

G'day Grogster,
I should probably have re-stated (for Geoff's sake as much as anything) that this is not affecting anything important at my end.

The faulty behaviour appeared whilst trying out some options to wake the MMite from the touch screen, and when the whole thing locked up went looking for the culprit.... added the delay to the sleep function due to missing hardware and oh dear...

This was more in the interest of finding the reason behind the behaviour and ensuring that someone new to the MMite doesn't get caught out by it. I have been messing with PIC16 assembler and basic for 35 years and I spent a couple of days (spare time) trying to nut it out (and learning PIC32 registers too) before posting it here.

Just to recap:
CPU SLEEP with no parameters works in all versions (this is the one I need)
CPU SLEEP xx works in V05.05.03 but no higher
CPU SLEEP xx,xx works in V05.05.03 but no higher

This also assumes the versions I have on disk here (never delete ANYTHING) match the current versions on Geoffs website. I have re-downloaded V05.05.04 and V05.05.05 and they are still behaving the same, also have a few versions on several computers scattered around here to try...

But you are correct, V05.05.03 works a treat and with a CPU SPEED command after the CPU SLEEP XX it works like it should in V05.05.04/05 also.

If you find the E28 it would be great to know if you can replicate the problem, the faulty firmware issue is still an unknown as far as when it appeared, the version with 2011-2021 in the startup header appears to be the problem.

Regards, Lyle
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2833
Posted: 04:38am 08 Feb 2023
Copy link to clipboard 
Print this post

Hi Geoff,

The version you posted this morning is correct.

> Micromite MKII MMBasic Ver 5.05.05
Copyright 2011-2022 Geoff Graham

> AUTOSAVE
Trace on
SetPin 25,dout
Pin(25)=1
Pause 1000
Pin(25)=0
Pause 1000
Pin(25)=1
Pause 1000
Pin(25)=0
CPU sleep 5
Pause 100
Pin(25)=1
Pause 1000
Pin(25)=0
Pause 1000
Pin(25)=1
Pause 1000
Pin(25)=0
Saved 140 bytes
> RUN
[2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18]
>
 
mozzie
Senior Member

Joined: 15/06/2020
Location: Australia
Posts: 176
Posted: 06:03am 08 Feb 2023
Copy link to clipboard 
Print this post

G'day all,
Good news   after getting home and reading Phil's post I have removed every copy of V5.05.04 and V5.05.05 off my computer, re-downloaded and hey presto, 2011-2022 in startup banner    and it works as intended  

My apologies Geoff for not trying this earlier, being in 4 different directories / downloads should have been sufficient to my mind   guess its my round of humble pie....

Thanks all who helped.

Regards, Lyle.

P.S. I'll try not to live up to my pesky username...
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3308
Posted: 06:19am 08 Feb 2023
Copy link to clipboard 
Print this post

Lyle: Great news, panic over.
Rob:  Will do.

Geoff
Edited 2023-02-08 16:23 by Geoffg
Geoff Graham - http://geoffg.net
 
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