I have STM32F411 board. My input signal is at PA1 pin - TIM2_CH2. I want to run input capture feature and get samples to 128 width array with DMA in circular mode.
Is it possible to use ICU driver with DMA circular mode on STM32F4 platform ?
I have seen PWM-ICU example, but I don't know how to use it with DMA.
ICU driver and DMA ?
Moderators: RoccoMarco, barthess
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: ICU driver and DMA ?
Hi,
It should be possible by configuring the DIER register in the ICUConfig structure.
See the STM32 Reference Manual for details.
Giovanni
It should be possible by configuring the DIER register in the ICUConfig structure.
See the STM32 Reference Manual for details.
Giovanni
Re: ICU driver and DMA ?
My ICUConfig looks like:
Whether it is the correct configuration ?
And next I have arrray and dmaStreamAllocate, how tu enable DMA in circular mode (peripheral-to-memory)?
Code: Select all
static ICUConfig icucfg = {
ICU_INPUT_ACTIVE_HIGH,
10000,
NULL,
NULL,
NULL,
ICU_CHANNEL_2,
TIM_DIER_CC2DE | TIM_DIER_TDE
};
Whether it is the correct configuration ?
And next I have arrray and dmaStreamAllocate, how tu enable DMA in circular mode (peripheral-to-memory)?
Code: Select all
uint32_t samples[128];
if (dmaStreamAllocate(STM32_DMA2_STREAM6, 0, NULL, NULL))
chSysHalt("DMA already in use");
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: ICU driver and DMA ?
Hi,
You can find an example of circular DMA in the ADC or I2S drivers
Giovanni
You can find an example of circular DMA in the ADC or I2S drivers
Giovanni
- alex31
- Posts: 379
- Joined: Fri May 25, 2012 10:23 am
- Location: toulouse, france
- Has thanked: 38 times
- Been thanked: 62 times
- Contact:
Re: ICU driver and DMA ?
Hello omcdr,
If you were able to achive ICU driver and DMA, it would be nice to post here a working snipset of your code, if it's possible for you.
It can help people not to reinvent wheel
Alexandre
If you were able to achive ICU driver and DMA, it would be nice to post here a working snipset of your code, if it's possible for you.
It can help people not to reinvent wheel
Alexandre
- alex31
- Posts: 379
- Joined: Fri May 25, 2012 10:23 am
- Location: toulouse, france
- Has thanked: 38 times
- Been thanked: 62 times
- Contact:
Re: ICU driver and DMA ?
Hi,
Finally, i took time to read TIM and DMA section of RM090, and using dma helper functions, was able to capture both width and period with DMA.
tips : need to use burst mode, which involve from TIM side, TIMx_DCR and TIMx_DMAR, explanations in RM090 are quite clear.
Since i am a teacher, and i plan to add DMA to my lectures, i think that right now, DMA API is a bit harsh.
(the class will be centered on this exercise : decoding an ADSB mode-S 112 bits frame) adsb mode s documentation
What about making DMA a first class citizen, and giving it a API like the other peripheral, with structure configuration, and a start, stop, startTransfert API ?
If this has a chance to get in ChibiOS in the future, i can work on it to propose a draft.
Albeit for teaching purpose, a simpler API could permit to chibios users to easily use DMA for peripheral that are not yet managed.
Alexandre
Finally, i took time to read TIM and DMA section of RM090, and using dma helper functions, was able to capture both width and period with DMA.
tips : need to use burst mode, which involve from TIM side, TIMx_DCR and TIMx_DMAR, explanations in RM090 are quite clear.
Since i am a teacher, and i plan to add DMA to my lectures, i think that right now, DMA API is a bit harsh.
(the class will be centered on this exercise : decoding an ADSB mode-S 112 bits frame) adsb mode s documentation
What about making DMA a first class citizen, and giving it a API like the other peripheral, with structure configuration, and a start, stop, startTransfert API ?
If this has a chance to get in ChibiOS in the future, i can work on it to propose a draft.
Albeit for teaching purpose, a simpler API could permit to chibios users to easily use DMA for peripheral that are not yet managed.
Alexandre
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: ICU driver and DMA ?
Hi,
Problem is that DMA is very different on different MCUs, it would be hard to make a portable driver when you have to set very specific options.
Giovanni
Problem is that DMA is very different on different MCUs, it would be hard to make a portable driver when you have to set very specific options.
Giovanni
Who is online
Users browsing this forum: Google [Bot] and 47 guests