An overview of the registers is very helpful. It gives understanding of what exactly the stuff does and what parameters it has. Finally some clarity without "do it like this and this and it just somehow works", something many other sources have problems with by assuming some things are "obvious" or by "leave these settings at default" without any explanation of what they are or why. Maybe those things are simple and obvious indeed, but only if you ALREADY know them. Your insight closes the gap there. Thanks a lot!
Great video Eddie, you have a knack for making simple, things that seem very complicated at first glance. I have enjoyed each and every one of your videos.
i think it is great when sampling a data via adc and performing some dsp(fft,filtering etc.) on it. In this way, cpu clock is not wasted by moving data from peripheral to mem location.
Man, pls continue with those videos... milion times better than some of the "idndians guys" whitch using cubeMX for blink led... good work man, im learn a lot from u
Nice video. I really needed this explanation about the general working of the DMA. Coming from Arduino with little knowledge about STM32 the DMA is completely new to me. Currenty I'm trying to output some audio from an STM32F4 discovery and in a tutorial the DMA was used. I want to make a synthesizer and it seems inefficient to calculate and write to the I2S bus for every audio sample. I'm going to try to pre calculate x samples (not to many because it has to be real time) and put them in the DMA buffer and let it handle the rest. Would this be the way to go about it?
To tell you the truth I have never done any audio related work. But if you can offload as much to hardware it's always faster then doing it in software
Thanks for great video! Much better than STM ;) However, there is something that puzzles me. I want to read data from my mems board using DMA and i2c. There are multiple memory addresses for each reading/data I want to extract. Does it mean that for each memory address I have to use separate DMA channel? According to your video I am supposed to use one DMA channel per device. How is that supposed to work if I want to transfer multiple data from different memory addresses? Anyway, thanks for your great job. Looking forward to watch more :)
Your i2c receives data on only one register.... Dma is for your i2c not for mem device internal memory...dma has no connection to that . Your device send data to i2c and you read it from i2c register... That's it. You can tell your i2c to read from any address of your devices that is fine but still the device will send the data to your i2c and you can only find that in one register. Don't confuse i2c registers and your men's registers...the mcu has no connection to them.
Thanks for your fast replay. Not everything is clear enough for me so maybe I will describe what I would like to achive. I have mems device conected to i2c bus in slave mode. Device (x-nucleo-iks01a3) is visible and ready to work. Data I want to read is stored in few device memory registers. I am trying to use HAL DMA function HAL_I2C_Mem_Read_DMA which takes as arguments i2c device address and device memory register. Now, lets assume, I have 6 memory registers I want to read from. According to what you said, I have one DMA channel dedicated to whole i2c bus? Is it still this same in case of connecting few devices to i2c bus? Lets assume my DMA is working in normal mode. If I am missing any details let me know. Thanks in advance! :)
@@zuro8 I have little knowledge about HAL functions and how they work. But you can use DMA in memory increment mode and call a function to read a certain register in your mems. The dma will transfer the data to the first index of your desired array. Then upon a DMA transfer complete interrupt you can call your function to read the next registers and since DMA is in memory increment mode it will increment the array you set as the memory to store incoming data.... it sounds like a lot but its really not, its just hard to explain in text. However you do have to keep track of which device is currently the active slave so you know what device that data belongs to. You can also just change the array variable you configure in your DMA when talking to a new device so that way each device will have their own data in a separate variable in your code...again i know im explaining it kind of weird
Thanks for the great videos, really easy to follow! Could you do a video on SPI + DMA? In SPI you are transmitting and receiving at the same time, so I guess you need to setup 2 DMA streams for RX and TX. However, how are these streams synchronized? How do you make sure there are no race conditions? One stream writes into SPI DR and the other one reads from it.
It sounds more complicated than it really is. If you understand how SPI works and the fact that it serially shifts in the incoming byte as you transmit your own byte , basically when you send bit 0 of your data, then your data shifted to the right and the empty bit 7 gets filled with your new incoming bit and so on and so, the exact moment you are don't transmitting you're entire received byte is already there to read, the stm32 F1 is old but in newer stm32 micros, there is a register with the number of bytes you want to send and that generated an interrupt if you want or not, but either way it's really not as complex as you make it sound with race conditions and stuff. I might make a video on that. I'm just really lazy when it comes to it if I'm honest. I rather write about it on my blog so keep an eye on that.
@@EdwinFairchild Wow that was fast, thanks a lot! :) I'll give it a try and see what I run into, maybe I'm overthinking about non-existing issues. Totally understand the lazyness to make videos, a blog post about it would be great as well! Will definitely keep an eye on it!