Thank for the pointer to AN4445. Now it's clear that my guess was wrong. > Still, the KL series should not be affected by my change at all.
Yes > Anyway, if only the KL series needs switching the VLPR to RUN mode, maybe we > could just remove the entire check for the older K-series MCUs (first branch > of the aforementioned if condition). This would eliminate the need to > discriminate between the REVIDs at all. K series doesn't need switching from VLPR to RUN as the device reset ensures RUN mode. Unfortunately they _DO_ need VLPR check for the case when an user app switches to VLPR and user starts programming without issuing device reset (it's a bad practice although possible). FTFE (or how Freescale named the flash module) in VLPR mode simply does not respond. No error returned. Some flash operations finish as they were successful - just the flash doesn't change. The new code for switching K "Initial Product Rev" from VLPR to RUN is pretty similar to the existing code for K rev 2.x, so let's use it as you wrote in https://github.com/mhier/openocd/commit/521f516ec6874b5f9da379247015530fb5a122a4 REVID detection itself is also correct, but should be limited to the devices I listed in https://sourceforge.net/p/openocd/tickets/236/#2e60 And in the enum use KINETIS_MC instead of KINETIS_SMC_NONE, as we use MC instead of SMC --- ** [tickets:#236] Cannot flash Kinetis Z parts** **Status:** new **Milestone:** 0.9.0 **Created:** Thu May 02, 2019 09:41 AM UTC by Ramy **Last Updated:** Mon May 30, 2022 09:04 AM UTC **Owner:** nobody I am using a Kinetis MK20DN512**Z**VLQ10 which is an earlier version of the MK20DN512VLQ10. Flashing the non-Z part works fine in OpenOCD 0.10, but when flashing the Z part, the following error occurs: "Flash operation not possible in current run mode: SMC_PMSTAT: 0x0" It looks like the code in the kinetis_check_run_mode function reads the SMC_PMSTAT register on the target device to check that it is in run mode. This register does not exist on the earlier revision K20 device, so pmstat is always 0 and OpenOCD refuses to program the device. I have attempted to use earlier versions of OpenOCD which don't have this check, but they fail when trying to flash either device. --- Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is subscribed to https://sourceforge.net/p/openocd/tickets/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/openocd/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.