Page 1 of 1
UART4 support on STM32F103
Posted: Fri Jan 31, 2014 5:27 pm
by alexblack
Hello.
When I tried to compile project with STM32_UART_USE_UART4 option setted to TRUE I received this message:
Code: Select all
UART4 DMA access not supported in this platform
I studied datasheets and driver code but have not found anything that would interfere with its work. When I disabled this error message my code starts to work fine.
Tell me please what is the reason to not to support UART4 on STM32F103 ?
Re: UART4 support on STM32F103
Posted: Fri Jan 31, 2014 6:27 pm
by Giovanni
Hi,
It is because DMA2 channels 4 and 5 have a shared IRQ on XL devices that would create conflicts among drivers using those channels (UART and SDIO, we rated SDIO rated more important).
Giovanni
Re: UART4 support on STM32F103
Posted: Fri Jan 31, 2014 9:08 pm
by alexblack
Thank you.
I understand that the only place where it is possible - it is dmaStreamRelease(..) function:
Code: Select all
/* Disables the associated IRQ vector.*/
nvicDisableVector(dmastp->vector);
Maybe just need to add some logic to this case? Or there are still places that I have not found?
Re: UART4 support on STM32F103
Posted: Fri Jan 31, 2014 9:12 pm
by Giovanni
Allocation and release of channels are not related to the problem.
The problem is that the ISR would have to be shared between UART and SDIO drivers so it should be placed in a shared file of some kind.
Giovanni
Re: UART4 support on STM32F103
Posted: Sat Feb 01, 2014 1:12 pm
by alexblack
Hi, but if I understood right - this is done already in file stm32_dma.c. This is shared file for both drivers, isn't it? The drivers not use direct ISR - it uses callbacks.
Code: Select all
file: "stm32_dma.c"
...
/**
* @brief DMA2 streams 4 and 5 shared interrupt handler.
* @note This IRQ is shared between DMA2 channels 4 and 5 so it is a
* bit less efficient because an extra check.
*
* @isr
*/
CH_IRQ_HANDLER(DMA2_Ch4_5_IRQHandler) {
uint32_t flags;
CH_IRQ_PROLOGUE();
/* Check on channel 4.*/
flags = (DMA2->ISR >> 12) & STM32_DMA_ISR_MASK;
if (flags & STM32_DMA_ISR_MASK) {
DMA2->IFCR = flags << 12;
if (dma_isr_redir[10].dma_func)
dma_isr_redir[10].dma_func(dma_isr_redir[10].dma_param, flags);
}
/* Check on channel 5.*/
flags = (DMA2->ISR >> 16) & STM32_DMA_ISR_MASK;
if (flags & STM32_DMA_ISR_MASK) {
DMA2->IFCR = flags << 16;
if (dma_isr_redir[11].dma_func)
dma_isr_redir[11].dma_func(dma_isr_redir[11].dma_param, flags);
}
CH_IRQ_EPILOGUE();
}
...
As a result UART4 driver works alone at least.
Re: UART4 support on STM32F103
Posted: Sat Feb 01, 2014 2:51 pm
by Giovanni
You may give it a try, that check was added when the DMA handling was not yet centralized. I don't remember if there is some other reason hidden there.
Giovanni