K21: RTC code crashes later rev silicon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have some Processor Expert code that uses the RTC on an MK21FX512VMC12. On one of our systems (chip rev ID = 1) this works with no problems. On a newer system (chip rev ID = 9) the code hits an exception:
PE_ISR(Cpu_Interrupt) { PE_DEBUGHALT(); }
When we disable the RTC and comment out the referencing code it works fine.
Apparently there is some significant silicon difference that breaks this. Any ideas? I plan to query the PE guys as well regarding this, as if there was a fix, the PE components should know about it and work around it accordingly, perhaps.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rhys Drummond,
Would you please tell us the MaskSet and PartNumber of the two versions K21 chip?
When create an MCU project based on Processor Expert, I can only find the difference between Device(MK21FX512 and MK21FX512A).
It will include difference headfiles(base on different Reference Manual K22P121M120SF5RM and K22P121M120SF5V2RM).
Please refer Debugging Hard Faults on ARM Cortex-M find out what is causing the problem.
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI Robin, Thanks for the suggestions. I didn't know that number was the mask set. Information as follows:
The old 'Rev1' chip (as reported by BDM) is MK21FX512V12/2N03G. It has VBAT fed by battery and +3.3V via a diode.
The later 'Rev9' chip is MK22FX512VLK12/1N41K. VBAT is floating on this system. I'm convinced that this is the reason for the exception.
It would be nice to have a little more granularity in the interrupt handler for this; Hard Fault Exception isn't terribly helpful.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rhys
RTC registers cannot be accessed (they will hard-fault) if VBAT is not present.
There are a number of topics discussing this - eg. How to detect if VBAT supply is present for RTC to work?
All designs using RTC (in chips with VBAT and battery) must therefore be able to handle the case when the battery has depleted or been removed, otherwise the products will fail to start any more. If there is a hard wire connection from the power supply to VBAT this guarantees the operation.
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
Kinetis K21/K22/K24:
- http://www.utasker.com/kinetis/TWR-K21D50M.html
- http://www.utasker.com/kinetis/TWR-K21F120M.html
- http://www.utasker.com/kinetis/FRDM-K22F.html
- http://www.utasker.com/kinetis/TWR-K22F120M.html
- http://www.utasker.com/kinetis/BLAZE_K22.html
- http://www.utasker.com/kinetis/tinyK22.html
- http://www.utasker.com/kinetis/TWR-K24F120M.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are some difference between these two MCU.
Please read the: EB811 Kinetis K22F 120 MHz Family Mask Sets and Revision Numbers
The PartNumber should be MK22FX512AVLK12 for the MaskSet 1N41K, please download the corresponding K22P80M120SF5V2RM and K22P80M120SF5V2.
The difference of register will cause hardfault.
Please try to reconfigure the MCU PartNumber in Processor Expert.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using help from Erich Styger I've ascertained that the interrupt is a Hard Fault. Not sure if that helps diagnose the fault.
My register dump is as follows:
Not really sure what to do with that info, tbh.