-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STM32G0/G4 DMA + more devices + DAC DMA #632
Conversation
75197f5
to
b655ad1
Compare
cb7b19f
to
f3dd039
Compare
f3dd039
to
2f7a6a7
Compare
2f7a6a7
to
7b45948
Compare
7b45948
to
4e3d374
Compare
Now all F0, F1, F3, L0, L1, L4, G0 and G4 are supported.
fc057f9
to
8896b5b
Compare
Finally DMA should be supported for all F0, F1, F3, L0, L1, L4, G0 and G4 (if the CI agrees). Most likely H7 DMA1/2, WB and WL would also work if we supported the controllers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really well written code! No complaints from my side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍🏽
* Set the output voltage for a DAC channel | ||
* | ||
* @param chan The channel to set | ||
* @param value The 12-bit DAC output value, range 0-4095. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to use the full range of uint16_t as input (and the left-aligned data register DHR12L1
) to be able to use the same interface for different DACs in the future and better portability.
In any case, it could be useful to put the precision of the DAC somewhere in the code:
static constexpr uint8_t PrecisionBit = 12;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to use the full range of uint16_t as input (and the left-aligned data register DHR12L1) to be able to use the same interface for different DACs in the future and better portability.
It would be quite evil to change the data format to left-justified for an already existing driver. The benefit seems rather small and the choice seems a bit arbitrary as well. Let's say we have an 8 bit or 18 bit DAC, in both cases 16 bit left aligned data is not the most useful choice. It would be fine for me to state in some constexpr
static variable what the data format is and the user code can deal with it.
In any case, it could be useful to put the precision of the DAC somewhere in the code:
static constexpr uint8_t PrecisionBit = 12;
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok 👍🏽
This PR adds DMA support for controllers with the DMAMUX IP. Furthermore a DAC DMA driver is added, DAC support for all STM32 with DAC is provided and DAC examples with and without DMA are added (modm currently has zero),
Additionally, this PR completes DMA support for all previously unsupported F0, F1, F3, L0, L1 and L4.
This depends on modm-io/modm-devices#60.
The G4 DMA DAC example:
The information how many channels a DAC instance has is pretty hard to get out of the CubeMX data. It's a huge mess with tons of conditional expressions in strings. Thus, the driver might provide more channels than are actually working in hardware. The same is true for information if channels have an output buffer.