Fix only PWM 0 being enabled via Pinmux #369
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, all the PWMs (minus the LCD backlight) are being routed through pinmux, but the value being passed for the PWM output enable is the constant
'{'b1}
. Because the inner value is'b1
, this is extended to fill the 7 bit PWM output range as0000001
, instead of using'1
which would extend to1111111
. Hence, to fix this, we would want to use the value'{'1}
instead.Thanks to @elliotb-lowrisc who came up with a slightly more robust and comprehensible alternative, where we more explicitly cast/extend these values to match the output size and module count. These changes should probably be propagated to the other port connections (e.g. SPI), but are isolated to just PWM for this PR to keep this PR focused on fixing the bug. This ensures that all outputs of all PWM devices are now enabled through pinmux.
I've tested this fix makes the correct values appear on the waveforms in simulation, and I've built a bitstream and tested muxing
pwm_out_1
toPMOD0_2
and using a digtal multimeter to read a range of values, which wasn't working previously. The code snippet used for testing is as below:Edit: I've also now manually tested (again on FPGA using a multimeter) every single possible mux of PWM/pin - all seem to be working as expected.