How to the same DMA Stream with different DMA channel on the Cortex-M7(STM32F746)?












1















I want to use SPI2 and UART4 peripherals with DMA but, as I see DMA1-SPI2-Tx and DMA1-UART4-Tx uses the same dma stream.



SPI2_TX  - DMA1_Stream4 (channel 0)
UART4_TX - DMA1_Stream4 (channel 4)


Is there any way to use the same DMA stream for the different peripherals at the same time?
enter image description here










share|improve this question























  • No the channel can't work for SPI and UART at the same time. Only thing you can do is use an additional handler which controls the access permission to the DMA channel if your system does not require using SPI and UART at exactly the same time.

    – A.R.C.
    Nov 23 '18 at 14:12













  • It is not a channel. Just the Stream are the sames, channells are different.

    – erenbasturk
    Nov 23 '18 at 19:44
















1















I want to use SPI2 and UART4 peripherals with DMA but, as I see DMA1-SPI2-Tx and DMA1-UART4-Tx uses the same dma stream.



SPI2_TX  - DMA1_Stream4 (channel 0)
UART4_TX - DMA1_Stream4 (channel 4)


Is there any way to use the same DMA stream for the different peripherals at the same time?
enter image description here










share|improve this question























  • No the channel can't work for SPI and UART at the same time. Only thing you can do is use an additional handler which controls the access permission to the DMA channel if your system does not require using SPI and UART at exactly the same time.

    – A.R.C.
    Nov 23 '18 at 14:12













  • It is not a channel. Just the Stream are the sames, channells are different.

    – erenbasturk
    Nov 23 '18 at 19:44














1












1








1








I want to use SPI2 and UART4 peripherals with DMA but, as I see DMA1-SPI2-Tx and DMA1-UART4-Tx uses the same dma stream.



SPI2_TX  - DMA1_Stream4 (channel 0)
UART4_TX - DMA1_Stream4 (channel 4)


Is there any way to use the same DMA stream for the different peripherals at the same time?
enter image description here










share|improve this question














I want to use SPI2 and UART4 peripherals with DMA but, as I see DMA1-SPI2-Tx and DMA1-UART4-Tx uses the same dma stream.



SPI2_TX  - DMA1_Stream4 (channel 0)
UART4_TX - DMA1_Stream4 (channel 4)


Is there any way to use the same DMA stream for the different peripherals at the same time?
enter image description here







microcontroller stm32 stm32f7






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 12:58









erenbasturkerenbasturk

32527




32527













  • No the channel can't work for SPI and UART at the same time. Only thing you can do is use an additional handler which controls the access permission to the DMA channel if your system does not require using SPI and UART at exactly the same time.

    – A.R.C.
    Nov 23 '18 at 14:12













  • It is not a channel. Just the Stream are the sames, channells are different.

    – erenbasturk
    Nov 23 '18 at 19:44



















  • No the channel can't work for SPI and UART at the same time. Only thing you can do is use an additional handler which controls the access permission to the DMA channel if your system does not require using SPI and UART at exactly the same time.

    – A.R.C.
    Nov 23 '18 at 14:12













  • It is not a channel. Just the Stream are the sames, channells are different.

    – erenbasturk
    Nov 23 '18 at 19:44

















No the channel can't work for SPI and UART at the same time. Only thing you can do is use an additional handler which controls the access permission to the DMA channel if your system does not require using SPI and UART at exactly the same time.

– A.R.C.
Nov 23 '18 at 14:12







No the channel can't work for SPI and UART at the same time. Only thing you can do is use an additional handler which controls the access permission to the DMA channel if your system does not require using SPI and UART at exactly the same time.

– A.R.C.
Nov 23 '18 at 14:12















It is not a channel. Just the Stream are the sames, channells are different.

– erenbasturk
Nov 23 '18 at 19:44





It is not a channel. Just the Stream are the sames, channells are different.

– erenbasturk
Nov 23 '18 at 19:44












1 Answer
1






active

oldest

votes


















2















Is there any way to use the same DMA stream for the different peripherals at the same time?




No, there isn't. Only a single channel can be selected for each stream. Of course if you are not transmitting on both ports at the same time, then you can switch back and forth between channels.



Use another stream



Although it seems that both SPI2 TX and UART4 TX are confined to Stream 4, it is possible to control transmit channels by other means.



Note: this works only with SPI master or UART with no flow control. i.e. as long as the MCU is in complete control of the timing.



There is no rule saying that a DMA transfer should access the same peripheral the request came from (however they must be on the same APB bus for DMA1). It is possible to use e.g. TIM6 (or any other timer connected to DMA1) to generate periodic DMA requests on a stream other than 4, and set up that stream to transfer data from memory to SPI2->DR.



Just set the timer frequency to generate update DMA requests with 1/8 of your SPI bitrate, write a few bytes into SPI2->DR to fill the FIFO, and start the timer.



It would be more tricky with an UART with its various framing options, but it should generally work.






share|improve this answer
























  • I will try to change the channell before the sending a data and see the latest status.

    – erenbasturk
    Nov 23 '18 at 19:43











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53447175%2fhow-to-the-same-dma-stream-with-different-dma-channel-on-the-cortex-m7stm32f746%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2















Is there any way to use the same DMA stream for the different peripherals at the same time?




No, there isn't. Only a single channel can be selected for each stream. Of course if you are not transmitting on both ports at the same time, then you can switch back and forth between channels.



Use another stream



Although it seems that both SPI2 TX and UART4 TX are confined to Stream 4, it is possible to control transmit channels by other means.



Note: this works only with SPI master or UART with no flow control. i.e. as long as the MCU is in complete control of the timing.



There is no rule saying that a DMA transfer should access the same peripheral the request came from (however they must be on the same APB bus for DMA1). It is possible to use e.g. TIM6 (or any other timer connected to DMA1) to generate periodic DMA requests on a stream other than 4, and set up that stream to transfer data from memory to SPI2->DR.



Just set the timer frequency to generate update DMA requests with 1/8 of your SPI bitrate, write a few bytes into SPI2->DR to fill the FIFO, and start the timer.



It would be more tricky with an UART with its various framing options, but it should generally work.






share|improve this answer
























  • I will try to change the channell before the sending a data and see the latest status.

    – erenbasturk
    Nov 23 '18 at 19:43
















2















Is there any way to use the same DMA stream for the different peripherals at the same time?




No, there isn't. Only a single channel can be selected for each stream. Of course if you are not transmitting on both ports at the same time, then you can switch back and forth between channels.



Use another stream



Although it seems that both SPI2 TX and UART4 TX are confined to Stream 4, it is possible to control transmit channels by other means.



Note: this works only with SPI master or UART with no flow control. i.e. as long as the MCU is in complete control of the timing.



There is no rule saying that a DMA transfer should access the same peripheral the request came from (however they must be on the same APB bus for DMA1). It is possible to use e.g. TIM6 (or any other timer connected to DMA1) to generate periodic DMA requests on a stream other than 4, and set up that stream to transfer data from memory to SPI2->DR.



Just set the timer frequency to generate update DMA requests with 1/8 of your SPI bitrate, write a few bytes into SPI2->DR to fill the FIFO, and start the timer.



It would be more tricky with an UART with its various framing options, but it should generally work.






share|improve this answer
























  • I will try to change the channell before the sending a data and see the latest status.

    – erenbasturk
    Nov 23 '18 at 19:43














2












2








2








Is there any way to use the same DMA stream for the different peripherals at the same time?




No, there isn't. Only a single channel can be selected for each stream. Of course if you are not transmitting on both ports at the same time, then you can switch back and forth between channels.



Use another stream



Although it seems that both SPI2 TX and UART4 TX are confined to Stream 4, it is possible to control transmit channels by other means.



Note: this works only with SPI master or UART with no flow control. i.e. as long as the MCU is in complete control of the timing.



There is no rule saying that a DMA transfer should access the same peripheral the request came from (however they must be on the same APB bus for DMA1). It is possible to use e.g. TIM6 (or any other timer connected to DMA1) to generate periodic DMA requests on a stream other than 4, and set up that stream to transfer data from memory to SPI2->DR.



Just set the timer frequency to generate update DMA requests with 1/8 of your SPI bitrate, write a few bytes into SPI2->DR to fill the FIFO, and start the timer.



It would be more tricky with an UART with its various framing options, but it should generally work.






share|improve this answer














Is there any way to use the same DMA stream for the different peripherals at the same time?




No, there isn't. Only a single channel can be selected for each stream. Of course if you are not transmitting on both ports at the same time, then you can switch back and forth between channels.



Use another stream



Although it seems that both SPI2 TX and UART4 TX are confined to Stream 4, it is possible to control transmit channels by other means.



Note: this works only with SPI master or UART with no flow control. i.e. as long as the MCU is in complete control of the timing.



There is no rule saying that a DMA transfer should access the same peripheral the request came from (however they must be on the same APB bus for DMA1). It is possible to use e.g. TIM6 (or any other timer connected to DMA1) to generate periodic DMA requests on a stream other than 4, and set up that stream to transfer data from memory to SPI2->DR.



Just set the timer frequency to generate update DMA requests with 1/8 of your SPI bitrate, write a few bytes into SPI2->DR to fill the FIFO, and start the timer.



It would be more tricky with an UART with its various framing options, but it should generally work.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 23 '18 at 14:54









berendiberendi

3,9211624




3,9211624













  • I will try to change the channell before the sending a data and see the latest status.

    – erenbasturk
    Nov 23 '18 at 19:43



















  • I will try to change the channell before the sending a data and see the latest status.

    – erenbasturk
    Nov 23 '18 at 19:43

















I will try to change the channell before the sending a data and see the latest status.

– erenbasturk
Nov 23 '18 at 19:43





I will try to change the channell before the sending a data and see the latest status.

– erenbasturk
Nov 23 '18 at 19:43


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53447175%2fhow-to-the-same-dma-stream-with-different-dma-channel-on-the-cortex-m7stm32f746%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Berounka

Sphinx de Gizeh

Fiat S.p.A.