RISCY BUSINESS»Episode Guide
Trying to Get Our PWM Interrupts to Fire
?
?

Keyboard Navigation

Global Keys

[, < / ], > Jump to previous / next episode
W, K, P / S, J, N Jump to previous / next marker
t / T Toggle theatre / SUPERtheatre mode
V Revert filter to original state Y Select link (requires manual Ctrl-c)

Menu toggling

q Quotes r References f Filter y Link c Credits

In-Menu 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

Filter and Link Menus

z Toggle filter / linking mode

Credits Menu

Enter Open URL (in new tab)
0:08Recap and set the stage for the day with a working toolchain
🗩
0:08Recap and set the stage for the day with a working toolchain
🗩
0:08Recap and set the stage for the day with a working toolchain
🗩
2:26Make and upload pwm_speed_test to the HiFive1
2:26Make and upload pwm_speed_test to the HiFive1
2:26Make and upload pwm_speed_test to the HiFive1
4:08Connect to and reset the HiFive1, and see "Hello, World!"
🏃
4:08Connect to and reset the HiFive1, and see "Hello, World!"
🏃
4:08Connect to and reset the HiFive1, and see "Hello, World!"
🏃
6:22Check the Freedom E SDK's current init.c file1 and the forums2 for information on busy-looping to let the uart settle
6:22Check the Freedom E SDK's current init.c file1 and the forums2 for information on busy-looping to let the uart settle
6:22Check the Freedom E SDK's current init.c file1 and the forums2 for information on busy-looping to let the uart settle
10:04Thoughts on dynamically setting how long to wait, based on the CPU frequency
🗩
10:04Thoughts on dynamically setting how long to wait, based on the CPU frequency
🗩
10:04Thoughts on dynamically setting how long to wait, based on the CPU frequency
🗩
11:41Build, upload but unfortunately fail to connect to the HiFive1
11:41Build, upload but unfortunately fail to connect to the HiFive1
11:41Build, upload but unfortunately fail to connect to the HiFive1
13:42Try to debug our program with gdb3
13:42Try to debug our program with gdb3
13:42Try to debug our program with gdb3
16:16Try to print "Hello World!" in the infinite loop
16:16Try to print "Hello World!" in the infinite loop
16:16Try to print "Hello World!" in the infinite loop
17:07Connect to the HiFive1 and see garbage being printed
🏃
17:07Connect to the HiFive1 and see garbage being printed
🏃
17:07Connect to the HiFive1 and see garbage being printed
🏃
17:50Add "\r" to the end of the printf
17:50Add "\r" to the end of the printf
17:50Add "\r" to the end of the printf
18:14Connect and see it printing "Hello, World!"
🏃
18:14Connect and see it printing "Hello, World!"
🏃
18:14Connect and see it printing "Hello, World!"
🏃
18:44Revert to performing the "wfi" in the loop, and printing "Hello World!" before it, build and upload it
18:44Revert to performing the "wfi" in the loop, and printing "Hello World!" before it, build and upload it
18:44Revert to performing the "wfi" in the loop, and printing "Hello World!" before it, build and upload it
19:15Reset the HiFive1 and see no output
🏃
19:15Reset the HiFive1 and see no output
🏃
19:15Reset the HiFive1 and see no output
🏃
20:19Comment out the "wfi" and ensure that the while scope loops infinitely
20:19Comment out the "wfi" and ensure that the while scope loops infinitely
20:19Comment out the "wfi" and ensure that the while scope loops infinitely
21:57Connect to the HiFive1 and see our "Hello, World!"
🏃
21:57Connect to the HiFive1 and see our "Hello, World!"
🏃
21:57Connect to the HiFive1 and see our "Hello, World!"
🏃
22:27Decide against using the "wfi" instruction
22:27Decide against using the "wfi" instruction
22:27Decide against using the "wfi" instruction
23:23Connect to the HiFive1, see the power lights flickering, and reconnect the power cable
🏃
23:23Connect to the HiFive1, see the power lights flickering, and reconnect the power cable
🏃
23:23Connect to the HiFive1, see the power lights flickering, and reconnect the power cable
🏃
24:53Try to upload and connect, but still see no output
🏃
24:53Try to upload and connect, but still see no output
🏃
24:53Try to upload and connect, but still see no output
🏃
25:40Try a full rebuild and upload
25:40Try a full rebuild and upload
25:40Try a full rebuild and upload
26:02Connect to the HiFive1 and see a "Hello, World!" but no pwm interrupt
🏃
26:02Connect to the HiFive1 and see a "Hello, World!" but no pwm interrupt
🏃
26:02Connect to the HiFive1 and see a "Hello, World!" but no pwm interrupt
🏃
27:02Closely read through the code, and compare it with the led_fade.c demo
27:02Closely read through the code, and compare it with the led_fade.c demo
27:02Closely read through the code, and compare it with the led_fade.c demo
30:03Configure the PWM in ENALWAYS mode and with PWM_CMP0 = 04
🖮
📖
30:03Configure the PWM in ENALWAYS mode and with PWM_CMP0 = 04
🖮
📖
30:03Configure the PWM in ENALWAYS mode and with PWM_CMP0 = 04
🖮
📖
36:48Connect to the HiFive1, see the "Hello, World!" but still no interrupts
🏃
36:48Connect to the HiFive1, see the "Hello, World!" but still no interrupts
🏃
36:48Connect to the HiFive1, see the "Hello, World!" but still no interrupts
🏃
37:29#include platform.h and set the pwmscp0ip bit5
🖮
📖
37:29#include platform.h and set the pwmscp0ip bit5
🖮
📖
37:29#include platform.h and set the pwmscp0ip bit5
🖮
📖
41:54Connect to the HiFive1 and see no change
🏃
41:54Connect to the HiFive1 and see no change
🏃
41:54Connect to the HiFive1 and see no change
🏃
42:44Scour the Freedom E SDK demos for interrupts that use the PWM
📖
42:44Scour the Freedom E SDK demos for interrupts that use the PWM
📖
42:44Scour the Freedom E SDK demos for interrupts that use the PWM
📖
44:27See how the global_interrupts demo handles the interrupts
📖
44:27See how the global_interrupts demo handles the interrupts
📖
44:27See how the global_interrupts demo handles the interrupts
📖
49:45Determine that the only difference between global_interrupts and our pwm_speed_test is that we are not setting the priority or the compare registers
🗩
49:45Determine that the only difference between global_interrupts and our pwm_speed_test is that we are not setting the priority or the compare registers
🗩
49:45Determine that the only difference between global_interrupts and our pwm_speed_test is that we are not setting the priority or the compare registers
🗩
50:45Try to use exactly the same PWM configuration as global_interrupts
50:45Try to use exactly the same PWM configuration as global_interrupts
50:45Try to use exactly the same PWM configuration as global_interrupts
53:08Connect to and reset our HiFive1, but still see no PWM interrupt
🏃
53:08Connect to and reset our HiFive1, but still see no PWM interrupt
🏃
53:08Connect to and reset our HiFive1, but still see no PWM interrupt
🏃
54:24Try to set the priority and enable timer interrupts
54:24Try to set the priority and enable timer interrupts
54:24Try to set the priority and enable timer interrupts
56:57Reset our HiFive1 and see a "trap"
🏃
56:57Reset our HiFive1 and see a "trap"
🏃
56:57Reset our HiFive1 and see a "trap"
🏃
58:29Note that global_interrupts is setting a handler for the timer interrupt and calling set_timer()
📖
58:29Note that global_interrupts is setting a handler for the timer interrupt and calling set_timer()
📖
58:29Note that global_interrupts is setting a handler for the timer interrupt and calling set_timer()
📖
59:20Introduce handle_m_time_interrupt()
59:20Introduce handle_m_time_interrupt()
59:20Introduce handle_m_time_interrupt()
1:04:41Connect to our HiFive1 and see one instance of "handling timer interrupt" before a "trap", yet no "Hello, World!"
🏃
1:04:41Connect to our HiFive1 and see one instance of "handling timer interrupt" before a "trap", yet no "Hello, World!"
🏃
1:04:41Connect to our HiFive1 and see one instance of "handling timer interrupt" before a "trap", yet no "Hello, World!"
🏃
1:06:29Search the demos for MTIP and consult demo_gpio for their timer handling
📖
1:06:29Search the demos for MTIP and consult demo_gpio for their timer handling
📖
1:06:29Search the demos for MTIP and consult demo_gpio for their timer handling
📖
1:07:27Make handle_m_time_interrupt() disable and reenable the MTIP
1:07:27Make handle_m_time_interrupt() disable and reenable the MTIP
1:07:27Make handle_m_time_interrupt() disable and reenable the MTIP
1:10:05Connect to our HiFive1 and see the same output
🏃
1:10:05Connect to our HiFive1 and see the same output
🏃
1:10:05Connect to our HiFive1 and see the same output
🏃
1:10:29Make handle_m_time_interrupt() print "leaving timer interrupt"
1:10:29Make handle_m_time_interrupt() print "leaving timer interrupt"
1:10:29Make handle_m_time_interrupt() print "leaving timer interrupt"
1:11:03Connect to our HiFive1 and see the "leaving timer interrupt"
1:11:03Connect to our HiFive1 and see the "leaving timer interrupt"
1:11:03Connect to our HiFive1 and see the "leaving timer interrupt"
1:11:34Comment out the set_csr(mie, MIP_MTIP) call in main()
1:11:34Comment out the set_csr(mie, MIP_MTIP) call in main()
1:11:34Comment out the set_csr(mie, MIP_MTIP) call in main()
1:11:53Connect to our HiFive1 and see that we are still trapping
🏃
1:11:53Connect to our HiFive1 and see that we are still trapping
🏃
1:11:53Connect to our HiFive1 and see that we are still trapping
🏃
1:12:09Comment out the following set_csr() calls
1:12:09Comment out the following set_csr() calls
1:12:09Comment out the following set_csr() calls
1:12:40Connect to our HiFive1 and see the "Hello, World!"
🏃
1:12:40Connect to our HiFive1 and see the "Hello, World!"
🏃
1:12:40Connect to our HiFive1 and see the "Hello, World!"
🏃
1:13:13Uncomment the set_csr(mstatus, MSTATUS_MIE) call in main()
1:13:13Uncomment the set_csr(mstatus, MSTATUS_MIE) call in main()
1:13:13Uncomment the set_csr(mstatus, MSTATUS_MIE) call in main()
1:13:35Connect to our HiFive1 and hit the trap
🏃
1:13:35Connect to our HiFive1 and hit the trap
🏃
1:13:35Connect to our HiFive1 and hit the trap
🏃
1:14:14Try various combinations of interrupts, run the program and always hit the trap
🏃
🖮
1:14:14Try various combinations of interrupts, run the program and always hit the trap
🏃
🖮
1:14:14Try various combinations of interrupts, run the program and always hit the trap
🏃
🖮
1:16:27Comment out everything except the set_csr() and printf() calls
1:16:27Comment out everything except the set_csr() and printf() calls
1:16:27Comment out everything except the set_csr() and printf() calls
1:17:10Connect to our HiFive1 and still trap
🏃
1:17:10Connect to our HiFive1 and still trap
🏃
1:17:10Connect to our HiFive1 and still trap
🏃
1:17:54Make and upload demo_gpio
1:17:54Make and upload demo_gpio
1:17:54Make and upload demo_gpio
1:18:49Reset our HiFive1 and see everything working as expected
🏃
1:18:49Reset our HiFive1 and see everything working as expected
🏃
1:18:49Reset our HiFive1 and see everything working as expected
🏃
1:19:12Read the documentation for some gotcha related to mstatus6
📖
1:19:12Read the documentation for some gotcha related to mstatus6
📖
1:19:12Read the documentation for some gotcha related to mstatus6
📖
1:21:13Wrap it up with the determination to continue our investigation next time
🗩
1:21:13Wrap it up with the determination to continue our investigation next time
🗩
1:21:13Wrap it up with the determination to continue our investigation next time
🗩