chipKIT® Development Platform

Inspired by Arduino™

ChipKit WiFire NMI support

Created Sun, 06 Aug 2017 19:09:52 +0000 by msprauve


msprauve

Sun, 06 Aug 2017 19:09:52 +0000

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


majenko

Mon, 07 Aug 2017 10:57:40 +0000

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:

##################################################################
        # 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:

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