[riot-users] MCU recover mode

Olivier Fauchon ofauchon2204 at gmail.com
Wed Dec 19 15:14:52 CET 2018


Hi Joakim,

At the moment, I'm using your Kinetis LP RIOT branch (gebart:pr/kinetis-pm
).
Still testing, but I'll send you feedback as soon as possible.

Thanks for for you OpenOCD tips.

Olivier Fauchon









Le mer. 19 déc. 2018 à 13:50, Joakim Nohlgård <joakim at nohlgard.se> a écrit :

> Hi,
> Low power modes are indeed a difficulty when debugging.
> Are you using the Kinetis low power mode PR?
> https://github.com/RIOT-OS/RIOT/pull/7897
> Do you have any feedback that could help getting it ready for merging?
>
> I have had similar issues when experimenting with low power modes. Do you
> have access to the reset pin on your device?
> If you have the reset pin connected on the JTAG header, you can use the
> OpenOCD option reset_config connect_assert_srst, in combination with the
> reset halt command to make the CPU halt so that you can reload a new
> firmware.
>
> See
> https://github.com/RIOT-OS/RIOT/pull/7897/commits/a34d7ac3493e1b18d49c08eeada88725434e7b14
> for the config file change (part of #7897) and
> https://github.com/RIOT-OS/RIOT/pull/10479 for using reset halt from the
> openocd.sh script.
>
> Best regards,
> Joakim
>
>
> Den ons 19 dec. 2018 09:21 skrev Dylan Laduranty <dylanladuranty at gmail.com
> >:
>
>> Hi Olivier,
>> I had the same issue with openOCD and SAM0 MCU in the past. But I was
>> always to recover my chips using JLinkExe tool from Segger. I just erased
>> the whole memory using JLinkExe to unbrick the device and re-run openocd
>> afterwards.You should probably take a look too.
>>
>> Regards
>>
>> Le mer. 19 déc. 2018 à 08:51, Olivier Fauchon <ofauchon2204 at gmail.com> a
>> écrit :
>>
>>> Hi Bas,
>>>
>>> I use NXP Kinetis KW2xd MCU and OpenOCD + JLink with SWD, for flashing.
>>>
>>> I didn't know there were special procedures for unlocking devices.
>>>
>>> I'll try to use NXP official IDE flash these chips again.
>>>
>>> Thanks
>>>
>>> Olivier
>>>
>>>
>>>
>>>
>>>
>>> Le mer. 19 déc. 2018 à 08:17, Bas Stottelaar <basstottelaar at gmail.com>
>>> a écrit :
>>>
>>>> Hi Oliever,
>>>>
>>>> Which MCUs have you been playing with?
>>>>
>>>> This is a common 'problem' that can occur when you indeed enable LPM
>>>> (or other things like disable debug pins etc). Therefore, most MCUs have
>>>> certain procedures to keep the MCU halted after a reset, before any code is
>>>> executed and the MCU gets unreachable. IIRC, ARM Cortex provides a
>>>> vector-catch operation to halt the MCU after reset. Some IDEs (like
>>>> Simplicity Studio for EFM32 MCUs) have a special unlock operation.
>>>>
>>>> Your solution isn't new, but works great to solve/work-around the
>>>> problem ;-)
>>>>
>>>> Kind regards
>>>> Bas Stottelaar
>>>>
>>>>
>>>>
>>>> Op wo 19 dec. 2018 om 08:08 schreef Olivier Fauchon <
>>>> ofauchon2204 at gmail.com>:
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I recently bricked a couple of MCUs playing with low power modes.
>>>>> I'm still not sure what happened, but enabling LPM on my board makes
>>>>> JTAG
>>>>> inoperant.
>>>>>
>>>>> I spent a lot of time trying to save these dead MCUs.
>>>>>
>>>>> To avoid this situation, I added some kind of recovery mode at boot :
>>>>>
>>>>>
>>>>> board.c
>>>>>
>>>>> void board_init(void)
>>>>> ...
>>>>>
>>>>>     // Safeguard: Infinite loop if board started with buttons pushed
>>>>>     gpio_init(BTN0_PIN, GPIO_IN_PU);
>>>>>     gpio_init(BTN1_PIN, GPIO_IN_PU);
>>>>>     if (!gpio_read(BTN0_PIN) ||  !gpio_read(BTN1_PIN) ) {
>>>>>         gpio_set(LED0_PIN);
>>>>>         gpio_set(LED1_PIN);
>>>>>         while(1){}
>>>>>     }
>>>>>
>>>>> Did I reinvent the wheel ?
>>>>> Do Riot have already mecanisms to delay boot , or other way to protect
>>>>> from bad images ?
>>>>>
>>>>> Thanks
>>>>> Olivier Fauchon
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> users mailing list
>>>>> users at riot-os.org
>>>>> https://lists.riot-os.org/mailman/listinfo/users
>>>>>
>>>> _______________________________________________
>>>> users mailing list
>>>> users at riot-os.org
>>>> https://lists.riot-os.org/mailman/listinfo/users
>>>>
>>> _______________________________________________
>>> users mailing list
>>> users at riot-os.org
>>> https://lists.riot-os.org/mailman/listinfo/users
>>>
>>
>>
>> --
>> Dylan Laduranty
>> _______________________________________________
>> users mailing list
>> users at riot-os.org
>> https://lists.riot-os.org/mailman/listinfo/users
>>
> _______________________________________________
> users mailing list
> users at riot-os.org
> https://lists.riot-os.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/users/attachments/20181219/4fbdaff5/attachment-0001.html>


More information about the users mailing list