Microchip
直播中

张文

8年用户 195经验值
私信 关注
[问答]

请问PIC32 mm的软替换()是否正确替换?

有人能告诉我PIC32 mm的软替换()是否正确替换?看起来SoftReset来自传统的PLIB。我正在尝试重用旧的PIC32MX代码,并且看起来PLIB不支持PIC32MM。我发现一篇文章推荐PIC32MZ的_u pic32_._reset()替代方案,但是我不确定这对PIC32MM是否正确。谢谢

以上来自于百度翻译


      以下为原文

    Can someone point me to the correct replacement of SoftReset() for PIC32MM?
It looks like SoftReset is from legacy PLIB.

I am trying to reuse old PIC32MX code and looks like PIC32MM is not supported in PLIB.

I found one post that is recommending
__pic32_software_reset() alternative for PIC32MZ, but I am not sure if this is a correct for PIC32MM

Thank you

回帖(3)

陈洁

2019-7-2 10:30:04
这就是我在MX和MZ上都用到的,并且可以工作:编辑:如果内存提供服务,在执行上面的代码之前,您需要解锁序列。

以上来自于百度翻译


      以下为原文

    This is what I use on both MX and MZ and works:

    RSWRSTSET = _RSWRST_SWRST_MASK;
    RSWRST;
    while(1);

 
Edit: if memory serves you need the unlock sequence before executing the code above.
举报

李纪生

2019-7-2 10:47:54
谢谢你的回复。我实际上在MX手册中找到了类似的序列,只是不确定如果在PIC32 MMHTTP://WW1.MICCHIP.CON/DeLoSs/En/DeVICECD/61118B.PDF页11中工作的方式是相同的,除了解锁之外,它还需要同时或4个NOP。

以上来自于百度翻译


      以下为原文

    Thank you for reply.
 
I actually found the similar sequence int the MX manual, just not sure if this works the same way on PIC32MM
http://ww1.microchip.com/downloads/en/DeviceDoc/61118B.pdf  page 11
In addition to the Unlock, it requires while or 4 NOPs at the end as well

/* perform a system unlock sequence */
SYSTEMUnlock();
/* set SWRST bit to arm reset */
RSWRSTSET = 1;
/* read RSWRST register to trigger reset */
volatile int* p = &RSWRST;
*p;
/* prevent any unwanted code execution until reset occurs*/
while(1);
举报

刘晓寰

2019-7-2 10:55:30
实际上我尝试了_u pic32_._reset(),我在最初的文章中提到过,它也可以工作。我找到了另一本手册,它涉及整个P32家族,并且如果具有类似的序列:http://ww1.micro..com/...eviceDoc/60001118H.pdf。

以上来自于百度翻译


      以下为原文

    I actually tried __pic32_software_reset() that I mentioned in the initial post and it works as well.
 
I found another manual that refer to the whole P32 family and if has a similar sequence:

/* The following code illustrates a software Reset */
// assume interrupts are disabled
// assume the DMA controller is suspended
// assume the device is locked
/* perform a system unlock sequence */
// starting critical sequence
SYSKEY = 0x00000000; //write invalid key to force lock
SYSKEY = 0xAA996655; //write key1 to SYSKEY
SYSKEY = 0x556699AA; //write key2 to SYSKEY
 
 
/* set SWRST bit to arm reset */
RSWRSTSET = 1;
 
/* read RSWRST register to trigger reset */
unsigned int dummy; dummy = RSWRST;
/* prevent any unwanted code execution until reset occurs*/
while(1);
 
http://ww1.microchip.com/...eviceDoc/60001118H.pdf
举报

更多回帖

发帖
×
20
完善资料,
赚取积分