ChipKit WiFire NMI support

Post Reply
msprauve
Posts: 1
Joined: Wed Jan 11, 2017 7:52 pm

ChipKit WiFire NMI support

Post by msprauve » Sun Aug 06, 2017 8:09 pm

Hi,

I am trying to get sleep mode working on my WiFire Rev C board. So far I have the board entering in sleep mode but I have encountered the problem that Diligent standard bootloader does not support NMI which is required for proper exiting from "sleep" mode, instead my board exits sleep mode into idle mode for the same duration as sleep before returning back to my program (which defeats the purpose of saving power). I have searched the web for the bootloader source code (which I have found) but I have been unsuccessful in enabling NMI support. I am hoping someone else might have solved this problem.

Thanks

User avatar
majenko
Site Admin
Posts: 2165
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: ChipKit WiFire NMI support

Post by majenko » Mon Aug 07, 2017 11:57 am

I have never tried it with the MZ, only the MZ. If it's the same (and I guess it will be) you just need to enable this bit of code in crt0MZ.S:

Code: Select all

        ##################################################################
        # If entered because of an NMI, jump to the NMI handler.
        ##################################################################
        mfc0    k0,_CP0_STATUS


#if 0 //      Interrupts are not enabled for the bootloader

        ext     k0,k0,19,1              # Extract NMI bit
        beqz    k0,_no_nmi
        nop
        la      k0,_nmi_handler
        jr      k0
        nop
_no_nmi:
#endif  // NMI not supported
by setting #if 0 to #if 1 and then provide an _nmi_handler that just returns from the exception:

Code: Select all

_nmi_handler:
        eret;
I keep on making the change for the MX crt0.S but for some reason it keeps disappearing. Not sure if it never gets merged or what. Maybe I never actually PRd it...
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Post Reply