2024-08-30 08:27 AM - edited 2024-08-30 09:12 AM
Hello,
I am trying to implement the following: a timer (tim3) is set to PWM generation, outputting a pulse periodically. Its TRGO triggers the DMA channel to request I2C to initiate a read transaction, read 8 bytes and generate an event interrupt (TC probably) to process these data bytes. On the next PWM pulse the next 8 bytes should be read. Data should be put to a circular buffer (ideally 8 bytes long, so that data is just overwritten into the same memory buffer. Cycle should continue indefinitely.
I feel like this scenario should be implementable, however I don't seem to grasp how to set it up correctly. I have the timer generating pulses correctly, but no tinkering with GPDMA and I2C settings yields a working procedure, at best I manage to make I2C to trigger, but only read 2 bytes once and then not reacting to consecutive pulses. I don't ask to do my job for me, but at least could you confirm that it is doable and outline the correct way to set it up? Thx.
Here is how everything is set up now (pics attached) and how I start the cycle in the code:
2024-08-30 09:51 AM - edited 2024-08-30 10:00 AM
After some meditating over the reference manual, I got an idea. I think, to initiate a new transaction, I need to update I2C CR2 register each time. So, I think I need to make a linked list DMA queue, with a node writing something into CR2, and the next node to actually request Rx. Does it sound correct?