2022-02-07 02:57 AM
I've asked a question about using I2C with DMA. https://community.st.com/s/question/0D53W00001LUuCuSAL/is-there-a-guide-on-how-to-use-i2c-with-dma
I've had answers, but these were mostly advices to use an example. As I explained, in short: "learning directly from an example would be an exercise in cargo cult programming".
MX is a very useful tool to configure the µCU for beginners. (that is people who know programming but are not familiar with µCU, or are used to work on Arduino) but still require some knowledge.
I think an article that would offer
would help users learn rather than copy code from an example and hope for the best.
It's also an opportunity for users to have a preview of surrounding topics they can dive deeper into if they want to.
In my case, using HAL drivers to use I2C in blocking mode was possible with a little googling and trial and error. Switching to DMA is tricky since most example codes or HAL drivers descriptions (such as UM 1785) don't address configuration with MX. Linking I2C with DMA, in addition to interrupts. is less intuitive than with I2C in blocking mode.
2022-02-07 06:11 AM
You could post it to the idea zone.
Dont see how using examples to learn is cargo cult.
2022-02-07 08:06 AM
2022-02-07 07:06 PM
I would like to have a simple api which does a full I2C master translation from start to stop, restart included betweeb the writes and read. Then, depending on the baud rate and data payload, a dma could be used if its handle is passed, otherwise ram emulated dma would be chosen. One API for most useage. In bare metal, anything that blocks less than around 10msec could be contemplated.