cancel
Showing results for 
Search instead for 
Did you mean: 

SPI3 RXNE SLOW

timos
Associate
Posted on May 27, 2012 at 10:40

Hi,

I am using the STM32F107 micro, and tied an SD card into its SPI3 remmaped pins. As i saw in the datasheet the RXNE bit responce after the trasnmission is at worse 1 bit clock in duration. As you can see from the DSO timmings i measured this time response to be much worse , leading into a degradation of tranfer rate significantly. Also the returns from, while () and function call _spi_read_write(data) seems also to last too much for a 72MHz proccessor clock. So i am giving you the main code , and the settings of the peripheral clocks and SPI settings also. If you have any suggestions , please feel free to reply 🙂 

P.S. I used a simple loop in the main just send a byte after checking the TXE flag , then waited for RXNE flag to get high ''1'', then opened a debug I/O pin (PD2) then closed it ''0'' then read the RX register so the RXNE bit gets cleared, and then reloop.
3 REPLIES 3
Posted on May 27, 2012 at 15:44

You should probably review the code generated by the compiler. You don't mention which tool chain this is. APB access isn't particularly fast.

If timing is critical, I probably wouldn't bury the test with so much abstraction.

 DebugPinOn();                       //Open Oscilloscope debug pin ''1''

  datum= SPI_I2S_ReceiveData(SPI3);   //Read the RX buffer data byte

  DebugPinOff();                      //Close Oscilloscope debug pin ''0''

Becomes :

#define DEBUGPINON GPIOD->BSRR = GPIO_Pin_2;

#define DEBUGPINOFF GPIOD->BRR = GPIO_Pin_2;

DEBUGPINON

datum = SPI3->DR;

DEBUGPINOFF

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
timos
Associate
Posted on May 27, 2012 at 16:43

Thanks m8 for the responce,

I am using Atolic True Studio Lite version with the included Linker Toolchain and exporting .elf file to the ST-Link downloader/debugger. Also its the release type , not the debug one. I have attached a photo. I will take a look at my clocks on the APB , i guess the whole latency is from there 🙂

Cheers

Timothy

________________

Attachments :

Toolchain.gif : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0xe&d=%2Fa%2F0X0000000bgE%2FfX5D7wgmF5FsG.vwmde4Byu5LSUeAjsOZ2_1_JP4bVc&asPdf=false
srdjan
Associate II
Posted on February 27, 2015 at 20:09

Have you ever figured out the solution to this? Looks like I bumped into a same problem, where I have a large gap between bytes because of the RXNE delay.