1
00:00:01,650 --> 00:00:02,160
Hello.

2
00:00:02,190 --> 00:00:03,220
Welcome back.

3
00:00:03,240 --> 00:00:07,320
In this lesson we are going to see how to write a drive for a while.

4
00:00:07,350 --> 00:00:08,550
Cystic time.

5
00:00:09,140 --> 00:00:16,680
And then we going to use the cystic to create a delay function to create precise delays in this experiment.

6
00:00:16,710 --> 00:00:19,190
I'm gonna create a new project by coming over here.

7
00:00:19,230 --> 00:00:28,380
New York Vision Project I store it in this forward I've created a name called the cystic

8
00:00:31,510 --> 00:00:35,990
and my port is Tim for C 1 2 3 0 8 6 p.m.

9
00:00:38,890 --> 00:00:44,520
and then under this UMC is select to call on a device Austerlitz startup.

10
00:00:45,140 --> 00:00:45,710
Okay

11
00:00:48,530 --> 00:00:50,140
I'm gonna come over here.

12
00:00:50,150 --> 00:00:55,730
My target is the team full support team for C 1 2 3 Use you each.

13
00:00:55,760 --> 00:00:58,280
I'll just make it to 4 see 1 2 3.

14
00:00:58,590 --> 00:01:03,280
And um she was group here.

15
00:01:04,020 --> 00:01:09,590
This is up and then create a new fault here.

16
00:01:09,620 --> 00:01:10,340
This is a mate.

17
00:01:10,640 --> 00:01:11,230
Oh.

18
00:01:11,240 --> 00:01:15,190
Make it s mean that s cool it made notice like this.

19
00:01:15,210 --> 00:01:25,670
Okay so um we're gonna write a driver for the cystic timer so the cystic timer is a cool pair for all

20
00:01:25,700 --> 00:01:37,550
of um cortex M and what I mean by copay for is that this this is included this is included in the architecture.

21
00:01:37,550 --> 00:01:41,410
So this is not ordered by the silicon manufacturer.

22
00:01:41,730 --> 00:01:43,230
And what I mean is this.

23
00:01:43,510 --> 00:01:43,760
Okay.

24
00:01:43,760 --> 00:01:45,400
Before I continue.

25
00:01:45,470 --> 00:01:54,020
For those of you who don't know the UM WE SAY UM cortex M for cortex M 3 etc..

26
00:01:54,140 --> 00:01:57,320
Um is a company based in Cambridge UK.

27
00:01:57,920 --> 00:02:00,710
And this company does not manufacture any hardware.

28
00:02:00,740 --> 00:02:02,860
They don't produce hardware.

29
00:02:02,910 --> 00:02:10,280
If Tesco excellent engineers who come up with designs and then they sell the license of their designs

30
00:02:10,280 --> 00:02:13,360
to people to companies I should say so.

31
00:02:13,470 --> 00:02:19,940
S t microelectronics has it license from um Texas Instruments has a license from um.

32
00:02:20,160 --> 00:02:26,330
Apple has a license from some source a license from um while we has a license from up I could go on

33
00:02:26,330 --> 00:02:27,170
and on.

34
00:02:27,170 --> 00:02:33,730
In fact it was estimated that over 90 percent of mobile phones out there use um architecture.

35
00:02:33,860 --> 00:02:41,510
But the one used in mobile phones is the cool text a architecture not a cortex m a stance for application

36
00:02:41,600 --> 00:02:43,300
M stands for microcontroller.

37
00:02:43,310 --> 00:02:47,840
So we are dealing with the cortex microcontroller right.

38
00:02:47,870 --> 00:02:54,530
So when I say since this is part of the core architecture I mean when you buy the license or when you

39
00:02:54,530 --> 00:03:03,010
sign up for a license from um the car designed to give you a full context M cystic is part of it.

40
00:03:03,110 --> 00:03:08,750
So it is up to me with a silicon manufacturer to add at a peripheral such as the ADC that you are to

41
00:03:08,750 --> 00:03:17,950
the US be the SBI ITC etc. those at a per force are included by this uh by the by the silicon manufacturer

42
00:03:17,990 --> 00:03:22,160
but by the cystic timer is part of the call peripheral.

43
00:03:22,160 --> 00:03:28,550
So mean in the court we write over here for cystic should work on an equal text M for board the same

44
00:03:28,550 --> 00:03:30,890
way because the address is the same.

45
00:03:30,890 --> 00:03:35,810
This is not decided by the silicon manufacturer right.

46
00:03:36,590 --> 00:03:45,290
So because of this to get the M to get the address of the cystic registers we are going to go to the

47
00:03:45,380 --> 00:03:52,790
cortex M We're going to go to the cortex and generic use a guide rather than go to a what team for C

48
00:03:53,170 --> 00:03:53,810
datasheet.

49
00:03:53,820 --> 00:03:59,840
We're going to go to the generic you said guide provided by arm with regards to quote text M for so

50
00:03:59,840 --> 00:04:06,820
you can just come to books over here and select cool text M for generic use a guide.

51
00:04:06,820 --> 00:04:07,190
Right.

52
00:04:07,190 --> 00:04:07,710
This is it.

53
00:04:07,730 --> 00:04:10,170
This document is provided by arm.

54
00:04:10,300 --> 00:04:11,770
Right.

55
00:04:11,840 --> 00:04:20,980
So what we want to do is find the um find the cystic register this um in the generic use guide.

56
00:04:22,560 --> 00:04:23,100
Let's see.

57
00:04:23,120 --> 00:04:30,720
This should be a page that tells us the Memory map of the copay froze.

58
00:04:31,690 --> 00:04:35,480
Okay so over here we we have context M for poor folks.

59
00:04:35,520 --> 00:04:43,110
So all of this is included in cortex M for us the call when you buy devices.

60
00:04:43,110 --> 00:04:45,200
So I'm gonna click on the cystic timer over here.

61
00:04:45,210 --> 00:04:46,110
Let's see what we have.

62
00:04:47,630 --> 00:04:49,080
Okay yeah.

63
00:04:49,300 --> 00:04:50,830
This the cystic time.

64
00:04:50,850 --> 00:04:54,160
So these are the cystic Regis this and over here.

65
00:04:54,160 --> 00:04:58,340
It gives a short um short so explanation for cystic.

66
00:04:58,380 --> 00:05:06,870
It says the process has a 24 but 24 it s type system timer narcissistic sort of what cystic is an abbreviation

67
00:05:06,870 --> 00:05:08,850
of assistant timer.

68
00:05:09,180 --> 00:05:13,050
This time a count down from a reload value to zero re lowest.

69
00:05:13,080 --> 00:05:19,280
Then it reps to the value in the cystic reload uh fully register.

70
00:05:19,440 --> 00:05:23,700
I think that is a R V R is reload value register.

71
00:05:23,790 --> 00:05:24,090
Right.

72
00:05:24,120 --> 00:05:29,970
So each item registers machine will need for our cystic timer so we have to create symbolic names for

73
00:05:29,970 --> 00:05:32,310
these registers.

74
00:05:32,310 --> 00:05:32,760
Right.

75
00:05:32,760 --> 00:05:39,250
So let's start of uh let's start with the cystic control register.

76
00:05:39,360 --> 00:05:44,010
This one here since they control and that is register we're going to call this we're going to give this

77
00:05:44,010 --> 00:05:50,850
registered in name and Vic system control register because when you take a look at the um the driver's

78
00:05:51,000 --> 00:05:57,900
provided by the silicon manufacturer we can take a look at your Texas Instruments your team 4C 1 2 3

79
00:05:58,320 --> 00:06:05,250
0 8 6 p.m. dot age 5 that is often provided by Texas Instruments for people who do want to write the

80
00:06:05,250 --> 00:06:06,310
bare metal code.

81
00:06:06,390 --> 00:06:08,970
We take a look at this head of the name.

82
00:06:09,000 --> 00:06:12,730
They've given this registers we're going to use the same naming convention.

83
00:06:12,780 --> 00:06:24,360
So it's often called n Vic and Vic um it s written like this and Vic and n VIX times for ness uh ness

84
00:06:24,390 --> 00:06:34,860
that effect or interrupt controller and then SD for cystic and then we say C T C T R O for control and

85
00:06:34,860 --> 00:06:41,870
then R for register and this the address here we just get it.

86
00:06:41,880 --> 00:06:44,900
This is the address for this is the control register.

87
00:06:46,290 --> 00:06:51,840
So it does the naming convention which we use for this right after the.

88
00:06:51,870 --> 00:06:52,920
Let's see.

89
00:06:52,920 --> 00:06:56,630
We also need the um the cystic reload value register.

90
00:06:57,360 --> 00:07:05,670
We're going to call this one and Vic and I echo SD and this called reload on let's school R and then

91
00:07:05,850 --> 00:07:07,050
we give a symbolic name.

92
00:07:07,980 --> 00:07:10,990
Uh this the symbolic name will bring the actual register.

93
00:07:11,220 --> 00:07:17,680
The actual code.

94
00:07:17,830 --> 00:07:18,460
There we go.

95
00:07:19,150 --> 00:07:23,980
So after this let's take a look at the next register.

96
00:07:24,130 --> 00:07:27,830
This is the current value register.

97
00:07:27,880 --> 00:07:28,790
Copy it.

98
00:07:28,900 --> 00:07:33,410
We simply are going to call this cystic current to register.

99
00:07:33,510 --> 00:07:41,260
I'll say and Vic SD current on the score.

100
00:07:41,290 --> 00:07:42,840
Are you.

101
00:07:42,840 --> 00:07:44,980
Q You and this.

102
00:07:45,550 --> 00:07:46,020
Right.

103
00:07:46,840 --> 00:07:50,380
So these are the three important registers we need for this experiment.

104
00:07:50,380 --> 00:07:56,200
We don't need this last one the collaboration register we don't need it so we can read up a bit uh about

105
00:07:56,200 --> 00:07:57,100
this.

106
00:07:57,160 --> 00:08:02,970
So this is the control register the control register as you can see we have better numbers you were

107
00:08:03,030 --> 00:08:11,660
1 2 to 3 to 15 our reserved but 16 is used for the count flag bit 17 to 31 are reserved.

108
00:08:11,680 --> 00:08:12,640
Let's see the meaning.

109
00:08:12,760 --> 00:08:13,790
Okay.

110
00:08:13,780 --> 00:08:16,250
It's 16 counts luck This returns one.

111
00:08:16,280 --> 00:08:20,350
If the time I counted to zero since the last time this was read.

112
00:08:20,470 --> 00:08:27,400
So this is where we use this flag to check what out a what time out hustle kit which is located at bits

113
00:08:27,430 --> 00:08:36,200
number 16 of the offices the control register and button number two indicates the clock source.

114
00:08:36,230 --> 00:08:41,410
What are we using an external clock or an internal clock which is a process a clock.

115
00:08:41,530 --> 00:08:46,950
This is between number two if we are using our internal process a clock we have to parse one two bits

116
00:08:46,960 --> 00:08:48,880
number 2 over here.

117
00:08:48,890 --> 00:08:53,760
Code clock source it's number 1 is known as the tick interrupt.

118
00:08:53,800 --> 00:09:01,300
This enables systemic exception request and it s s 0 counting down to zero does no I said just take

119
00:09:01,300 --> 00:09:07,420
exception requests weren't counted down to zero except to basically use this to enable the system interrupt

120
00:09:07,510 --> 00:09:12,060
or exception and then bits number zeros to enable the counter.

121
00:09:12,070 --> 00:09:18,130
In other words to a neighborhood assisted time timeout so we use pit number zero to do that when we

122
00:09:18,130 --> 00:09:25,930
pass one we've enabled it to one policy we've disabled it so that is the system control register right

123
00:09:26,500 --> 00:09:34,810
and the rule load register specifies this that the value to load into the cystic um current value register.

124
00:09:34,810 --> 00:09:35,200
Right.

125
00:09:35,350 --> 00:09:43,120
And over here it s it s twenty four bit the maximum value we can load into the reload registers 24 bit

126
00:09:43,150 --> 00:09:47,160
from zero to twenty three over here and over here it's reserved.

127
00:09:47,200 --> 00:09:54,100
So we load our value here to reload value can be any value in the range of your x years or 1 2 0 x and

128
00:09:54,100 --> 00:09:57,790
this is the maximum 24 bit value.

129
00:10:00,190 --> 00:10:00,980
Okay.

130
00:10:01,020 --> 00:10:07,160
So okay so you can come back it can come back and read more about the Sestak if you want to learn more

131
00:10:07,170 --> 00:10:12,700
for that but we're going to create symbolic names to represent these other things such as things like

132
00:10:12,700 --> 00:10:19,030
the clock so screws in the clocks also enable disable the tick interrupt and enable disable the timer

133
00:10:19,080 --> 00:10:28,690
will create symbolic names to use for those um I'm gonna come down here and I'm going to say and Vic

134
00:10:34,280 --> 00:10:45,680
gets the control count this would represent the count of luck we'll see it can you and I'm simply going

135
00:10:45,680 --> 00:10:46,400
to pass this

136
00:10:49,820 --> 00:10:57,100
this pits number sixteen This sets bits number sixteen to one in the control register and then I'll

137
00:10:57,280 --> 00:10:58,160
say and fake

138
00:11:03,050 --> 00:11:07,500
s t control clock SOS.

139
00:11:07,530 --> 00:11:13,940
This will allow us to select into our process a clock source or an external clock source.

140
00:11:13,970 --> 00:11:14,520
Q You

141
00:11:17,490 --> 00:11:25,920
I'm going to pass one to that particular bit and if you explain this for you would realize that one

142
00:11:26,040 --> 00:11:34,950
enables the bits that select the process a clock source for us and then next interrupt enable when I

143
00:11:34,950 --> 00:11:36,470
use an interrupt in this example.

144
00:11:36,480 --> 00:11:46,200
But when we start dealing with interrupt you need this as the control and then into enable a queue you

145
00:11:49,210 --> 00:11:51,190
I'm gonna pass this here

146
00:11:58,980 --> 00:12:02,700
next is to enable

147
00:12:05,700 --> 00:12:12,950
and we enable through the control register and Vic as the control register enable

148
00:12:15,960 --> 00:12:22,320
c e q you over here and then we know pit 0 is for enabling.

149
00:12:23,230 --> 00:12:30,280
And then next a reload value you gonna say n fake SD.

150
00:12:30,660 --> 00:12:34,290
Um s t reload would put us in the reload register.

151
00:12:34,340 --> 00:12:46,840
M P to you and then we're going to use the maximum 24 bit value Okay so I just put a comment to this

152
00:12:46,840 --> 00:12:48,020
what it can't flag.

153
00:12:57,450 --> 00:12:59,810
This over here is for cluck sauce.

154
00:13:03,520 --> 00:13:09,490
This is for interrupt enable or interrupt

155
00:13:11,930 --> 00:13:16,970
and enable counter mode.

156
00:13:16,970 --> 00:13:21,440
And then there's the current load value

157
00:13:29,360 --> 00:13:29,720
right.

158
00:13:30,050 --> 00:13:38,440
So the next thing we have to do is bring in the um the registers for a while the registers for our LCD

159
00:13:38,570 --> 00:13:41,150
because we want to make an LCD blink.

160
00:13:41,180 --> 00:13:47,930
So because we've already learned how to create symbolic names for our registers which in regards to

161
00:13:47,930 --> 00:13:51,350
GPL your output would need not do that from scratch.

162
00:13:51,350 --> 00:13:56,980
I'm just going to copy it from the previous project and bring it over here.

163
00:14:00,730 --> 00:14:04,000
Copy this pasted over here like this.

164
00:14:04,000 --> 00:14:10,620
So we've got we've got a direction to teach to enable the data register.

165
00:14:12,250 --> 00:14:13,780
Yeah.

166
00:14:14,230 --> 00:14:24,280
And then um symbolic names for enabling GPL u f as well as our LCD and then not a symbolic name to turn

167
00:14:24,280 --> 00:14:25,750
off the red LCD.

168
00:14:25,750 --> 00:14:35,290
We're gonna be using the red LCD here right.

169
00:14:35,370 --> 00:14:35,880
Right.

170
00:14:35,880 --> 00:14:40,470
So we are done assigning symbolic names to our relevant registers.

171
00:14:41,400 --> 00:14:42,870
Let's continue into next lesson.

172
00:14:42,870 --> 00:14:44,820
Let's implement to what driver.

173
00:14:44,850 --> 00:14:45,620
I'll see you later.
