cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f0 spi dma and no interrupt

timotet
Associate II
Posted on July 13, 2012 at 23:08

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-dma
13 REPLIES 13
Posted on July 13, 2012 at 23:13

Please supply the include file.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
timotet
Associate II
Posted on July 14, 2012 at 11:58

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?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
timotet
Associate II
Posted on July 14, 2012 at 19:48

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.

thanks

Posted on July 14, 2012 at 20:08

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
timotet
Associate II
Posted on July 14, 2012 at 20:39

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

Tim
Posted on July 14, 2012 at 23:07

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
timotet
Associate II
Posted on July 15, 2012 at 00:07

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.

Tim

Posted on July 15, 2012 at 15:04

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() {

..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..