Can not written program into board again.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can not written program into board again.

10,716 Views
liufei
Contributor III

Hello,

When I written program into the board of chip S32K148(144pin),popup following message(attach file),could you please tell me how solve it,thank you very much!

Best Regards,

Liu

0 Kudos
Reply
34 Replies

8,702 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@liufei

MCU锁住了,你可以尝试用unlock kinetis这个命令解锁,下面是一个完整的操作流程。

SEGGER J-Link Commander V7.56d (Compiled Oct 29 2021 14:02:52)
DLL version V7.56d, compiled Oct 29 2021 14:01:36

Connecting to J-Link via USB...O.K.
Firmware: J-Link OpenSDA compiled May 27 2019 10:59:53
Hardware version: V1.00
S/N: 621000000
VTref=3.300V


Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify device / core. <Default>: S32K142
Type '?' for selection dialog
Device>S32K142
Please specify target interface:
  J) JTAG (Default)
  S) SWD
  T) cJTAG
TIF>SWD
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>4000kHz
Device "S32K142" selected.


Connecting to target via SWD
InitTarget() start
InitTarget()
InitTarget() end
Found SW-DP with ID 0x2BA01477
DPv0 detected
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
AP[1]: JTAG-AP (IDR: 0x001C0000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
[0][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7
[0][1]: E0001000 CID B105E00D PID 003BB002 DWT
[0][2]: E0002000 CID B105E00D PID 002BB003 FPB
[0][3]: E0000000 CID B105E00D PID 003BB001 ITM
[0][4]: E0040000 CID B105900D PID 000BB9A1 TPIU
Initializing 28672 bytes work RAM @ 0x1FFFC000
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Cortex-M4 identified.
J-Link>unlock Kinetis
Found SWD-DP with ID 0x2BA01477
Unlocking device...O.K.
J-Link>

 

如果这样解锁失败,那需要进一步分析原因了,如果是使用了backdoor且关闭了mass erase功能,那就恢复不了了。

 

S32K1xx系列MCU应用指南之芯片锁死(lockup)复位原因分析与恢复方法详解

https://mp.weixin.qq.com/s/Fb2L32l3v6oOJof3-2P7Rg 

 

0 Kudos
Reply

8,689 Views
liufei
Contributor III

liufei_0-1658131728956.png

你好!

在执行Executing Inittarget()时出现上面message,请问时怎么回事?

 

 

0 Kudos
Reply

8,675 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@liufei

你直接点yes试一下,如果使能了mass erase可以成功的擦除,然后正常使用。

这可能的原因:
你MCU的0x400~0x40F区域是不是被修改过了,做Bootloader的时候也要注意这个地址的东西不要乱改。

默认在startup_S32K1xx.S中这个地方是没有修改的(分散加载文件也要注意这块地址空间)

Senlent_0-1658132608003.png

Senlent_2-1658132899580.png

 

要使用加密功能的话,你要把我给你发的文章仔细阅读一遍

0 Kudos
Reply

8,668 Views
liufei
Contributor III

liufei_0-1658133877114.png

我这边是这样的

 

0 Kudos
Reply

8,673 Views
liufei
Contributor III

liufei_0-1658133564601.png

yes之后还不能烧写。

 

0 Kudos
Reply

8,658 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@liufei

首先是不是可以确定芯片被锁住了,要是锁住了的话你看一下我给你发的文档,里面是关于锁死最全面的分析,

 

7. 1能否解锁恢复MCU的判断方法

当芯片锁死后,可以通过示波器观察S32K1xx系列MCU的RESET引脚波形判断是否可以恢复

①RESET引脚一直为低电平

无法解密恢复MCU;

②RESET引脚输出周期性复位脉冲信号

a. 若复位信号周期为~118us,高电平时间为~660ns的方波信号

 

可以通过SWD/JTAG调试接口执行mass erase命令解密恢复MCU;

Tips高电平时间为~660ns的方波信号是去掉RESET引脚的外部滤波电容时的测量结果,若外部连接有滤波电容,将影响RESET引脚输出的波形,将变成缓慢下降和上升的锯齿波信号,但周期依然在~118us。

b. 若复位信号周期不是~118us,大于200us,为500多us甚至更长

无法通过SWD/JTAG调试接口执行mass erase命令解密恢复MCU。

 

0 Kudos
Reply

8,647 Views
liufei
Contributor III

我这边截图是这个样子的,请问可以解锁吗?

0 Kudos
Reply

8,640 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@liufei

根据文档中的描述,你这应该是恢复不了了。

Senlent_0-1658194530274.png

 

0 Kudos
Reply

8,636 Views
liufei
Contributor III

谢谢回答,请问一般什么情况会导致这样mcu被锁。

0 Kudos
Reply

8,632 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@liufei

我给你发的那篇文章中有详细的描述,你还是要仔细看一下,下面这个章节有详细的描述。

5. S32K1xx系列MCU Flash编程常见问题及注意事项

0 Kudos
Reply

8,629 Views
liufei
Contributor III

谢谢,我还有一个疑问

在jlink commander里面显示一个warning

Identified core does not match configuration. (Found: Cortex-M0, Configured: Cortex-M4)

可是我在jlink flash里面只能选择Cortex-M4,请问这是怎么回事?

0 Kudos
Reply

8,625 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@liufei

你板子不是S32K148吧,S32K11x系列的内核才是Cortex-M0的

j-link的软件比较多,我自己用的是J-Link Commander V7.56d,你自己去segger的官网下载相关的软件吧,型号选的不对肯定有问题阿。

0 Kudos
Reply

8,620 Views
liufei
Contributor III

我的板子是148,接下来我用J-Link Commander V7.68试一下,请问j-link是会与相应的IDE连接的对吧(安装的时候),所以j-flash的设定会和IDE的工程里面的debug设置是一致的,对吗

0 Kudos
Reply

8,616 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@liufei

这个没有研究和测试过,我用的J-Link Commander是自己在SEGGER官网下载的,有可能你的问题就是这个原因导致的。

0 Kudos
Reply

8,613 Views
liufei
Contributor III

我使用j-flash678,尝试连接板子,弹出protection bytes in flash at addr 0x400-0x40f这样的message,同时有如下信息

Application log started
- J-Flash V7.68 (J-Flash compiled Jul 14 2022 16:54:59)
- JLinkARM.dll V7.68 (DLL compiled Jul 14 2022 16:54:28)
Reading flash device list [C:\Program Files\SEGGER\JLink\ETC/JFlash/Flash.csv] ...
- List of flash devices read successfully (451 Devices)
Reading MCU device list ...
- List of MCU devices read successfully (9642 Devices)
Creating new project ...
- New project created successfully
Connecting ...
- Connecting via USB to probe/ programmer device 0
- Probe/ Programmer firmware: J-Link V9 compiled May 7 2021 16:26:12
- Device "S32K148 (ALLOW SECURITY)" selected.
- Target interface speed: 1000 kHz (Fixed)
- VTarget = 3.701V
- InitTarget() start
- Device will be unsecured now.
- Timeout while halting CPU.
- InitTarget() end
- Found SW-DP with ID 0x2BA01477
- DPIDR: 0x2BA01477
- CoreSight SoC-400 or earlier
- Scanning AP map to find all available APs
- AP[2]: Stopped AP scan as end of AP map has been reached
- AP[0]: AHB-AP (IDR: 0x24770011)
- AP[1]: JTAG-AP (IDR: 0x001C0000)
- Iterating through AP map to find AHB-AP to use
- AP[0]: Skipped. Could not read CPUID register
- AP[1]: Skipped. Not an AHB-AP
- InitTarget() start
- Device will be unsecured now.
- Timeout while halting CPU.
- InitTarget() end
- Found SW-DP with ID 0x2BA01477
- DPIDR: 0x2BA01477
- CoreSight SoC-400 or earlier
- Scanning AP map to find all available APs
- AP[2]: Stopped AP scan as end of AP map has been reached
- AP[0]: AHB-AP (IDR: 0x24770011)
- AP[1]: JTAG-AP (IDR: 0x001C0000)
- Iterating through AP map to find AHB-AP to use
- AP[0]: Skipped. Could not read CPUID register
- AP[1]: Skipped. Not an AHB-AP
- ERROR: Could not find core in Coresight setup
- ERROR: Failed to connect.
Could not establish a connection to target.

请问有什么建议吗?

0 Kudos
Reply

8,608 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@liufei

新板子,又锁了?

0 Kudos
Reply

8,603 Views
liufei
Contributor III

不是,就是这块板子,我用j-flash连接,出现的上面log。

我想问一下,我刚才看您提供的文档提到一个backdoor key access,这个怎么用,我们代码里面有can和spi通信接口

0 Kudos
Reply

8,596 Views
liufei
Contributor III

liufei_0-1658211661768.png

您看一下我的MDM-AP状态寄存器值是0x37,是不是可以通过mass ersae进行复位呢

 

0 Kudos
Reply

8,592 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@liufei

我看了一下,mass erase确实是使能了,但是应该还是恢复不了。根据你提供给我的复位的波形判断的。

我搜索了一下内部论坛,有一个和你这个问题几乎是一样的,读出来也是0x37,端口波形也是大于500us,目前的结论是恢复不了,可能的原因是ESD或是EOS造成的,这个问题还在更新,要是有新的解决方案我第一时间转告你。

所以你还是换一块芯片吧。

0 Kudos
Reply

8,567 Views
liufei
Contributor III

liufei_0-1658280538926.png

我这边一会0x35一会0x37,请问是一回事吗?

 

 

0 Kudos
Reply