MM9Z1J638 eval board and SCI demo - sleep/wake not working

Discussion created by darryln on Dec 18, 2019
Latest reply on Dec 19, 2019 by darryln

I'm using the KT9Z1J638 eval board with the KT9Z1_638_SCI_demo firmware project and unable to achieve reliable sleep with wake on PTB4. 


I'm not using CAN or LIN, but instead plan to transfer measurement data over SPI to another system.  The application will use sleep mode and the  wake on PTB4 and wake on current threshold features. 


I can put the demo code to sleep by setting bmsmode=BMS_SLEEP, and wake on PTB4 rising edge (press BP3), but it isn't reliable -- it seems to work exactly once after full power cycle, USB connect, and reflashing the firmware. Subsequent attempts to enter sleep mode hang with 15mA supply current drain.


Also tested standalone (without USB attached).  With S1-1 open (RESET_A and RESET not connected), when VBAT is applied, it hangs consistently, again with the 15mA drain.  Hardware RESET gets it going, but then it hangs after entering sleep mode, again with the 15mA.


With S1-1 closed (RESET_A and RESET tied together), the system starts reliably at power on, but when the code enters sleep mode, the system immediately restarts through reset. 


It's clear the demo firmware is coded with the assumption that RESET_A and RESET are disconnected (S1-1 open), which allows BDM debugging.  

I suspected it was hanging in d2d.c:isrd2derr, and confirmed my suspicion by pulsing a debug output inside the loop.  


Can anyone out there explain how to make this board start, run, sleep, and wake reliably?