Hello Giovanni,
at first thank you for your quick answer on my last post.
I have found another issue regarding my Olimex H107 with Keil uvision.
As i have written in my last post, my target should use
all 3 SPI ports, ADC, timers 2 and 4, PWM, USART ports 2 and 3 and the serial driver.
I have configured mcuconf.h and halconf.h accordingly. After a project build i have got following
linker errors:
.\obj\107test.axf: Error: L6200E: Symbol Vector70 multiply defined (by uart_lld.o and spi_lld.o).
.\obj\107test.axf: Error: L6200E: Symbol Vector74 multiply defined (by uart_lld.o and spi_lld.o).
.\obj\107test.axf: Error: L6200E: Symbol VectorD8 multiply defined (by uart_lld.o and serial_lld.o).
Target not created
Looking into the sources i have found that you have made a fixed assignment of the DMA channels
to SPI, USART, ADC. Additionaly you made multiple assignments of the same DMA channel to different I/O.
This leads to multiple assignments of vectors.
Is there a possibility of using a pure interrupt driven model for the I/O without DMA and give the developer
the freedom of assigning DMA channels to high bandwidth I/O, without rewriting the lld drivers?
Thank you in advance
DMA assignments on STM32
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: DMA assignments on STM32
Hi,
In the STM32F1xx family the DMA channels are hardwired to specific peripherals so SPI1 shares the channels with USART3, SPI2 shares with USART1. USART2 and ADC are on a DMA channels not shared with any SPI. See the table 78 of the STM32 reference manual for more details.
It is not physically possible to use the above peripherals with DMA concurrently, it is not a limit of the OS. What you can do is to use the Serial driver instead of the UART driver for asynchronous I/O, the serial driver does not use DMA channels, it is entirely interrupt driven (and not inefficient at all). It would be possible to reimplement the UART driver to (optionally) not use DMAs but it would be a significant effort and the serial driver is already there.
In the STM32F-2 family the DMA has been improved, it is possible to remap the DMA request lines on multiple "streams", in perspective you may consider switching to this new family, if I remember well it is also pin compatible with current devices.
Anyway, the issues has been mitigated in ChibiOS/RT 2.3.4 (unstable), the new DMA handler allows to share the DMA channels among multiple peripherals but not concurrently, you have to stop a driver before starting another driver sharing the same DMA channels. Concurrent use is trapped as a programming error by assertions.
Giovanni
In the STM32F1xx family the DMA channels are hardwired to specific peripherals so SPI1 shares the channels with USART3, SPI2 shares with USART1. USART2 and ADC are on a DMA channels not shared with any SPI. See the table 78 of the STM32 reference manual for more details.
It is not physically possible to use the above peripherals with DMA concurrently, it is not a limit of the OS. What you can do is to use the Serial driver instead of the UART driver for asynchronous I/O, the serial driver does not use DMA channels, it is entirely interrupt driven (and not inefficient at all). It would be possible to reimplement the UART driver to (optionally) not use DMAs but it would be a significant effort and the serial driver is already there.
In the STM32F-2 family the DMA has been improved, it is possible to remap the DMA request lines on multiple "streams", in perspective you may consider switching to this new family, if I remember well it is also pin compatible with current devices.
Anyway, the issues has been mitigated in ChibiOS/RT 2.3.4 (unstable), the new DMA handler allows to share the DMA channels among multiple peripherals but not concurrently, you have to stop a driver before starting another driver sharing the same DMA channels. Concurrent use is trapped as a programming error by assertions.
Giovanni
Re: DMA assignments on STM32
Hello Giovanni,
thanks for your answer. I should have RTFM before posting.
Nevertheless my project will never build, because the DMA channels are always assigned?
Or is there a chance to use my I/O mix my the unstable branch?
thanks for your answer. I should have RTFM before posting.
Nevertheless my project will never build, because the DMA channels are always assigned?
Or is there a chance to use my I/O mix my the unstable branch?
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: DMA assignments on STM32
It should build using the unstable branch because those IRQ vectors are now centralized but you still would not be able to use some peripherals concurrently, you will have to start/stop the conflicting drivers appropriately before performing I/O.
Giovanni
Giovanni