1
00:00:01,110 --> 00:00:08,250
In this lecture, I want to show you a couple of ways to use software to reset your ISP 32 in addition

2
00:00:08,250 --> 00:00:14,260
to the hardware reset down by pressing the reset button on the device itself.

3
00:00:15,180 --> 00:00:23,670
If you have a look at the micro python documentation into the machine module and reset related functions

4
00:00:23,670 --> 00:00:28,620
right here, you'll see that there are a couple of ways of doing such an operation.

5
00:00:28,980 --> 00:00:32,250
The first one is just calling the reset method.

6
00:00:32,490 --> 00:00:39,950
And this is going to basically have the same effect as if you were pressing the external reset button

7
00:00:39,960 --> 00:00:41,340
is going to reset the device.

8
00:00:41,850 --> 00:00:48,570
The second method is to use the soft reset, which is going to simply reset the interpreter.

9
00:00:48,960 --> 00:00:53,300
It will clear up memory, reset the python heap, as you can see here.

10
00:00:53,760 --> 00:01:01,080
But the most important difference between these two is that the soft reset will not disconnect you from

11
00:01:01,740 --> 00:01:03,900
USB or wi fi connections.

12
00:01:05,130 --> 00:01:12,630
I don't have a script to show you, so we'll do the demonstration and the experimentation in the show

13
00:01:12,750 --> 00:01:13,670
on the command line.

14
00:01:14,070 --> 00:01:22,740
So let's begin first by importing machine machine module and I'm going to attempt a soft recidivist.

15
00:01:24,100 --> 00:01:30,760
Do soft research, copy and paste that into a show and you get a soft reboot.

16
00:01:31,600 --> 00:01:41,560
If I tried to to bring up the reset caused by calling the reset cause method copy and paste it in here,

17
00:01:42,400 --> 00:01:47,560
you'll see that machine is not defined, which means that the ram was wiped out.

18
00:01:48,460 --> 00:01:58,690
And I will read the import machine and check on the reset course and then no one comes up, which there's

19
00:01:58,690 --> 00:01:59,470
a link here.

20
00:01:59,470 --> 00:02:03,100
So you can see the constants that are used by reset.

21
00:02:03,100 --> 00:02:09,610
Cause of this number corresponds to one hard reset, which is the bit weird.

22
00:02:09,660 --> 00:02:14,880
I wonder if these particular information here is actually correct.

23
00:02:15,310 --> 00:02:22,270
What I'll do is I'm going to leave this aside for now and press the reset button to do a hard reset

24
00:02:22,930 --> 00:02:30,820
called the power on reset and import machine again and check the reset course again.

25
00:02:30,820 --> 00:02:34,030
You see, no one took this is probably correct.

26
00:02:34,030 --> 00:02:34,720
Zero one.

27
00:02:35,080 --> 00:02:36,610
Yeah, hard reset.

28
00:02:37,700 --> 00:02:42,400
I'm going to try out the soft reset method.

29
00:02:44,240 --> 00:02:52,370
To see what happens with that so recent, so you can see this is a software c.p.u reset as opposed to

30
00:02:52,370 --> 00:03:01,020
a power on reset and kind of import machine and check on the reset codes.

31
00:03:01,280 --> 00:03:11,240
And this time it gives me two, which means, you know, one to probably like a WTT reset or watchdog

32
00:03:11,810 --> 00:03:14,060
reset, which OK.

33
00:03:14,090 --> 00:03:14,410
Yep.

34
00:03:14,450 --> 00:03:16,820
This looks right now.

35
00:03:16,860 --> 00:03:19,120
It's a last experiment.

36
00:03:19,130 --> 00:03:29,030
I'm going to go back into the first type of reset, the soft reset and see if that gives me a different

37
00:03:29,030 --> 00:03:29,490
idea.

38
00:03:30,080 --> 00:03:33,950
So I do a soft reset.

39
00:03:35,460 --> 00:03:43,290
Syndicate says a soft reboot and import machine and reset course, this time it's too.

40
00:03:43,860 --> 00:03:53,380
So as you can see, when I do a soft reset, it seems like the actual reset course is not properly reported,

41
00:03:53,380 --> 00:04:00,330
then it would be whatever caused the device to reset prior to my soft reset.

42
00:04:00,780 --> 00:04:03,650
So I guess this is a bug.

43
00:04:04,140 --> 00:04:13,710
So what that tells me is that the soft reset does not actually report itself correctly when you use

44
00:04:13,710 --> 00:04:16,230
the reset course method.

45
00:04:16,240 --> 00:04:21,440
So that's something to keep in mind when you're using these methods in your programming.

46
00:04:22,170 --> 00:04:24,360
But in any case, these two methods.

47
00:04:24,780 --> 00:04:31,730
So reset and soft reset, provide your programmatic way to reset your device with needed.
