2012-09-08 05:48 AM
Hi guys,
I have a board from hardware guys who told me they had tested this board and everything is fine including SPI1. But I cannot let my SPI1 working because status register bit TXE is always 0. From the specification, this bit should be 0 at reset status. Then I went through the code and found function RCC_WaitForHSEStartUp() always returns ERROR. I checked the address 0x40021000, it was 0x10001. We are using 8MHz external clock. Can anyone give me any clus that I can check to find the problem? Thanks in advance. David #not-ready #not-oscillating #rcc2012-09-08 06:24 AM
You have to start it, and it has to oscillate, for it to come ready.
Check it with a scope. The part will start running from the 8 MHz (STM32F1) internal oscillator, and you should be able to test a lot of things running from the HSI, or at higher speed via the PLL. If the SPI peripheral registers are stuck at zero, you might want to confirm the peripheral clock has been enabled.2012-09-09 05:49 AM
Hi Clive1
Thanks for your reply. I can see function RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE) has been called. So it looks like the problem comes from the internal clock. I will use a scope to see I can find anything or not. Thanks again. Cheers,2012-09-10 07:05 AM
The 0x10001 status shows that the HSE oscillator is started but not running. The usual problem with this is that the crystal and capacitors are not well matched to the oscillator requirements. ST has an app note on selecting crystals and matching capacitors. Look at app note AN2867.
Jack Peacock2012-09-10 07:27 AM