Fill in the sizing sheet of a motor controller at 16 kHz with a longer control loop, the way lesson S11.11 does.
Hardware context: A motor controller: centre-aligned PWM with dead time, conversions, an encoder counter and a break input. Size the PWM, walk one period and check the loop budget and the fault path of a motor controller.
This is the controller of lesson S11.11 with other numbers. Walk one PWM period, decide what must be hardware, and size the small buffers.
This worksheet uses named constants. The first three entries show how to record your decisions.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
| Input | Value |
|---|---|
| PWM | centre-aligned, 16,000 periods a second; counter clock 100 MHz; dead time 400 ns; at least 1024 steps |
| Conversions | two, one after the other, 1500 ns each, started at the valley |
| Core | 100 MHz; entry 30 cycles; longest masked section 400 cycles; control loop 3000 cycles; budget 50 percent of a period |
| Encoder | 2000 lines, four edges a line, top speed 3000 turns a minute |
| Fault | outputs off within 1000 ns; a software handler needs 50 cycles after entry |
| Other requests | a speed loop 1000 times a second |
| Telemetry | 16 bytes every 10 periods; the link may stall for 5 ms; the buffer is a power of two |
| SRAM | a sine table of 2048 bytes, the telemetry buffer and 2048 bytes of stack, rounded up to a power of two |
Round a tick count up. Enter times in ns, shares in percent rounded down, KiB as a number, and 1 for yes or 0 for no.
| Entry | Your decision |
|---|---|
| TOP | The top value of the counter. |
| DEAD_TICKS | The dead time in counter ticks. |
| PERIOD_NS | The PWM period in ns. |
| EDGES_PER_PERIOD | Encoder edges in one period at top speed, rounded down. |
| IRQ_TOTAL | Requests each second, control and speed loops. |
| ADC_DONE_NS | When both conversions are done. |
| ISR_START_NS | When the handler starts, in the worst case. |
| ISR_END_NS | When the new duties are written. |
| SLACK_NS | Time left before the next valley. |
| SHARE_PCT | From the end of the conversions to the new duties, as a share of the period. |
| MEETS_BUDGET | Does that share meet the budget of 50 percent? |
| SW_FAULT_NS | Time from a fault to the outputs off by a software handler. |
| TELEM_BUFFER | Bytes of the telemetry buffer. |
| SRAM_KIB | KiB of SRAM. |
| ISR_END_AT_M | The longest masked section is M cycles. Everything else is as in the tables. At what time, in ns, are the new duties written? |
Examples
Example 1
TOP- Input
The top value of the counter.
- Output
matches = 1
100,000,000 ÷ (2 × 16,000).
Example 2
DEAD TICKS- Input
The dead time in counter ticks.
- Output
matches = 1
400 ns × 100 MHz.
Example 3
PERIOD NS- Input
The PWM period in ns.
- Output
matches = 1
1,000,000,000 ÷ 16,000.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For ISR_END_AT_M, enter a constant expression using M. Only this entry changes with the parameter. The supported integer range is 0 through 800, inclusive.
- Replace each unfinished 65535 with your number.
Hints
Hint 1
Top, dead time and period follow from the counter clock and the PWM rate.
Hint 2
Conversions, the worst masked section, entry, then the loop. Compare with the next valley and with the budget.
Hint 3
Compare the encoder edges and the fault limit with what software can do.
What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.
15 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 1 problem on this path