2012-07-13 02:08 PM
Hi
Ive been trying to get the SPI DMA TX interrupt to work with no luck. Im trying to load an array onto the SPI bus then get the interrupt to finish the transaction. attached is my spi, dma , and nvic setup code. thanks in advance tim #stm32f0-spi-dma2012-07-13 02:13 PM
Please supply the include file.
2012-07-13 03:13 PM
here you go
________________ Attachments : spi.hpp : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzpQ&d=%2Fa%2F0X0000000bQK%2F5DHSdWKTUx13hwfQkTy5SfHACDRGNDj8aWjIB3sgV4s&asPdf=false2012-07-14 02:58 AM
It looks like quite a reasonable attempt, the logic makes sense. I don't like the while() loops in the DMA interrupt, but SPI doesn't seem to offer a NOT BSY (IDLE?) interrupt, and when the bus transaction is going to stop is obfuscated by the FIFO's. A whole load of implementation fail from ST there.
You have a #define that has a name and substitution which are identical, probably something I would try and avoid. Is the problem that it never enters the interrupt, or that is gets stuck or unpredictable?2012-07-14 10:48 AM
It never enters the interrupt. I single step it up to the DMAy_Channelx->CCR |= DMA_CCR_EN line in the DMA_Cmd function and then it goes in to a
WWDG interrupt. Ive removed the duplicate #define and the while loops in my dma interrupt also. thanks2012-07-14 11:08 AM
then it goes in to a WWDG interrupt.
That probably means it's Hard faulting, GCC collects a whole bunch of the unassigned interrupts to an infinite loop. So perhaps you have an issue with the instruction set or linkage.2012-07-14 11:39 AM
So perhaps you have an issue with the instruction set or linkage.
Any hints on where to look for theses issues. Im using the standard peripheral libraries from ST. The startup_stm32f0xx.s supplied by Atollic. Im using the eclipse IDE. Thanks again Tim2012-07-14 02:07 PM
As I recall the GNU/GCC assembler didn't like the ''adds rX, rX, #4'' instructions in startup_stm32f0xx.s when I was porting the code.
You're saying you can get to the DMA_Cmd() before it faults, which would take you beyond that. I think you need to get your project, or at least this SPI portion, condensed into a single source with main(), etc and present that in it's entirety. I'd probably start by looking at the listing files, and the code paths for the SPI, or more specifically the DMA interrupt. At the Hard Fault I'd dig back in the stack frame and get a feel for the faulting PC (instruction address) and registers. That and the listing would pretty much point to a potential failure point. I'd check also the stack was within reasonable bounds. If you're comfortable with zipping up a complete project file, with objects, listing and hex files, I could take a look.2012-07-14 03:07 PM
Thanks for the info.
Yes I'm able to single step into the DMA_Cmd function. After your last post I tried to run the program on another install of eclipse I have and I get to the same point with the same error. This code compiles with no errors on both eclipse installs. One is the latest Juno release and the other is the Indigo release. I'm using sourcery g++ lite for the tool chain. I didnt condense the project as you mentioned, its not very complicated I'm sure you can follow it. Just a simple program to use with a nokia 5110 LCD. Thank you, your help is very appreciated. Tim2012-07-15 06:04 AM
The most apparent problem is that you're using C++ which mangles the function names, and means the name for your IRQ does not match the name in the vector table.
You should be able to fix this using an explicit C declaration of the function. Or you could just use .C/.H files if you're not using C++, or place the interrupt code in the stm32f0xx_it.c file. ///DMA interrupt routine void cdecl SPI_PORT_DMA_TX_IRQHandler() { ..