Getting the PWM Interrupts to Fire ⚠ Click here to regain focus ⚠
?
?

Keyboard Navigation

Global Keys

W, A, P / S, D, N Jump to previous / next marker
t / T Toggle theatre / SUPERtheatre mode
z Toggle filter mode V Revert filter to original state

Menu toggling

q Quotes r References f Filter c Credits

Movement

a
w
s
d
h j k l


Quotes and References Menus

Enter Jump to timecode

Quotes, References and Credits Menus

o Open URL (in new tab)

Filter Menu

x, Space Toggle category and focus next
X, ShiftSpace Toggle category and focus previous
v Invert topics / media as per focus

Credits Menu

Enter Open URL (in new tab)
0:07Plug SiFive's Linux-capable HiFive Unleashed chip1
📖
0:07Plug SiFive's Linux-capable HiFive Unleashed chip1
📖
0:07Plug SiFive's Linux-capable HiFive Unleashed chip1
📖
5:28Check out the HiFive Unleashed specs2 with exciting thoughts for it in RISCY BUSINESS
📖
5:28Check out the HiFive Unleashed specs2 with exciting thoughts for it in RISCY BUSINESS
📖
5:28Check out the HiFive Unleashed specs2 with exciting thoughts for it in RISCY BUSINESS
📖
16:04Plan to port pcalc to RISC-V to work on the HiFive Unleashed
🗩
16:04Plan to port pcalc to RISC-V to work on the HiFive Unleashed
🗩
16:04Plan to port pcalc to RISC-V to work on the HiFive Unleashed
🗩
21:35Determine to continue our investigation into the trap on mstatus in pwm_speed_test.c and to run it in gdb
🗩
21:35Determine to continue our investigation into the trap on mstatus in pwm_speed_test.c and to run it in gdb
🗩
21:35Determine to continue our investigation into the trap on mstatus in pwm_speed_test.c and to run it in gdb
🗩
25:12Read section 6.2.4 - Debugging Running Programs3
📖
25:12Read section 6.2.4 - Debugging Running Programs3
📖
25:12Read section 6.2.4 - Debugging Running Programs3
📖
27:33Comment out the set_csr(mie, MIP_MTIP) and set_csr(mstatus, MSTATUS_MIE) calls in main()
27:33Comment out the set_csr(mie, MIP_MTIP) and set_csr(mstatus, MSTATUS_MIE) calls in main()
27:33Comment out the set_csr(mie, MIP_MTIP) and set_csr(mstatus, MSTATUS_MIE) calls in main()
28:06Make and upload pwm_speed_test
28:06Make and upload pwm_speed_test
28:06Make and upload pwm_speed_test
29:49Reset the board, to see that we don't trap
🏃
29:49Reset the board, to see that we don't trap
🏃
29:49Reset the board, to see that we don't trap
🏃
29:56Uncomment the set_csr(mstatus, MSTATUS_MIE) call in main()
29:56Uncomment the set_csr(mstatus, MSTATUS_MIE) call in main()
29:56Uncomment the set_csr(mstatus, MSTATUS_MIE) call in main()
30:08Make, upload and reset to find that we unexpectedly fail to trap
🏃
30:08Make, upload and reset to find that we unexpectedly fail to trap
🏃
30:08Make, upload and reset to find that we unexpectedly fail to trap
🏃
31:15Reset the board in safe mode, and find that we still fail to trap
🏃
31:15Reset the board in safe mode, and find that we still fail to trap
🏃
31:15Reset the board in safe mode, and find that we still fail to trap
🏃
32:41Uncomment the handle_m_time_interrupt() and set_csr(mie. MIP_MTIP) calls in main()
32:41Uncomment the handle_m_time_interrupt() and set_csr(mie. MIP_MTIP) calls in main()
32:41Uncomment the handle_m_time_interrupt() and set_csr(mie. MIP_MTIP) calls in main()
33:10Run to find that we trap after a short delay
🏃
33:10Run to find that we trap after a short delay
🏃
33:10Run to find that we trap after a short delay
🏃
33:46Read carefully through handle_m_time_interrupt()
📖
33:46Read carefully through handle_m_time_interrupt()
📖
33:46Read carefully through handle_m_time_interrupt()
📖
36:29Copy the busy loop from led_fade.c into uart_init() in init.c, and reduce the wait time in handle_m_time_interrupt() to 2 seconds
36:29Copy the busy loop from led_fade.c into uart_init() in init.c, and reduce the wait time in handle_m_time_interrupt() to 2 seconds
36:29Copy the busy loop from led_fade.c into uart_init() in init.c, and reduce the wait time in handle_m_time_interrupt() to 2 seconds
38:11Run the program to find that we trap after waiting 2 seconds
🏃
38:11Run the program to find that we trap after waiting 2 seconds
🏃
38:11Run the program to find that we trap after waiting 2 seconds
🏃
38:54Discover the USE_M_TIME #ifdef in init.c and check out the Makefile of other demos that call handle_m_time_interrupt() to find that they contain the flag -DUSE_M_TIME
📖
38:54Discover the USE_M_TIME #ifdef in init.c and check out the Makefile of other demos that call handle_m_time_interrupt() to find that they contain the flag -DUSE_M_TIME
📖
38:54Discover the USE_M_TIME #ifdef in init.c and check out the Makefile of other demos that call handle_m_time_interrupt() to find that they contain the flag -DUSE_M_TIME
📖
40:35Add -DUSE_PLIC and -DUSE_M_TIME to the pwm_speed_test Makefile
40:35Add -DUSE_PLIC and -DUSE_M_TIME to the pwm_speed_test Makefile
40:35Add -DUSE_PLIC and -DUSE_M_TIME to the pwm_speed_test Makefile
42:00Run the program to find that it now works beautifully
🏃
42:00Run the program to find that it now works beautifully
🏃
42:00Run the program to find that it now works beautifully
🏃
42:20Delete all the timer interrupt code, in favour of the PLIC code
42:20Delete all the timer interrupt code, in favour of the PLIC code
42:20Delete all the timer interrupt code, in favour of the PLIC code
46:59Run the program to see "Hello, World" but no interrupt or trap
🏃
46:59Run the program to see "Hello, World" but no interrupt or trap
🏃
46:59Run the program to see "Hello, World" but no interrupt or trap
🏃
48:47Compare our PLIC code with that in global_interrupts.c, try to change PWM0_REG(PWM_CMP0) to PWM0_REG(PWM_COUNT), and instead uncomment the PLIC_set_priority() call in main()
48:47Compare our PLIC code with that in global_interrupts.c, try to change PWM0_REG(PWM_CMP0) to PWM0_REG(PWM_COUNT), and instead uncomment the PLIC_set_priority() call in main()
48:47Compare our PLIC code with that in global_interrupts.c, try to change PWM0_REG(PWM_CMP0) to PWM0_REG(PWM_COUNT), and instead uncomment the PLIC_set_priority() call in main()
53:15Run the program and hit our PWM interrupt!
🏃
53:15Run the program and hit our PWM interrupt!
🏃
53:15Run the program and hit our PWM interrupt!
🏃
53:44Determine to go back to timing
🗩
53:44Determine to go back to timing
🗩
53:44Determine to go back to timing
🗩
55:40Read Chapter 15 - E300 Pulse-Width Modulation (PWM) Peripheral4
📖
55:40Read Chapter 15 - E300 Pulse-Width Modulation (PWM) Peripheral4
📖
55:40Read Chapter 15 - E300 Pulse-Width Modulation (PWM) Peripheral4
📖
56:42Try setting PWM0_REG(PWM_CMP0) = 0xFFFF
56:42Try setting PWM0_REG(PWM_CMP0) = 0xFFFF
56:42Try setting PWM0_REG(PWM_CMP0) = 0xFFFF
57:30Run the program to see that our interrupts fire pretty fast
🏃
57:30Run the program to see that our interrupts fire pretty fast
🏃
57:30Run the program to see that our interrupts fire pretty fast
🏃
57:51Try to add 0x1 to the timer rearming call
57:51Try to add 0x1 to the timer rearming call
57:51Try to add 0x1 to the timer rearming call
58:11Run the program to see that our interrupts still fire pretty fast
🏃
58:11Run the program to see that our interrupts still fire pretty fast
🏃
58:11Run the program to see that our interrupts still fire pretty fast
🏃
58:26Bump straight up to 0x7 in the timer rearming call
58:26Bump straight up to 0x7 in the timer rearming call
58:26Bump straight up to 0x7 in the timer rearming call
58:44Run the program to see that our interrupts still fire pretty fast
🏃
58:44Run the program to see that our interrupts still fire pretty fast
🏃
58:44Run the program to see that our interrupts still fire pretty fast
🏃
1:00:42Note that we wanted to be in one-shot mode, and try making pwm_0_handler() clear the PWM_CFG register
1:00:42Note that we wanted to be in one-shot mode, and try making pwm_0_handler() clear the PWM_CFG register
1:00:42Note that we wanted to be in one-shot mode, and try making pwm_0_handler() clear the PWM_CFG register
1:02:05Run the program to see that we are correctly in one-shot mode
🏃
1:02:05Run the program to see that we are correctly in one-shot mode
🏃
1:02:05Run the program to see that we are correctly in one-shot mode
🏃
1:02:44Rearm the timer in pwm_0_handler()
1:02:44Rearm the timer in pwm_0_handler()
1:02:44Rearm the timer in pwm_0_handler()
1:03:53Run the program to see that the timer gets rearmed each time, and note that it still runs pretty fast
🏃
1:03:53Run the program to see that the timer gets rearmed each time, and note that it still runs pretty fast
🏃
1:03:53Run the program to see that the timer gets rearmed each time, and note that it still runs pretty fast
🏃
1:05:02Consider the main use-case of PWM interrupts being for debouncing, and plug the Guide to Debouncing5
📖
1:05:02Consider the main use-case of PWM interrupts being for debouncing, and plug the Guide to Debouncing5
📖
1:05:02Consider the main use-case of PWM interrupts being for debouncing, and plug the Guide to Debouncing5
📖
1:11:04Consider alternate ways to handle debouncing, and uses for PWM interrupts
🗩
1:11:04Consider alternate ways to handle debouncing, and uses for PWM interrupts
🗩
1:11:04Consider alternate ways to handle debouncing, and uses for PWM interrupts
🗩
1:14:24Determine that we have a good understanding of global_interrupts, and to start fully learning timing in the next episode
🗩
1:14:24Determine that we have a good understanding of global_interrupts, and to start fully learning timing in the next episode
🗩
1:14:24Determine that we have a good understanding of global_interrupts, and to start fully learning timing in the next episode
🗩
1:15:44Plug the new Gumroad-powered subscription solution6, along with a note that the Transparency Reports alone remain solely available publicly on Patreon7
🗩
1:15:44Plug the new Gumroad-powered subscription solution6, along with a note that the Transparency Reports alone remain solely available publicly on Patreon7
🗩
1:15:44Plug the new Gumroad-powered subscription solution6, along with a note that the Transparency Reports alone remain solely available publicly on Patreon7
🗩