2016-09-21 06:45 AM
2016-09-21 07:49 AM
Hi berkovich.nir,
You can use DMA for UART transmission, refer to this in ''19.3.13 Continuous communication using DMA'' paragraph, for more details.I suggest you refer to UART example using DMA within under this path: STM32Cube_FW_F4_V1.13.0\Projects\STM32F410xx-Nucleo\Examples\UART\UART_TwoBoards_ComDMARegards
2016-09-21 09:05 AM
The OP isn't asking to use DMA for the USART, but rather to drive a pattern buffer to the GPIO pins (ie &GPIOB->BSRR) to increase the rate of those transitions from the bit-banging being used now.
I'd probably up the baud rate, buffer the USART data, and manage the selection of the pattern buffers (ie 16 different ones to handle the different nibble receptions)2016-09-21 09:38 AM
Thank you,
Can you please explain what do you mean by Buffer the USART data and manage it by 16 different ones for different nibble???Thank you2016-09-21 10:31 AM
Your code looks dysfunctional, but I'm assuming you are trying to take ASCII digits, 0-9, and A-F can generate a sequence of 4-bits shifting out with a clock.
I'd receive the USART data via an RXNE interrupt, buffering a list of 4-bit sequences I wanted sent. In the DMA TC interrupt I would light off the next available 4-bit sequence by pointing the DMA transfer to use one of 16 prebuilt pattern buffers (what I want the pins to do) base on the 4-bit code I'd extracted earlier.You are using HAL with interrupts, but are basically in a polling loop alternating between receiving serial data and then sequencing GPIO output. To increase throughput these two tasks should really be independent, and use interrupts to do so.2016-09-21 10:47 AM
Hi Clive1,
Since it is my first code I am not really familiar with it.In order I can fully understand, do you have a simple code example??''To increase throughput these two tasks should really be independent, and use interrupts to do so'' - How can I seperate it, I would like to have an input and based on it to do some actions.Sorry for my bad basics...Nir2016-09-21 11:06 AM
Your code/project is very specific to what you want to do, I don't have a prebuilt example for that. I have posted a number DMA+GPIO examples over the years, review forum content. I don't use/like HAL, the examples I have used the SPL. For the F4 you'd need to us DMA2 to go from memory to GPIO. The GPIO BSRR register permits you to drive specific pins high/low with a single 32-bit write, and you'd create an array of these words to generate a sequence onto the GPIO ODR.
2016-09-21 11:26 AM
My project should support 2 GPIO lines.
1. CLK2. DATA from user - 0-9, A-F and not the ascii value, so translation is used.This is just an example for myself and based on that I will expand the IO.This HW should be communication device for automatic test environment so I would like to reach baude rate of ~2MHz and more if possible.I hope my project a little bit more clear.2016-09-21 04:21 PM
Well it is certainly possible to drive pins at these types of rates, for scan-chain type activity, I'd probably lean toward using the SPI peripheral if possible (8/16-bit granularity).
Your problem here would be more related to the disparity in how quickly you can supply vector data (115200 baud, throwing away 1/2 the bits) vs vector generation (2 MHz)2016-09-28 07:07 AM
Hi Clive,
Thank you very much, it was very helpful.Nir