cancel
Showing results for 
Search instead for 
Did you mean: 

SPI problem

ybenharim10
Associate II
Posted on January 12, 2009 at 04:04

SPI problem

5 REPLIES 5
ybenharim10
Associate II
Posted on May 17, 2011 at 12:58

Hi,

I am writing SPI driver - full duplex with DMA send/receive.

In order to test the driver, I use loopback from SPI1 to SPI2 in the evaluation board.

When I define SPI1 as master, I can see generated clock signal in the scope.

When I define SPI2 as master, I can see generated clock signal in the scope, only after boot from flash, but not when running from debugger.

Since I need to run with debugger in order to do testing, I wonder if you have any idea why this happens and how to resolve this...

(This problem happens also in the SPI full duplex example from the FWLib)

Joval

jj
Associate II
Posted on May 17, 2011 at 12:58

Nicely described:

Can you temporarily ''reverse'' your code - so that SPI2 starts out as master - and observe if this works? This will at least confirm that SPI2 works correctly under your debug.

Tell us your toolchain (device too would be useful) and identify your debug probe. I recall past issues (some resolved) with updated versions of the various toolchains.

ybenharim10
Associate II
Posted on May 17, 2011 at 12:58

Hi,

I am using evaluation board with stm32x103B processor and IAR5 kickstart IDE.

The problem happens when SPI2 is the master. As I understand SPI protocol, it should produce clock signal, even when it is not connected to SPI1 (slave). I don't observe clock signal at SPI2 when it is configured as master when I run with debugger (on flash), but when I boot from flash, I can see the missing clock signal!?!

16-32micros
Associate III
Posted on May 17, 2011 at 12:58

Hi,

I believe this is a problem dealing with the Jlink/JTAG reset of the device, If you have Jlink version 6 ( Written at the back side of the box),

You should see the problem disappearing if you configure EWARM version 5.x like this way { See attached }.

Else, if this does not help, I suggest you to make call to ''SPI_I2S_DeInit(SPI2); '' before configuring it. this would reset/enable the SPI peripheral and avoid this issue with IAR that is not able to reset the peripherals after two trials.

Hope this helps you.

Cheers,

STOne-32.

ybenharim10
Associate II
Posted on May 17, 2011 at 12:58

Thanks,

I work with JLink7, not 6.

I also already had SPI_I2S_DeInit() function for SPI1/SPI2.

It seems that the clock generation problem is resolved when downloading to target before runnign with debugger and avoiding pressing debugger reset button and running without download (both with SPI1/SPI2).

Is there a way to avoid the download?